学习配置网络桥接
学习配置 bond 网络接口
学习配置 team 网络接口
(一)网络桥接
网络桥接用网络桥实现共享上网主机和客户机除了利用软件外,还可以用系统自带的网络桥建立连接用双网卡的机器做主机
一.网络桥接配置文件编写的学习
0.准备
*) [root@client ~]# cd /etc/sysconfig/network-scripts/
*)[root@client network-scripts]# mv ifcfg-br0 ifcfg-enp0s25 /mnt
1.[root@client network-scripts]# vim ifcfg-enp0s25
2.[root@client network-scripts]# vim ifcfg-br0
3.测试
*)[root@client network-scripts]# systemctl restart network
*) [root@client network-scripts]# brctl show
二.在虚拟机添加网桥
0.实验前删除所有原有网络配置 保持实验环境纯净
1.查看网桥
*)[root@www network-scripts]# brctl show
2.添加网桥br0
*)[root@www network-scripts]# brctl addbr br0
*)[root@www network-scripts]# brctl show
3.给br0添加ip
*)[root@www network-scripts]# ifconfig br0 172.25.254.214 netmask 255.255.255.0
*)[root@www network-scripts]# ifconfig
4.把br0链接到真实网卡上 此时可ping通网络
*)[root@www network-scripts]# brctl addif br0 ens3
*)[root@www network-scripts]# brctl show
5.删除br0
*)[root@www network-scripts]# ifconfig br0 down ##停止br0工作
*)[root@www network-scripts]# brctl delif br0 eth0 ##断开br0 和网卡的链接
*)[root@www network-scripts]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000000000000 no
*)[root@www network-scripts]# brctl delbr br0 ##删除br0
*)[root@www network-scripts]# brctl show
bridge name bridge id STP enabled interfaces
(二)bond 网络
Red Hat Enterprise Linux 允许管理员使用 bonding 内核模块和称为通道绑定接口的特殊网络接口将多个网络接口绑定到一个通道。根据选择的绑定模式 , 通道绑定使两个或更多个网络接口作为一个网络接口 , 从而增加带宽和 / 提供冗余性
0.准备
1.在虚拟化图形管理中给将要实验的虚拟机添加一块虚拟网卡
2.nm-connection-editor删除原有配置
3.[root@www Desktop]# systemctl status NetworkManager ##查看状态 应该开启
一.添加一个bond接口
1.[root@www Desktop]# nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.99.12/24 ##添加一个bond接口
2.[root@www Desktop]# cat /proc/net/bonding/bond0 ##查看接口内容
二.监控实验变化
*)[root@www Desktop]# watch -n 1 cat /proc/net/bonding/bond0
三.在bond接口中添加网卡
1.[root@www Desktop]# nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0
2.[root@www Desktop]# nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0
四.测试
1.[root@www Desktop]# ifconfig eth0 down
2.*)[root@www Desktop]# ifconfig eth0 up
*)[root@www Desktop]# ifconfig eth1 down
(三)Team 接口
Team 和 bond0 功能类似
Team 不需要手动加载相应内核模块
Team 有更强的拓展性
支持 8 快网卡
0.准备
*)删除所有网络配置 保证实验环境的纯净
nm-connection-editor
一.新建team接口
1.[root@www Desktop]# nmcli connection add con-name team0 type team ifname team0 config '{"runner":{"name":"activebackup"}}' ip4 172.25.99.12/24
2.[root@www Desktop]# teamdctl team0 state
二 .监控
*)[root@www Desktop]# watch -n 1 teamdctl team0 state
三.在接口中添加网卡
1.[root@www Desktop]# nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
2.[root@www Desktop]# nmcli connection add con-name eth1 ifname eth1 type team-slave master team0
四.测试
1.[root@www Desktop]# ifconfig eth0 down
2.*)[root@www Desktop]# ifconfig eth0 up
*)[root@www Desktop]# ifconfig eth1 down