高级网络管理

高级网络管理

一. Bonding模式

Bond就是把两块网卡绑在一起工作,当其中一块坏掉另一块顶替工作,保证网路的通畅

  1.链路聚合,两块网卡,当其中一块坏掉另一块顶替工作,保证网路的通畅
  2.虚拟机两块网卡,eth0,eth1.
  3.nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.110/24  
  4.nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0  添加eth0到bond0中
  5.nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0  添加eth1到bond0中
  6.新开shell watch -n 1 cat /proc/net/bonding/bond0  ##监控bond0的状态
  7. ifconfig eth0 down   
     ifconfig eth0 up
     ifconfig eth1 down

实验:
1.Desktop虚拟机准备两块虚拟网卡eth0,eth1
这里写图片描述
2.nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip 172.25.254.110/24 ##制作bond模式网卡,命名bond0,当其中一块坏掉另一块顶替工作,保证网路的通畅,模式为主动式备用工作方式,设ip为172.25.254.110
这里写图片描述
这里写图片描述
3.

 nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0  ##添加eth0到bond0中
nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0  ##添加eth1到bond0中

这里写图片描述
测试:ifconfig eth0 down down掉eth0网卡,网络依然通常
这里写图片描述
ifconfig eth0 down; ifconfig eth1 同时down掉两块网卡,网络故障
这里写图片描述

二.Team模式

企业7有,企业6没有,最多支持8快网卡

1.准备两块网卡
2.nmcli connection add type team con-name team0 ifname team0 config ‘{“runner”:{“name”:”activebackup”}}’ ip4 172.25.254.110/24
3.ifconfig 查看team信息
4.nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
5.nmcli connection add con-name eth1 ifname eth1 type team-slave master team0
6.watch -n 1 “teamdctl team0 state ” 监控team0信息
7.ifconfig eth0 down
ifconfig eth1 down

实验:ifconfig connection delete bond0 删除bond0,还源实验环境
1.nmcli connection add type team con-name team0 ifname team0 config ‘{“runner”:{“name”:”activebackup”}}’ ip4 172.25.254.110/24 制作team类型网卡team0,模式为主动式备用式,ip4设为172.25.254.110
这里写图片描述
2.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
添加eth0,eth1两块网卡到team0中
这里写图片描述
3.ifconfig eth0 down
ifconfig eth1 down
这里写图片描述
这里写图片描述
##四.桥接

桥接

1.

vim /etc/sysconfig/network-scripts/ifcfg-enps0s25

    cat ifcfg-enps0s25
          DEVICE=enp0s25
          ONBOOT=yes
          BOOTPROTO=none
          BRIDGE=br0
vim /etc/sysconfig/network-scripts/ifcfg-enps0s25

   cat ifcfg-br0
           DEVICE=br0
           ONBOOT=yes
           BOOTPROTO=none
           TYPE=Bridge
           IPADDR=172.25.254.10
           PREFIX=24

这里写图片描述

2.命令模式管理

 桥接命令模式;
        ifconfig      查看是否有桥br0
        brctl addbr br0  添加桥br0
        brctl show   查看桥接状态
        ifconfig br0 172.25.254.110 netmask 255.255.255.0  设定桥的ip和子网掩码
        ping 172.25.254.250 ping 不通
        brctl addif br0 eth0 桥接br0网卡到eth0
        brctl show            查看桥接状态
        ping 172.25.254.250   ping
        brctl delif br0 eth0  取消br0桥接到eth0
        brctl show           查看桥接状态
        brctl delbr br0
        ifconfig br0 down    down掉br0
        brctl delbr br0      删除br0
        brctl show           查看桥接状态

实验:
Ifconfig查看到桥接br0
这里写图片描述
这里写图片描述
Ping 不通还没添加网卡
brctl addif br0 eth0 桥接br0网卡到eth0
这里写图片描述
这里写图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值