bond链路聚合
bond0虚拟接口的配置:
1)systemctl start NetworkManager NetworkManager必须是开启的才能使用命令nmcli
2)nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.101/24 添加网络接口服务bond0 虚拟接口为bonf0 接口服务类型为bond 模式为主备模式 ip地址为172.25.254.101 网关为24
nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0添加真实网卡eth0 真实网卡名为eth0 类型为 为bond虚拟网卡工作 网卡主人为 bond0
nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0 添加真实网卡eth1 真实网卡名为eth1 类型为 为bond虚拟网卡工作 网卡主人为 bond0
nmcli connection show 查看添加的网络接口服务
cat /proc/net/bonding/bond0 可以查看bond0虚拟接口的详细信息
测试:1)watch -n 1 cat /proc/net/bonding/bond0 监控虚拟接口信息文件,观测接口变化
ping 172.25.254.250 观测通信是一直稳定
2)ifconfig eth0 down 将eth0网卡暂停服务,可以看到网卡eth1顶替工作 一主一备模式工作
ifconfig eth0 up 两块网卡都可以是up状态,只是使用时只能使用一块网卡
team链路聚合
team0网络接口的配置:
1)systemctl start NetworkManager
2)nmcli connection add con-name team0 ifname team0 type team config ‘{“runer”:{“name”:”activebackup”}}’ip4 172.25.254.101/24
nmcli connection add con-name eth0 ifname eth0 type team-slave master team0 添加网卡eth0 真实网卡为eth0
nmcli connection add con-name eth1 ifname eth1 type team-slave master team0
测试:
桥接
桥接思想:
添加网桥br0,br0 与eth0同时存在,需要把ip加在br0上,eth0不用加ip ,将二者桥接实现网络连通,如果真实网卡也有ip也是不可以的
brctl show ##查看网桥状态
brctl addbr br0 ##添加网桥
brctl addif br0 eth0 ##桥接网卡
brctl delif br0 eth0 ##删除桥接
命令方式开启桥接
brctl addif br0 eth0 桥接真实物理网卡 具有临时性
永久性配置eth0网卡配置文件
恢复无桥接状态
局域网连接排错
1.查看网线:是否插好
2.查看网卡状态:是否为up
3.查看ip是否处于同一网段
4.查看桥接 :桥接是否对应