Linux 双网卡作绑定

1.绑定模式

bond七种工作模式及特性详解

  bond技术提供了(0-6)共7种工作模式,分别如下:

  • mode=0 round-robin轮询策略(balance-rr)

  • mode=1 active-backup主备策略(active-backup)

  • mode=2 load balancing (xor)异或策略(balance-xor)

  • mode=3 fault-tolerance (broadcast)广播策略(broadcast)

  • mode=4 lacp IEEE 802.3ad 动态链路聚合(IEEE 802.3ad Dynamic link aggregation) (802.3ad)

  • mode=5 transmit load balancing适配器传输负载均衡(balance-tlb)

  • mode=6 adaptive load balancing适配器负载均衡(balance-alb)

2.基于redhat 6.6系统配置bond绑定(以主备为例)

新建ifcfg-bond1

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond1 
DEVICE=bond1
BOOTPROTO=none
BONDING_OPTS="miimon=100 mode=1"
ONBOOT=yes
IPADDR=172.168.111.2
PREFIX=27
GATEWAY=172.168.111.1
BROADCAST=172.168.111.31
NETWORK=172.168.111.0
DNS1=114.114.114.114
USERCTL=no

网卡em1配置

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-em1
DEVICE=em1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond1
SLAVE=yes

网卡em2配置

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-em2
DEVICE=em2
ONBOOT=yes
BOOTPROTO=none
MASTER=bond1
SLAVE=yes

重启服务

service network restart

 

3.网络的模式

broadcast 广播容错 roundrobin 轮询 activebackup 主备 loadbalance 负载均衡

4.基于centos7.9系统配置team绑定

新建ifcfg-team0

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond1
DEVICE=team0
DEVICETYPE=Team
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.168.111.2
PREFIX=27
GATEWAY=172.168.111.1
DNS1=114.114.114.114
DNS2=8.8.8.8
TEAM_CONFIG='{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}'

网卡em1配置

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-em1
DEVICE=em1
DEVICETYPE=TeamPort
ONBOOT=yes
TEAM_MASTER=team0
TEAM_PORT_CONFIG='{"PRIO":100}'

网卡em2配置

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-em2
DEVICE=em2
DEVICETYPE=TeamPort
ONBOOT=yes
TEAM_MASTER=team0
TEAM_PORT_CONFIG='{"PRIO":90}'

重启服务

service network restart

 

posted @ 2021-07-16 17:31  彦祚  阅读(359)  评论(0编辑  收藏  举报