Linux网桥

来源:互联网 发布:ubuntu 重装ssh 编辑:程序博客网 时间:2024/05/16 08:17

网桥基础命令

brctl addbr br0 ##添加br0网桥 brctl show ##显示网桥信息 ifconfig br0 ip netmask netmask ##网桥添加ip brctl addif br0 eth0 ##添加网卡 ifconfig br0 down ##关闭网桥 brctl delif br0 eth0 ##删除br0的eth0网卡 brctl delbr br0 ##删除网桥br0 一、制作网桥

编辑主机的物理网卡文件

vim /etc/sysconfig/network-scripts/ifcfg-enp0s25DEVICE=enp0s25BOOTPROTO=noneNAME=westosBRIDGER=br0

编辑虚拟网桥文件

vim /etc/sysconfig/network-scripts/ifcfg-br0DEVICE=br0ONBOOT=yesBOOTPROTO=noneNETMASK=255.255.255.0TYPE=Bridge

重启

systemctl stop NetworkManager.service systemctl restart network       systemctl start NetworkManager.service

链路聚合

多个物理端口捆绑在一起,成为一个逻辑端口,以实现出/ 入流量吞吐量在各成员端口中的负荷分担,交换机根据用户配置的端口负荷分担策略决定报文从哪一个成员端口发送到对端的交换机。bond(最多两块)
    nmcli connection add type bond con-name bond0 ifname bond0 mode active-backup \ip4 172.25.254.230/24    #配置接口nmcli connection add type bond-slave con-name eth0 ifname eth1 master bond0        #为链路聚合接口添加一块网卡eth0nmcli connection add type bond-slave con-name eth1 ifname eth1 master bond0        #为链路聚合接口添加一块网卡eth1,如果eth0网卡坏了,就自动切换到eth1nmcli connection show    #查看系统的网卡ifconfig eth0 down       #使eth0这块网卡宕掉nmcli  connection delete eth0     #删除网卡eth0nmcli  connection delete eth1     #删除网卡eth0nmcli  connection delete bind0    #删除网卡eth0

Team
team接口和bond接口类似,只是他有更强的拓展性,最多支持8块网卡,而且它的功能较多,他有4种功能,分别为broadcast(广播容错)roundrobin(平衡轮叫)activebackup(主备)loadbalance(负载均衡)。
t

eamdctl team0 state ##查看team0信息 nmcli connection add type team con-name team0 ifname team0 config ‘{“runner”:{“name”:”activebackup”}}’ ip4 172.25.254.30/24 ##创建team0 nmcli connection add con-name eth0 ifname eth0 type team-slave master team0##添加eth0 nmcli connection add con-name eth1 ifname eth1 type team-slave master team0##添加eth1 nmcli connection delete team0 ##删除team0
原创粉丝点击