温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

高级网络配置——bond/team/桥接网络

发布时间:2020-08-14 13:42:19 来源:网络 阅读:660 作者:willis_sun 栏目:网络安全
一。学习配置 bond 网络接口

Red Hat Enterprise Linux 允许管理员使用bonding 内核模块和称为通道绑定接口的特殊网络接口将多个网络接口绑定到一个通道。根据选择的绑定模式 , 通道绑定使两个或更多个网络接口作为一个网络接口 , 从而增加带宽和 / 提供冗余性
1.利用 nmcli 命令管理 bond
     nm-connection-editor
           删除所有网络接口
     nmcli connection add type bond con-name bond0 ifname bond0 mode active-backup ip4 172.25.254.199/24
     ifconfig
     watch -n 1 cat /proc/net/bonding/bond0
   
     nmcli connection add type bond-slave con-name eth0 ifname eth0 master bond0
     nmcli connection add type bond-slave con-name eth2 ifname eth2 master bond0
     ifconfig eth0 down
2.选择 Linux 以太网绑定模式
    模式 0 ( 平衡轮循 balance-rr) - 轮循策略 , 所有接口都使用采用轮循方式在所有 Slave 中传输封包 ; 任何Slave 都可以接收
    模式 1 ( 主动备份 active-backup ) - 容错。一次只能使用一个Slave 接口 , 但是如果该接口出现故障 , 另一个Slave 将 接替它
    模式 3 ( 广播 broadcast) - 容错。所有封包都通过所有Slave 接口广播
3.主动备份配置示例
   3-1 建立绑定接口 bond0 配置文件 :
/etc/sysconfig/network-scripts/ifcfg-bond0

– BOOTPROTO="none"
– IPADDR="10.1.1.250"
– PREFIX=”24”
– ONBOOT="yes"
– BONDING_OPTS=”mode=1 miimon=50”
   3-2 建立 Slave 接口 eth0 配置文件 :
/etc/sysconfig/network-scripts/ifcfg-eth0
– DEVICE="eth0"         ####硬件网卡名
– BOOTPROTO="none"
– ONBOOT="yes"
– MASTER="bond0"
– SLAVE="yes“
   3-3 建立 Slave 接口 eth2 配置文件 :
/etc/sysconfig/network-scripts/ifcfg-eth2
– DEVICE="eth2"
– BOOTPROTO="none"
– ONBOOT="yes"
– MASTER="bond0"
– SLAVE="yes“
   3-4 配置系统加载 binding 模块 :
/etc/modprobe.d/bonding.conf
– alias bond0 bonding
ifenslave bond0 eth0 eth2

systemctl stop NetworkManager
systemctl restart network

查看 bonding 状态
– cat /proc/net/bonding/bond0

二。学习配置 team 网络接口
1.Team 接口
Team 和 bond0 功能类似
Team 不需要手动加载相应内核模块
Team 有更强的拓展性
– 支持 8 快网卡

2.Team 的种类

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

3.通过 nmcli 设定 team
nmcli connection add type team con-name team0 ifname team0 config '{"runner"{"name":"loadbalance"}}' ip4 172.25.254.198/24
nmcli connection add con-name eth0   ifname eth0 type team-slave master team0
nmcli connection add con-name eth2   ifname eth2 type team-slave master team0

4.监控team0,并测试
teamctl team0 stat      
ifconfig eth0 down
ifconfig eth0 up
ifconfig eth2 down
ifconfig eth2 up

三。学习配置网络桥接
1.网络桥接
网络桥接用网络桥实现共享上网主机和客户机除了利用软件外,还可以用系统自带的网络桥建立连接用双网卡的机器做主机

2.网络桥接的配置
vim /etc/sysconfig/network-scripts/ifcfg-eth0
   DEVICE=eth0       ###设备名,可能不同
   ONBOOT=yes
   BOOTPROTO=none
   BRIDGE=br0      ###重点,必须说明
vim /etc/sysconfig/network-scripts/ifcfg-br0
   DEVICE=eth0      
   ONBOOT=yes
   BOOTPROTO=none
   TYPE=Bridge      ###重点,必须说明
   IPADDR=172.25.254.198

3.网络桥接的管理命令
brctl
### 桥接管理命令
– show ### 显示
– addbr ### 添加网桥
– delbr ### 删除网桥
– addif ### 添加网桥连接
– delif ### 删除网桥连接

  卸载桥接接口过程
  brctl show
  brctl delif br0 eth0
  brctl show
  brctl delbr br0
  ifconfig br0 down
  brctl show

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI