在Linux中,网卡绑定有七种模式:
bond0 … bond6
其中最常见的有三种:0 / 1 / 6。
它们的详细描述如下:
=0: (balance-rr) Round-robin policy: (平衡抡循环策略):传输数据包顺序是依次传输,直到最后一个传输完毕, 此模式提供负载平衡和容错能力。
=1: (active-backup) Active-backup policy:(主-备份策略):只有一个设备处于活动状态。 一个宕掉另一个马上由备份转换为主设备。mac地址是外部可见得。 此模式提供了容错能力。
=2:(balance-xor) XOR policy:(平衡 策略): 传输根据原地址布尔值选择传输设备。 此模式提供负载平衡和容错能力。
=3:(broadcast) broadcast policy: (广播策略):将所有数据包传输给所有接口。 此模式提供了容错能力。
=4:(802.3ad) IEEE 802.3ad Dynamic link aggregation. IEEE 802.3ad 动态链接聚合:创建共享相同的速度和双工设置的聚合组。(我不是太懂。)
=5:(balance-tlb) Adaptive transmit load balancing(适配器传输负载均衡):没有特殊策略,第一个设备传不通就用另一个设备接管第一个设备正在处理的mac地址,帮助上一个传。
=6:(balance-alb) Adaptive load balancing: (适配器传输负载均衡):大致意思是包括mode5,bonding驱动程序截获 ARP 在本地系统发送出的请求,用其中之一的硬件地址覆盖从属设备的原地址。就像是在服务器上不同的人使用不同的硬件地址一样。
这些选项可以用命令:# modinfo bonding 来查看。
下面,会在实验环境里,将Linux上的两块网卡绑定为一块虚拟网卡,借此说明网卡绑定的技术细节。
————————————————————————
查看当前的系统的网络设备:
[root@mysql-1 ~]# lspci | grep --color "Ethernet" 02:00.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01) 02:03.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01) [root@mysql-1 ~]#
可以看到,当前系统确实有两块网卡。
看看它们当前的状态与配置文件的状态:
[root@mysql-1 ~]# ifconfig -a eth0 Link encap:Ethernet HWaddr 00:0C:29:97:5C:02 inet addr:192.168.111.128 Bcast:192.168.111.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe97:5c02/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:539944 errors:0 dropped:0 overruns:0 frame:0 TX packets:523748 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:63013966 (60.0 MiB) TX bytes:31575317 (30.1 MiB) eth1 Link encap:Ethernet HWaddr 00:0C:29:97:5C:0C inet addr:192.168.111.162 Bcast:192.168.111.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe97:5c0c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:15 errors:0 dropped:0 overruns:0 frame:0 TX packets:10 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1466 (1.4 KiB) TX bytes:1272 (1.2 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:16 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:960 (960.0 b) TX bytes:960 (960.0 b) [root@mysql-1 ~]# [root@mysql-1 ~]# netstat -in Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg eth0 1500 0 539972 0 0 0 523764 0 0 0 BMRU eth1 1500 0 15 0 0 0 10 0 0 0 BMRU lo 65536 0 16 0 0 0 16 0 0 0 LRU [root@mysql-1 ~]# [root@mysql-1 ~]# ls -ltr --time-style="+|%Y-%m-%d|%H:%M:%S|" /etc/sysconfig/network-scripts/ | grep --color "ifcfg-" -rw-r--r--. 1 root root 254 |2016-04-12|17:14:01| ifcfg-lo -rw-r--r--. 1 root root 247 |2016-08-23|00:48:41| ifcfg-eth0 -rw-r--r-- 1 root root 274 |2016-08-31|08:50:02| ifcfg-System_eth1 [root@mysql-1 ~]# [root@mysql-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 HWADDR=00:0C:29:97:5C:02 TYPE=Ethernet UUID=f55f2606-96a3-4a5f-9c4b-e7a08f7ab490 ONBOOT=yes NM_CONTROLLED=yes #BOOTPROTO=dhcp BOOTPROTO=static DNS1=114.114.114.114 GATEWAY=192.168.111.2 NETMASK=255.255.255.0 IPADDR=192.168.111.128 [root@mysql-1 ~]# [root@mysql-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-System_eth1 HWADDR=00:0C:29:97:5C:0C TYPE=Ethernet BOOTPROTO=none IPADDR=192.168.111.162 PREFIX=24 GATEWAY=192.168.111.2 DNS1=114.114.114.114 DEFROUTE=yes IPV4_FAILURE_FATAL=yes IPV6INIT=no NAME="System eth1" UUID=a3a4e085-e6ae-4646-b97c-66c2e4500f46 ONBOOT=yes LAST_CONNECT=1472604518 [root@mysql-1 ~]#
在继续配置前,先关闭服务【NetworkManager】:
[root@mysql-1 ~]# service NetworkManager status NetworkManager (pid 1540) is running... [root@mysql-1 ~]# [root@mysql-1 ~]# service NetworkManager stop Stopping NetworkManager daemon: [ OK ] [root@mysql-1 ~]#
该服务启用的时候,对网卡的配置文件做了任何修改,都会被立即应用网卡。
为了将两块网卡绑定成一块虚拟网卡,上面的两块网卡的配置文件,需要修改。
修改后如下:
[root@mysql-1 ~]# cp /etc/sysconfig/network-scripts/ifcfg-* /backup/ [root@mysql-1 ~]# [root@mysql-1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 [root@mysql-1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-System_eth1 [root@mysql-1 ~]# [root@mysql-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 | grep -v '#' | strings DEVICE=eth0 BOOTPROTO=none ONBOOT=yes USERCTL=no MASTER=bond0 SLAVE=yes [root@mysql-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-System_eth1 | grep -v '#' | strings DEVICE=eth1 BOOTPROTO=none ONBOOT=yes USERCTL=no MASTER=bond0 SLAVE=yes [root@mysql-1 ~]#
创建绑定后的虚拟网卡的配置文件:
[root@mysql-1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-bond0 [root@mysql-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 BOOTPROTO=none BROADCAST=192.168.111.255 IPADDR=192.168.111.128 NETMASK=255.255.255.0 NETWORK=192.168.111.0 ONBOOT=yes TYPE=Ethernet GATEWAY=192.168.111.2 USERCTL=no [root@mysql-1 ~]#
配置内核模块:
[root@mysql-1 ~]# vi /etc/modprobe.d/nic-bond.conf [root@mysql-1 ~]# cat /etc/modprobe.d/nic-bond.conf alias bond0 bonding options bond0 miimon=100 mode=1 primary=eth0 [root@mysql-1 ~]#
写入开机脚本:
[root@mysql-1 ~]# cat /etc/rc.local #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local # Nic Bonding modprobe bonding miimon=100 mode=1 [root@mysql-1 ~]#
执行:
[root@mysql-1 ~]# sh /etc/rc.local [root@mysql-1 ~]#
配置好内核模块后,查看bonding信息:
[root@mysql-1 ~]# modinfo bonding filename: /lib/modules/2.6.32-642.el6.x86_64/kernel/drivers/net/bonding/bonding.ko author: Thomas Davis, tadavis@lbl.gov and many others description: Ethernet Channel Bonding Driver, v3.7.1 version: 3.7.1 license: GPL alias: rtnl-link-bond srcversion: F6C1815876DCB3094C27C71 depends: vermagic: 2.6.32-642.el6.x86_64 SMP mod_unload modversions parm: max_bonds:Max number of bonded devices (int) parm: tx_queues:Max number of transmit queues (default = 16) (int) parm: num_grat_arp:Number of peer notifications to send on failover event (alias of num_unsol_na) (int) parm: num_unsol_na:Number of peer notifications to send on failover event (alias of num_grat_arp) (int) parm: miimon:Link check interval in milliseconds (int) parm: updelay:Delay before considering link up, in milliseconds (int) parm: downdelay:Delay before considering link down, in milliseconds (int) parm: use_carrier:Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default) (int) parm: mode:Mode of operation; 0 for balance-rr, 1 for active-backup, 2 for balance-xor, 3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp) parm: primary:Primary network device to use (charp) parm: primary_reselect:Reselect primary slave once it comes up; 0 for always (default), 1 for only if speed of primary is better, 2 for only on active slave failure (charp) parm: lacp_rate:LACPDU tx rate to request from 802.3ad partner; 0 for slow, 1 for fast (charp) parm: ad_select:803.ad aggregation selection logic; 0 for stable (default), 1 for bandwidth, 2 for count (charp) parm: min_links:Minimum number of available links before turning on carrier (int) parm: xmit_hash_policy:balance-xor and 802.3ad hashing method; 0 for layer 2 (default), 1 for layer 3+4, 2 for layer 2+3 (charp) parm: arp_interval:arp interval in milliseconds (int) parm: arp_ip_target:arp targets in n.n.n.n form (array of charp) parm: arp_validate:validate src/dst of ARP probes; 0 for none (default), 1 for active, 2 for backup, 3 for all (charp) parm: arp_all_targets:fail on any/all arp targets timeout; 0 for any (default), 1 for all (charp) parm: fail_over_mac:For active-backup, do not set all slaves to the same MAC; 0 for none (default), 1 for active, 2 for follow (charp) parm: all_slaves_active:Keep all frames received on an interface by setting active flag for all slaves; 0 for never (default), 1 for always. (int) parm: resend_igmp:Number of IGMP membership reports to send on link failure (int) parm: packets_per_slave:Packets to send per slave in balance-rr mode; 0 for a random slave, 1 packet per slave (default), >1 packets per slave. (int) parm: lp_interval:The number of seconds between instances where the bonding driver sends learning packets to each slaves peer switch. The default is 1. (uint) [root@mysql-1 ~]#
然后,重启网络服务,上面的网卡绑定就生效了:
[root@mysql-1 ~]# ifconfig bond0 Link encap:Ethernet HWaddr 00:0C:29:97:5C:02 inet addr:192.168.111.128 Bcast:192.168.111.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe97:5c02/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:299 errors:0 dropped:0 overruns:0 frame:0 TX packets:190 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:26278 (25.6 KiB) TX bytes:26305 (25.6 KiB) eth0 Link encap:Ethernet HWaddr 00:0C:29:97:5C:02 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:543625 errors:0 dropped:0 overruns:0 frame:0 TX packets:525905 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:63329405 (60.3 MiB) TX bytes:31856924 (30.3 MiB) eth1 Link encap:Ethernet HWaddr 00:0C:29:97:5C:02 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:47 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3409 (3.3 KiB) TX bytes:1740 (1.6 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:16 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:960 (960.0 b) TX bytes:960 (960.0 b) [root@mysql-1 ~]# [root@mysql-1 ~]# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: fault-tolerance (active-backup) Primary Slave: None Currently Active Slave: eth1 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eth0 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 2 Permanent HW addr: 00:0c:29:97:5c:02 Slave queue ID: 0 Slave Interface: eth1 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 3 Permanent HW addr: 00:0c:29:97:5c:0c Slave queue ID: 0 [root@mysql-1 ~]#
这时候,网卡1 / 2,随便断掉其中的任何一个网络连接都应该是存活的,除非两块网卡都失效。
测一下:
两个网卡都存活的时候:
只有其中一个网卡存活的时候:
两个网卡都不存活的时候:
———————————
其他:
写成脚本:
#!/bin/sh
modprobe -r bonding
modprobe bonding miimon=100 mode=6
ifconfig bond0 虚拟网卡IP netmask 255.255.248.0 up
route add default gw 虚拟网卡网关 bond0
#ifenslave bond0 eth0 eth1 eth2 eth3 eth4 eth5
ifenslave bond0 eth0 eth1
service network restart
———————————
如何取消bond?
1. 将上面配置过的地方还原后,重启系统。
2. 不重启系统取消bond设置:
还原配置文件:
[root@mysql-1 ~]# cd /etc/sysconfig/network-scripts/ [root@mysql-1 network-scripts]# ls ifcfg-eth0 ifdown ifdown-ib ifdown-isdn ifdown-routes ifup ifup-eth ifup-ipv6 ifup-plusb ifup-routes ifup-wireless network-functions ifcfg-lo ifdown-bnep ifdown-ippp ifdown-post ifdown-sit ifup-aliases ifup-ib ifup-isdn ifup-post ifup-sit init.ipv6-global network-functions-ipv6 ifcfg-System_eth1 ifdown-eth ifdown-ipv6 ifdown-ppp ifdown-tunnel ifup-bnep ifup-ippp ifup-plip ifup-ppp ifup-tunnel net.hotplug [root@mysql-1 network-scripts]#
重启网络服务:
[root@mysql-1 network-scripts]# ifconfig bond0 Link encap:Ethernet HWaddr 00:0C:29:97:5C:02 inet addr:192.168.111.128 Bcast:192.168.111.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe97:5c02/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:759 errors:0 dropped:0 overruns:0 frame:0 TX packets:413 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:63236 (61.7 KiB) TX bytes:50368 (49.1 KiB) eth0 Link encap:Ethernet HWaddr 00:0C:29:97:5C:02 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:1431 errors:0 dropped:0 overruns:0 frame:0 TX packets:842 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:119865 (117.0 KiB) TX bytes:108753 (106.2 KiB) eth1 Link encap:Ethernet HWaddr 00:0C:29:97:5C:02 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:882 errors:0 dropped:0 overruns:0 frame:0 TX packets:682 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:91038 (88.9 KiB) TX bytes:113603 (110.9 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:16 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:960 (960.0 b) TX bytes:960 (960.0 b) [root@mysql-1 network-scripts]# [root@mysql-1 network-scripts]# service network restart Shutting down interface System_eth1: Device has MAC address 00:00:00:00:00:00 00:0C:29:97:5C:02 00:0C:29:97:5C:02 00:0C:29:97:5C:02, instead of configured address 00:0C:29:97:5C:0C. Ignoring. [FAILED] Shutting down interface eth0: [ OK ] Shutting down loopback interface: usage: ifdown [FAILED] Bringing up loopback interface: ./ifup: configuration for ifcfg-lo not found. Usage: ifup [FAILED] Bringing up interface System_eth1: Device has different MAC address than expected, ignoring. [FAILED] Bringing up interface eth0: Determining if ip address 192.168.111.128 is already in use for device eth0... [ OK ] RTNETLINK answers: File exists RTNETLINK answers: File exists RTNETLINK answers: File exists RTNETLINK answers: File exists RTNETLINK answers: File exists RTNETLINK answers: File exists RTNETLINK answers: File exists RTNETLINK answers: File exists RTNETLINK answers: File exists [root@mysql-1 network-scripts]# [root@mysql-1 network-scripts]# ifconfig bond0 Link encap:Ethernet HWaddr 00:0C:29:97:5C:02 inet addr:192.168.111.128 Bcast:192.168.111.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe97:5c02/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:850 errors:0 dropped:0 overruns:0 frame:0 TX packets:488 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:70342 (68.6 KiB) TX bytes:60974 (59.5 KiB) eth0 Link encap:Ethernet HWaddr 00:0C:29:97:5C:02 inet addr:192.168.111.128 Bcast:192.168.111.255 Mask:255.255.255.0 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:1515 errors:0 dropped:0 overruns:0 frame:0 TX packets:906 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:126551 (123.5 KiB) TX bytes:117969 (115.2 KiB) eth1 Link encap:Ethernet HWaddr 00:0C:29:97:5C:02 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:889 errors:0 dropped:0 overruns:0 frame:0 TX packets:693 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:91458 (89.3 KiB) TX bytes:114993 (112.2 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:16 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:960 (960.0 b) TX bytes:960 (960.0 b) [root@mysql-1 network-scripts]#
注意:
这里的报错与本文的话题没有关系,而是因为【/etc/sysconfig/network-scripts/】中缺少【ifconfig-lo】。
可以看到,【bond0】居然还在。
这时候需要这样删除:
[root@mysql-1 network-scripts]# ls -altr /sys/class/net/ total 0 lrwxrwxrwx 1 root root 0 Aug 31 10:00 lo -> ../../devices/virtual/net/lo drwxr-xr-x 43 root root 0 Aug 31 10:00 .. lrwxrwxrwx 1 root root 0 Aug 31 10:00 eth0 -> ../../devices/pci0000:00/0000:00:11.0/0000:02:00.0/net/eth0 lrwxrwxrwx 1 root root 0 Aug 31 10:00 eth1 -> ../../devices/pci0000:00/0000:00:11.0/0000:02:03.0/net/eth1 drwxr-xr-x 2 root root 0 Aug 31 10:18 . lrwxrwxrwx 1 root root 0 Aug 31 10:18 bond0 -> ../../devices/virtual/net/bond0 -rw-r--r-- 1 root root 4096 Aug 31 10:18 bonding_masters [root@mysql-1 network-scripts]# [root@mysql-1 network-scripts]# cat /sys/class/net/bonding_masters bond0 [root@mysql-1 network-scripts]# [root@mysql-1 network-scripts]# echo -bond0 > /sys/class/net/bonding_masters [root@mysql-1 network-scripts]# [root@mysql-1 ~]# cat /sys/class/net/bonding_masters [root@mysql-1 ~]# [root@mysql-1 ~]# ls -ltr /sys/class/net/ total 0 lrwxrwxrwx 1 root root 0 Aug 31 10:00 lo -> ../../devices/virtual/net/lo lrwxrwxrwx 1 root root 0 Aug 31 10:00 eth0 -> ../../devices/pci0000:00/0000:00:11.0/0000:02:00.0/net/eth0 lrwxrwxrwx 1 root root 0 Aug 31 10:00 eth1 -> ../../devices/pci0000:00/0000:00:11.0/0000:02:03.0/net/eth1 -rw-r--r-- 1 root root 4096 Aug 31 10:30 bonding_masters [root@mysql-1 ~]#
然后,重启服务,【bond0】就被清理干净了:
[root@mysql-1 network-scripts]# service network restart Shutting down interface System_eth1: [ OK ] Shutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface System_eth1: Determining if ip address 192.168.111.162 is already in use for device eth1... [ OK ] Bringing up interface eth0: Determining if ip address 192.168.111.128 is already in use for device eth0... [ OK ] [root@mysql-1 network-scripts]# [root@mysql-1 network-scripts]# ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:97:5C:02 inet addr:192.168.111.128 Bcast:192.168.111.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe97:5c02/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1660 errors:0 dropped:0 overruns:0 frame:0 TX packets:1019 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:138419 (135.1 KiB) TX bytes:131613 (128.5 KiB) eth1 Link encap:Ethernet HWaddr 00:0C:29:97:5C:0C inet addr:192.168.111.162 Bcast:192.168.111.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe97:5c0c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1284 errors:0 dropped:0 overruns:0 frame:0 TX packets:970 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:127574 (124.5 KiB) TX bytes:147475 (144.0 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:16 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:960 (960.0 b) TX bytes:960 (960.0 b) [root@mysql-1 network-scripts]#
———————————
Done。