2.5. 2017-12-16-练习-ip-nmcli

练习1- 多网卡整合

1、使将2个网卡整合, 能达到一个网卡坏掉也能继续工作

方案1 : 使用手工配置的bond

[root@centos74 network-scripts]$ cat ifcfg-bond0
DEVICE=bond0

BOOTPROTO=static
IPADDR=192.168.27.77
PREFIX=24
GATEWAY=192.168.27.1

BONDING_OPTS="mode=active-backup miimon=100"
[root@centos74 network-scripts]$ cat ifcfg-eth1
DEVICE=eth1
MASTER=bond0
SLAVE=yes

[root@centos74 network-scripts]$ cat ifcfg-eth2
DEVICE=eth2
MASTER=bond0
SLAVE=yes

方案2 : 使用nmcli配置bonding

[root@centos74 network-scripts]  nmcli con add type bond con-name bond0 ifname bond0 mode active-backup miimon 200
[root@centos74 network-scripts]  nmcli con modify  bond0 ipv4.method static ipv4.address 192.168.27.77/24 ipv4.gateway 192.168.27.1
[root@centos74 network-scripts]  nmcli con add type bond-slave  con-name bond0-eth1 ifname eth1 master bond0
[root@centos74 network-scripts]  nmcli con add type bond-slave  con-name bond0-eth2 ifname eth2 master bond0
[root@centos74 network-scripts]  nmcli con show
[root@centos74 network-scripts]  nmcli con up bond0
[root@centos74 network-scripts]  nmcli con up bond0-eth1
[root@centos74 network-scripts]  nmcli con up bond0-eth2

方案3 : 使用nmcli 配置team

[root@centos74 network-scripts]$ nmcli con add type team con-name team0 ifname team0 config '{"runner":{"method":"activebackup"}}'
[root@centos74 network-scripts]$ nmcli con modify team0 ipv4.method static ipv4.addresses 192.168.27.77/24 ipv4.gateway 192.168.27.1
[root@centos74 network-scripts]$ nmcli con add type team-slave  ifname eth1 master team0
[root@centos74 network-scripts]$ nmcli con add type team-slave  ifname eth2 master team0
[root@centos74 network-scripts]$ nmcli con up team0
[root@centos74 network-scripts]$ nmcli con up team-slave-eth1
[root@centos74 network-scripts]$ nmcli con up team-slave-eth2