月辉清照

博客园 首页 新随笔 联系 订阅 管理

ifconfig命令

ifconfig - configure a network interface。即,配置网络接口。

ifconfig的用法:

ifconfig [-v] [-a] [-s] [interface]
ifconfig [-v] interface [aftype] options | address ...

实例1,查看eth0网卡信息

[zhangchuangfei@localhost ~]$ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.57.128  netmask 255.255.255.0  broadcast 192.168.57.255
        inet6 fe80::5ba:d293:e477:fb7  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:b9:28:b8  txqueuelen 1000  (Ethernet)
        RX packets 35510  bytes 47597156 (45.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 15712  bytes 1117623 (1.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

实例2,以简短的列表显示

[zhangchuangfei@localhost ~]$ ifconfig -s
Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0             1500    35578      0      0 0         15756      0      0      0 BMRU
lo              65536        4      0      0 0             4      0      0      0 LRU

实例3,启用禁用网卡

ifconfig eth0 up
ifconfig eth0 down

实例4,配置网卡的信息

[zhangchuangfei@localhost ~]$ ifconfig 192.168.57.129 netmask 255.255.255.0

 

posted on 2021-07-17 16:14  月辉清照  阅读(206)  评论(0编辑  收藏  举报