centos 6 配置 bond 步骤是比较多的,要加载驱动,创建配置文件,然后修改配置文件等等。在 centos 7 中,创建 bond 要稍微简单点,具体步骤如下:
配置 bond
1.备份接口配置文件
[root@localhost ~]# cd /etc/sysconfig/network-scripts/ [root@localhost network-scripts]# cp ifcfg-ens33{,.bak} [root@localhost network-scripts]# cp ifcfg-ens37{,.bak} [root@localhost network-scripts]# cp ifcfg-ens38{,.bak}
2.创建 bond0 并且将3个接口加入 bond0
[root@localhost network-scripts]# nmcli con add type bond ifname bond0 mode 1 Connection 'bond-bond0' (d177479b -1 f92-4416 -bd10-f050e83684fd) successfully added. [root@localhost network-scripts]# nmcli con add type bond-slave ifname ens33 master bond0 Connection 'bond-slave-ens33' (1 ae30ef6-b2da-49cf-b023-ebf17e2290dd) successfully added. [root@localhost network-scripts]# nmcli con add type bond-slave ifname ens37 master bond0 Connection 'bond-slave-ens37' (3746 cde9-18 e9-4867 -88 cc-f71a12961f 56) successfully added. [root@localhost network-scripts]# nmcli con add type bond-slave ifname ens38 master bond0 Connection 'bond-slave-ens38' (7 de50d30-ab78-4165 -9 d21-e82c07f feae9) successfully added.
这里会创建几个接口配置文件,如下以ifcfg-bond- 开头的文件都是 bond 的配置文件
[root@localhost network-scripts]# ls ifcfg-bond0 ifcfg-ens37.bak ifdown-ippp ifdown-TeamPort ifup-ipv6 ifup-Team ifcfg-bond-bond0 ifcfg-ens38 ifdown-ipv6 ifdown-tunnel ifup-isdn ifup-TeamPort ifcfg-bond-slave-ens33 ifcfg-ens38.bak ifdown-isdn ifup ifup-plip ifup-tunnel ifcfg-bond-slave-ens37 ifcfg-lo ifdown-post ifup-aliases ifup-plusb ifup-wireless ifcfg-bond-slave-ens38 ifdown ifdown-ppp ifup-bnep ifup-post init.ipv6-global ifcfg-ens33 ifdown-bnep ifdown-routes ifup-eth ifup-ppp network-functions ifcfg-ens33.bak ifdown-eth ifdown-sit ifup-ib ifup-routes network-functions-ipv6 ifcfg-ens37 ifdown-ib ifdown-Team ifup-ippp ifup-sit
##bond0 配置
[root@localhost network-scripts] DEVICE =bond0BONDING_OPTS =mode=active-backupTYPE =BondBONDING_MASTER =yes BOOTPROTO =staticDEFROUTE =yes PEERDNS =yes PEERROUTES =yes IPV4_FAILURE_FATAL =no NAME =bond-bond0UUID =d177479b-1 f92-4416 -bd10-f050e83684fdONBOOT =yes IPADDR =172.16 .224.120 PREFIX =24 GATEWAY =172.16 .224.2 DNS1 =114.114 .114.114 DNS2 =223.5 .5.5 .5
重启网络
[root@localhost ~]#service network restart
查看 bond0配置 [root@localhost ~]# cat /proc /net/bonding/bond0Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)Bonding Mode: fault-tolerance (active-backup)Primary Slave: None Currently Active Slave: ens33 MII Status: upMII Polling Interval (ms): 0Up Delay (ms): 0Down Delay (ms): 0Slave Interface: ens33 MII Status: upSpeed: 1000 Mbps Duplex: full Link Failure Count: 0Permanent HW addr: 00:0c:29:46:29:8fSlave queue ID: 0Slave Interface: ens37 MII Status: upSpeed: 1000 Mbps Duplex: full Link Failure Count: 0Permanent HW addr: 00:0c:29:46:29:99Slave queue ID: 0Slave Interface: ens38 MII Status: upSpeed: 1000 Mbps Duplex: full Link Failure Count: 0Permanent HW addr: 00:0c:29:46:29:a3Slave queue ID: 0
查看接口 [root@localhost network-scripts] bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500 inet 172.16.224.120 netmask 255.255.255.0 broadcast 172.16.224.255 inet6 fe80::20c:29ff:fe46:298f prefixlen 64 scopeid 0x20<link> ether 00:0c:29:46:29:8f txqueuelen 1000 (Ethernet) RX packets 332 bytes 37388 (36.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 157 bytes 24214 (23.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ens33: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500 ether 00:0c:29:46:29:8f txqueuelen 1000 (Ethernet) RX packets 111023 bytes 150351141 (143.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 37196 bytes 2955308 (2.8 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ens37: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500 ether 00:0c:29:46:29:8f txqueuelen 1000 (Ethernet) RX packets 77 bytes 11730 (11.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 13 bytes 1796 (1.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ens38: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500 ether 00:0c:29:46:29:8f txqueuelen 1000 (Ethernet) RX packets 78 bytes 11816 (11.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1 bytes 60 (60.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1 (Local Loopback) RX packets 118 bytes 10330 (10.0 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 118 bytes 10330 (10.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
文章作者: 阿文
版权声明: 本博客所有文章除特别声明外,均采用
CC BY-NC-SA 4.0 许可协议。转载请注明来自
阿文的博客 !