zoukankan      html  css  js  c++  java
  • bond绑定两张物理网卡为一张逻辑网卡

    问题:cnetos7同时接入两个独立网络,但两个网络的IP网段相同时只能路由到一个网络

    解决方法:使用bond绑定两张物理网卡为一张逻辑网卡

    1.新建文件bond.conf,内容如下

    alias bond0 bonding
    options bond0 miimon=100 mode=3

    2.新建文件ifcfg-bond0,内容如下

    DEVICE=bond0
    TYPE=Ethernet
    ONBOOT=yes
    BOOTPROTO=static
    IPADDR=192.168.0.138
    NETMASK=255.255.255.0
    GATEWAY=192.168.0.1

    3.修改要绑定的网卡配置文件,例如bond enp1s0和enp2s0两张网卡,配置文件ifcfg-enp1s0和ifcfg-enp2s0修改如下

    ifcfg-enp1s0

    DEVICE=enp1s0
    TYPE=Ethernet
    ONBOOT=yes
    BOOTPROTO=none
    MASTER=bond0
    SLAVE=yes
    GATEWAY=none   

    ifcfg-enp2s0

    DEVICE=enp2s0
    TYPE=Ethernet
    ONBOOT=yes
    BOOTPROTO=none
    MASTER=bond0
    SLAVE=yes
    GATEWAY=none   

    4.新建文件install.sh,内容如下

    #!/bin/bash
    
    #configure and install bond
    
    echo "starting>>>>>"
    cp /root/bond/bond.conf /etc/modprobe.d/ -f
    
    mv /etc/sysconfig/network-scripts/ifcfg-enp1s0 /etc/sysconfig/network-scripts/ifcfg-enp1s0-backup -f
    mv /etc/sysconfig/network-scripts/ifcfg-enp2s0 /etc/sysconfig/network-scripts/ifcfg-enp2s0-backup -f
    cp /root/bond/ifcfg-bond0 /etc/sysconfig/network-scripts/ -f
    cp /root/bond/ifcfg-enp1s0 /etc/sysconfig/network-scripts/ -f
    cp /root/bond/ifcfg-enp2s0 /etc/sysconfig/network-scripts/ -f
    
    init 6
    
    echo "success<<<<<<"

    5.运行install.sh脚本安装配置

  • 相关阅读:
    C++ STL之vector详解
    Two Sum
    The Skyline Problem
    C++ 排序函数 sort(),qsort()的用法
    GO语言为结构体排序
    php将数组或字符串写入文件
    [Zabbix] 怎样实现邮件报警通知以及免费短信报警通知
    js 图片轮转
    ios学习之旅------玩转结构体
    You have ettempted to queue to many files.You may select one files.
  • 原文地址:https://www.cnblogs.com/dmj666/p/8032177.html
Copyright © 2011-2022 走看看