unit2-高级网络配置【bond,team,br0,ipv6】
unit2-高级网络配置【bond,team,br0】
###bond---网卡阵列
双卡网卡可以预防当某块网口损坏,不能工作是立刻顶替上去,并且信息不会丢失,不会影响其他进程的进行1.添加为双网卡
示图:2.删除之前的network记录
nm-connection-editor图形界面删除所有连接3.添加bond0
nmcli conncetion add con-name bond0 ifname type bond mode active-backup ip4 172.25.254.244/24 ##建立名字为bond0,ip设置为172.25.254.244示图:
4.在bond0中添加网卡eth0和eth1
nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0 ##网卡eth0加载到bond0中,eth1加载方法相同nmcli connection add con-name eth1 ifname eth1 type bond-slav
e master bond0
示图:
5.测试
在另一个shell中ping 172.25.254.198,不断查看网络连接状态ifconfig down eth0
示图:测试结果,并未影响网络的连接状态,用watch -n 1 cat /proc/net/bonding/bond 观察到此时bond0工作的由eth0变为eth1,达到双网卡阵列的目的
##team
1.team也是链路聚合的一种方式
最多支持8块网卡
支持模式
广播
论旬
主备
负载均衡
2.设置
nmcli connection add con-name team0 ifname team0 type team config '{"runner":{"name":"activebackup"}}' ip4 172.25.254.100/24
nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
nmcli connection add con-name eth1 ifname eth1 type team-slave master team0
示图:
3.测试
watch -n 1 teamdctl team0 stat
ifconfig eth0 down
ifconfig eth0 up
示图:eth0 down
示图:eth0
up
##br0
1.配置
vim /etc/sysconfig/network-scripts/ifcfg-enp1s0 ##此文设备名每个主机不相同,针对各自主机进行修改
DEVICE=enp1s0 ##设备名称
ONBOOT=yes ##开启服务设备自动**
BOOTPROTO=none ##网卡工作状态
BRIDGE=br0 ##网卡开启的网桥接口
vim /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.98
NETMASK=255.255.255.0
TYPE=Bridge ##网络接口类型是桥接
systemctl stop NetworkManager.service
systemctl restart network
systemctl start NetworkManager.service
ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.25.254.98 netmask 255.255.255.0 broadcast 172.25.254.255
inet6 fe80::221:ccff:fe60:32a3 prefixlen 64 scopeid 0x20<link>
ether 00:21:cc:60:32:a3 txqueuelen 0 (Ethernet)
RX packets 25396 bytes 59291358 (56.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15360 bytes 105128915 (100.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2.命令管理方式
#添加
systemctl stop NetworkManager
brctl show
brctl addbr br0
brctl addif br0 eth0
ifconfig eth0 up
ifconfig br0 172.25.254.x netmask 255.255.255.0
brctl show
ping 172.25.254.250
#删除
ifconfig br0 down
brctl delif br0 eth0
brctl delbr br0
brctl show