linux 网桥 权限,Linux系统网络高级配置--网桥网络接口(bondteam)

Linux系统网络高级配置--网桥网络接口(bondteam)

Linux系统网络高级配置--网桥、网络接口(bond、team)

网络高级配置

本次博文主要介绍网络桥接、bond网络接口、Team网络接口的功能演示。

(一)配置网络桥接

网络桥接的管理命令

brctl       桥接管理命令

show      显示

addbr    添加网桥

delbr     删除网桥

addif      添加网桥连接

delif       删除网桥连接

初始化的时候是没有br0的

[[email protected] ~]# ifconfig

5977b2e1a10e983a79fd74ae5d92a3b7.png

桥接br0

aa1b3d1f393b8b82dc026a02e195576e.png

[[email protected] ~]# ifconfig

e381f2c04f5b74d14221b8a96ca610db.png

[[email protected] ~]# ifconfig br0 172.25.254.124 netmask 255.255.255.0

[[email protected] ~]# ifconfig

cd83e18924516113bd315162c21d36a9.png

图形化界面删除eth0

[[email protected] ~]# nm-connection-editor

2018e06e257609db5ddc3ab8bca60b65.png

[[email protected] ~]#brctl addif br0 eth0

[[email protected] ~]#brctl show

91dec11dfd65eae68f92d2a97bc30d3d.png

删除br0

a69ab52237dc1f12241164a1fd92bedc.png

(二)配置bond网络接口

Red Hat Enterprise Linux允许管理员使用 bonding内核模块和称为通道绑定接口的特殊网络接口将多个网络接口绑定到一个通道。根据选择的绑定模式,通道绑定使两个或更多网络接口作为一个网络接口,从而增加逮狂和/提供冗余性。

bond 只支持两块网卡

选择Llinux 以太网绑定模式:

模式一:平衡轮循,所有接口都使用采用轮循方式在所有Slave中传输封包;任何Slave都可以接收。

模式二:主动备份,一次只能使用一个Slave接口,但是如果该接口出现故障,另一个Slave将接替它。

模式三:广播,所有封包都通过所有Slave接口广播。

演示举例:

创建bond0

[[email protected] Desktop]# nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.124/24

只留下bond0

[[email protected] Desktop]# nm-connection-editor

166c73a46cc2d52314b54908ad98aee5.png

添加网卡eth0和eth1

[[email protected] Desktop]# nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0

[[email protected] Desktop]# nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0

监控命令

[[email protected] Desktop]# watch -n 1 cat /proc/net/bonding/bond0

dddb5bbabfc3775824bf04dcd1a22559.png

调试命令:

[[email protected] Desktop]# ifconfig eth0 down

dac1a5db717f1eaf99b9c9ab075fb738.png

[[email protected] Desktop]# ifconfig eth0 up

27510d9340e4a3115fbabc54bf7445ac.png

[[email protected] Desktop]# ifconfig eth1 down

05db14437e648c64e9dd25bf5e4a41c8.png

[[email protected] Desktop]# ifconfig eth1 up

2f5e8ced9ad8c9c374759021613dea0f.png

删除bond0的网卡

8d00e1a97068fffd9803ea94becc4c3e.png

(三)配置Team网络接口

Team的特性:

Team和bond0功能类似

Team不需要手动加载相应内核模块

Team有更强的拓展性

支持8块网卡

Team的种类:

broadcast        广播容错

roundrobin      平衡轮叫

activebackup   主备

loadbalance     负载均衡

创建Team0

[[email protected] Desktop]# nmcli connection add con-name team0 type team ifname team0 config '{"runner":{"name":"activebackup"}}' ip4 172.25.254.124/24

467550f2734836c155bb01c5c85d021c.png

监控命令:

[[email protected] Desktop]# watch -n 1  teamdctl team0 state

增添网卡eth0和eth1:

[[email protected] Desktop]# nmcli connection add con-name eth1 ifname eth1 type team-slave master team0

[[email protected] Desktop]# nmcli connection add con-name eth0 ifname eth0 type team-slave master team0

调试:

[[email protected] Desktop]# ifconfig eth1 down

4369b457d213f5ce3071afc4721829e8.png

[[email protected] Desktop]# ifconfig eth0 up

37f80dae5d21ca69a9c86894e0937f65.png

附录:

桥接基础尝试

(一)去掉br0(模拟安装系统后原始的状态)

[[email protected] ~]# cd /etc/sysconfig/network-scripts/

[[email protected] network-scripts]# mv ifcfg-br0 ifcfg-enp0s25 /mnt/

[[email protected] network-scripts]vim ifcfg-enp0s25

DEVICE=enp0s25

ONBOOT=yes

BOOTPROTO=none

IPADDR=172.25.254.24

NETWASK=255.255.255.0

[[email protected] network-scripts] reboot

[[email protected] network-scripts]ifconfig

(二)配置网桥,br0

[[email protected] network-scripts]# pwd

/etc/sysconfig/network-scripts

[[email protected] network-scripts]# vim ifcfg-enp0s25

DEVICE=enp0s25

ONBOOT=yes

BOOTPROTO=none

BRIDGE=br0

[[email protected] network-scripts]# vim ifcfg-br0

DEVICE=br0

ONBOOT=yes

BOOTPROTO=none

IPADDR=172.25.254.24

NETMASK=255.255.255.0

TYPE=Bridge

[[email protected] network-scripts]# systemctl restart network

[[email protected] ~]#  cd /etc/sysconfig/network-scripts/

[[email protected] network-scripts] # mv ifcfg-br0 ifcfg-enp0s25 /mnt/

[[email protected] network-scripts]vim ifcfg-enp0s25

DEVICE=enp0s25

ONBOOT=yes

BOOTPROTO=none

IPADDR=172.25.254.24

NETWASK=255.255.255.0

Linux系统网络高级配置--网桥网络接口(bondteam)相关教程

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值