bond6 一个IP双网卡热备
2016-06-21 14:33
309 查看
虚拟机添加网卡
添加网卡配置文件与虚拟网卡bond配置文件
[root@localhost ~]# cd /etc/sysconfig/network-scripts/ [root@localhost network-scripts]# ls ifcfg-eno16777736 ifdown-ib ifdown-ppp ifdown-tunnel ifup-ib ifup-plusb ifup-Team network-functions ifcfg-lo ifdown-ippp ifdown-routes ifup ifup-ippp ifup-post ifup-TeamPort network-functions-ipv6 ifdown ifdown-ipv6 ifdown-sit ifup-aliases ifup-ipv6 ifup-ppp ifup-tunnel ifdown-bnep ifdown-isdn ifdown-Team ifup-bnep ifup-isdn ifup-routes ifup-wireless ifdown-eth ifdown-post ifdown-TeamPort ifup-eth ifup-plip ifup-sit init.ipv6-globa [root@localhost network-scripts]# cp ifcfg-eno16777736 ifcfg-eno33554984 [root@localhost network-scripts]# cp ifcfg-eno16777736 ifcfg-bond0
配置文件详情(mode=6模式只做热备不需要交换机或路由器支持,miimon每100ms检测链路)
[root@localhost network-scripts]# cat ifcfg-bond0 DEVICE=bond0 TYPE=Ethernet NAME=bond0 BONDING_MASTER=yes BOOTPROTO=none ONBOOT=yes IPADDR=192.168.3.135 NETMASK=255.255.254.0 GATEWAY=192.168.2.1 BONDING_OPTS="mode=6 miimon=100" [root@localhost network-scripts]# cat ifcfg-eno16777736 TYPE=Ethernet BOOTPROTO=none DEVICE=eno16777736 ONBOOT=yes HWADDR=00:0c:29:9c:5f:7a MASTER=bond0 SLAVE=yes [root@localhost network-scripts]# cat ifcfg-eno33554984 TYPE=Ethernet BOOTPROTO=none NAME=eno33554984 DEVICE=eno33554984 ONBOOT=yes HWADDR=00:0c:29:9c:5f:84 MASTER=bond0 SLAVE=yes
启动bond模块并配置开机自动加载bond模块
[root@localhost network-scripts]# modprobe bonding [root@localhost network-scripts]# modinfo bonding [root@localhost network-scripts]# cat /etc/modprobe.d/mlx4.conf # This file is intended for users to select the various module options # they need for the mlx4 driver. On upgrade of the rdma package, # any user made changes to this file are preserved. Any changes made # to the libmlx4.conf file in this directory are overwritten on # pacakge upgrade. # # Some sample options and what they would do # Enable debugging output, device managed flow control, and disable SRIOV #options mlx4_core debug_level=1 log_num_mgm_entry_size=-1 probe_vf=0 num_vfs=0 # # Enable debugging output and create SRIOV devices, but don't attach any of # the child devices to the host, only the parent device #options mlx4_core debug_level=1 probe_vf=0 num_vfs=7 # # Enable debugging output, SRIOV, and attach one of the SRIOV child devices # in addition to the parent device to the host #options mlx4_core debug_level=1 probe_vf=1 num_vfs=7 # # Enable per priority flow control for send and receive, setting both priority # 1 and 2 as no drop priorities #options mlx4_en pfctx=3 pfcrx=3 alias bond0 bonding
重启网络服务
[root@localhost network-scripts]# systemctl restart network.service [root@localhost network-scripts]# ifconfig bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500 inet 192.168.3.135 netmask 255.255.254.0 broadcast 192.168.3.255 inet6 fe80::20c:29ff:fe9c:5f7a prefixlen 64 scopeid 0x20<link> ether 00:0c:29:9c:5f:7a txqueuelen 0 (Ethernet) RX packets 89003 bytes 5784026 (5.5 MiB) RX errors 0 dropped 19927 overruns 0 frame 0 TX packets 4372 bytes 369610 (360.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eno16777736: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500 ether 00:0c:29:9c:5f:7a txqueuelen 1000 (Ethernet) RX packets 67758 bytes 4381078 (4.1 MiB) RX errors 0 dropped 1 overruns 0 frame 0 TX packets 2522 bytes 230974 (225.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eno33554984: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500 ether 00:0c:29:9c:5f:84 txqueuelen 1000 (Ethernet) RX packets 68827 bytes 4499203 (4.2 MiB) RX errors 0 dropped 19926 overruns 0 frame 0 TX packets 2528 bytes 244988 (239.2 KiB) 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 0 (Local Loopback) RX packets 711 bytes 182882 (178.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 711 bytes 182882 (178.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
查看当前bond使用的物理网口
[root@localhost network-scripts]# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: adaptive load balancing Primary Slave: None Currently Active Slave: eno16777736 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eno16777736 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:0c:29:9c:5f:7a Slave queue ID: 0 Slave Interface: eno33554984 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:0c:29:9c:5f:84 Slave queue ID: 0
将当前bond网络断开再查看bond网络
[root@localhost network-scripts]# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: adaptive load balancing Primary Slave: None Currently Active Slave: eno33554984 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eno16777736 MII Status: down Speed: Unknown Duplex: Unknown Link Failure Count: 1 Permanent HW addr: 00:0c:29:9c:5f:7a Slave queue ID: 0 Slave Interface: eno33554984 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:0c:29:9c:5f:84 Slave queue ID: 0
相关文章推荐
- css3 :hover添加特效
- swiper的基础使用(十)
- iOS 检测是否安装了第三方应用的方法--兼容iOS9之后的info.plist设置
- App Store审核条款(2016.06.21更新)
- eventbus的使用(二)简洁易懂
- struts2 链接包含汉字乱码的问题
- 仿苹果手机通讯录按字母定位
- Android 计步器开发
- Oracle索引小结
- Android App 不死之路
- C++ 高级数据类型(六)—— 自定义数据类型
- C++ 面向对象(一)—— 类(Classes)
- ubuntu 安装android-sdk
- 《java并发编程的艺术》读书笔记-第四章java并发的基础
- c++ STL学习之queue队列总结
- java根据ftl模板生成word文档(列表)
- Eclipse-----JRebel Eclipse插件实现热部署
- java mail实现Email的发送,完整代码
- 基于zepto.js简单实现上传图片
- C++ 高级数据类型(五)—— 数据结构