zoukankan      html  css  js  c++  java
  • CentOS/Redhat 网卡绑定和桥接

    一、实验环境:

    主机名         IP(Static)                     系统                                                配置  

    CentOS      192.168.100.100    CentOS-6.3-x86_64-minimal           2CPU,1G RAM,20G DISK,2网卡

    二、实验目的:

           云计算快速发展,不少已经投入实际运用中,在生产环境中,解决云计算各个环节的稳定性和冗余度显得尤为重要,在此我将演示双网卡的绑定和桥接过程;

           网卡binding的模式选择:mode=1;

           对比几种binding模式,在以前的文章中有说过,在此选择主备(A/S)模式;

    三、配置步骤:

    1.eth0和eth1配置:

    [root@CentOS ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

    DEVICE=eth0
    ONBOOT=yes
    BOOTPROTO=none
    USERCTL=no
    MASTER=bond0
    SLAVE=yes

    [root@CentOS ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1

    DEVICE=eth1
    ONBOOT=yes
    BOOTPROTO=none
    USERCTL=no
    MASTER=bond0
    SLAVE=yes

    2.bond0配置:

    [root@CentOS ~]# vi /etc/sysconfig/network-scripts/ifcfg-bond0

    DEVICE=bond0
    BOOTPROTO=none
    ONBOOT=yes
    USERCTL=no
    BRIDGE=br0
    BONDING_OPTS="miimon=100 mode=1"

    3.br0配置:

    [root@CentOS ~]# vi /etc/sysconfig/network-scripts/ifcfg-br0

    DEVICE=br0
    ONBOOT=yes
    TYPE=Bridge
    BOOTPROTO=static
    IPADDR=192.168.100.100
    NETMASK=255.255.255.0
    GATEWAY=192.168.100.1

    4.配置modprobe.conf文件:

    [root@CentOS ~]# echo “alias bond0 bonding”  >> /etc/modprobe.d/modprobe.conf

    5.配置network文件:

    [root@CentOS ~]# echo “GATEWAY=br0”  >> /etc/sysconfig/network

    6.重启network服务:

           需要两次重启,第一次重启会识别bond0,认为网卡已经桥接过不能再次桥接,这时候再重启一下network服务就可解决:

    [root@CentOS ~]# service network restart

    7.查看binding状态:

    [root@CentOS ~]# cat /proc/net/bonding/bond0 
    Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

    Bonding Mode: fault-tolerance (active-backup)
    Primary Slave: None
    Currently Active Slave: eth0
    MII Status: up
    MII Polling Interval (ms): 100
    Up Delay (ms): 0
    Down Delay (ms): 0

    Slave Interface: eth0
    MII Status: up
    Speed: 1000 Mbps
    Duplex: full
    Link Failure Count: 0
    Permanent HW addr: 24:b6:fd:ab:75:db
    Slave queue ID: 0

    Slave Interface: eth1
    MII Status: up
    Speed: 1000 Mbps
    Duplex: full
    Link Failure Count: 0
    Permanent HW addr: 24:b6:fd:ab:75:dd
    Slave queue ID: 0
    [root@CentOS ~]# 

  • 相关阅读:
    mysql更新语句中的safe_mode
    MySQL数据类型详解
    刚更新完版本就炸了:java.lang.NoClassDefFoundError: org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream
    微信支付分创建支付分订单+签名+验签
    根据序列号加密生产4*4的密码,如:X9PL-TERY-NOZN-GMF1
    对称加密:AES
    MySQL按中文排序
    腾讯云COS分片上传
    Linux中jar包指定端口、配置文件启动并记录日志
    Java8新特性两个关联集合合并成父子级
  • 原文地址:https://www.cnblogs.com/myiaas/p/4161381.html
Copyright © 2011-2022 走看看