Linux高级网络配置

1.bond网络
选择linux以太网绑定模式
模式0(平衡论循)-轮循策略,所有接口都使用采用轮循方式在所有Slave中传输封包;任何slave都可以接收
模式1(主动备份)-容错,一次只能使用一个slave接口,但是如果该接口出现故障,另一个slave接替它
模式3(广播)-容错。所有封包
具体操作如下
在做实验之前保证设备拥有两块纯净的网卡
为了方便观察我们

watch -n1 cat /proc/net/bonding/bond0
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.61.150/24
nmcli connection add con-name eth0 ifname  eth0 type bond-slave master bond0 
nmcli connection add con-name eth1 ifname  eth1 type bond-slave master bond0 

在这里插入图片描述

ifconfig eth0 down  ##当我们把eth0关闭之后eth1会顶替
ifconfig eth0 up

在这里插入图片描述

ifconfig eth1 down  ##当我们把eth1关闭之后eth0会顶替
ifconfig eth1 up

在这里插入图片描述
2.Team网络及种类

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

3.通过nmcli设定team

nmcli connection add con-name team0 ifname team0 type  team config '{"runner":{"name":"activebackup"}}' ip4 172.25.254.134/24
teamdctl team0 stat
nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
nmcli connection add con-name eth1 ifname eth1 type team-slave master team0
ifconfig eth0 down 
ifconfig eth0 up
ifconfig eth1 down 
ifconfig eth1 up

在这里插入图片描述
4.桥接
文件设定桥接接口bro

cd /etc/sysconfig/network-scripts/
cp ifcfg-br0  ifcfg-enp0s25  /mnt/ -p   ##备份网络,防止设置错误,便于恢复
nm-connection-editor                        ##删除多余网路
reboot
cd /etc/sysconfig/network-scripts/
vim ifcfg-redhat
BOOTPROTO=none
NAME=redhat
DEVICE=enp0s25
ONBOOT=yes
BRIDGE=br0
             
vim ifcfg-br0
DEVICE=br0
IPADDR=172.25.254.34
PREFIX=24
ONBOOT=yes
BOOTPROTO=none
TYPE=Bridge              ##指定类型为桥接

systemctl stop NetworkManager
systemctl restart network

5.临时设定桥接接口br0
添加

brctl show   ##查看桥接接口
brctl addbr br0  ##添加接口
ifconfig br0 172.25.254.xx/24 ##设定临时ip
brctl addif br0 eth0  ##添加设备
ping 172.25.254.xx  ##测试
删除
brctl delif br0 eth0 ##删除设备
ifconfig br0 down    ##关闭接口
brctl delbr br0      ##删除接口

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值