您的位置:首页 > 运维架构 > Linux

linux下网卡配置管理工具ifconfig小结

2015-12-29 01:39 513 查看
1.ifconfig

ifconfig(interface configuration的缩写)是在Unix-like系统中用于查看以及配置网络接口设备的系统管理工具。

2.ifconfig的使用格式

ifconfig [interface]

ifconfig interface options

3.ifconfig的一些常用操作

(1)查看当前系统中存活的网络接口设备信息

ifconfig

(2)查看指定的网络接口设备的信息

ifconfig eth0 #查看eth0这块以太网卡的设备信息

(3)查看所有的网络接口设备,包括存活以及非存活的。

ifconfig -a

(4)启动或关闭指定的网络接口设备

ifconfig eth0 up #启动网卡eth0

ifconfig eth1 down #关闭网卡eth0

(5)为网卡配置或删除IPv6地址

ifconfig eth0 add 33ffe:3240:800:1005::2/64

ifconfig eth0 del 33ffe:3240:800:1005::2/64

(6)修改网卡MAC地址

ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE #修改网络接口设备eth0的MAC地址

(7)为网卡配置IP地址

ifconfig eth0 192.168.120.56     #给eth0网卡配置IP地:192.168.120.56
ifconfig eth0 192.168.120.56 netmask 255.255.255.0     #给eth0网卡配置IP地址:192.168.120.56 ,并加上子掩码:255.255.255.0
ifconfig eth0 192.168.120.56 netmask 255.255.255.0 broadcast 192.168.120.255    #给eth0网卡配置IP地址:192.168.120.56,加上子掩码:255.255.255.0,加上个广播地址: 192.168.120.255
(8)设置最大传输单元

ifconfig eth0 mtu 1500

4.ifconfig输出内容说明

[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:56:BF:26:20
inet addr:192.168.120.204  Bcast:192.168.120.255  Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:8700857 errors:0 dropped:0 overruns:0 frame:0
TX packets:31533 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:596390239 (568.7 MiB)  TX bytes:2886956 (2.7 MiB)

lo        Link encap:Local Loopback
inet addr:127.0.0.1  Mask:255.0.0.0
UP LOOPBACK RUNNING  MTU:16436  Metric:1
RX packets:68 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2856 (2.7 KiB)  TX bytes:2856 (2.7 KiB)


其中eth0表示一块网络接口设备,lo表示本机的回环接口设备。

第一行:连接类型:Ethernet(以太网)HWaddr(硬件mac地址)
第二行:网卡的IP地址、子网、掩码

第三行:UP(代表网卡开启状态)RUNNING(代表网卡的网线被接上)MULTICAST(支持组播)MTU:1500(最大传输单元):1500字节

第四、五行:接收、发送数据包情况统计

第七行:接收、发送数据字节数统计信息。

学习资料来源于:
http://www.cnblogs.com/peida/archive/2013/02/27/2934525.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: