zoukankan      html  css  js  c++  java
  • Ubuntu bonding + vlan

    系统版本: Ubuntu 14.04 (4.4.0)

    创建bonding

    1.  系统自动加载 bonding模块

    ubuntu@bogon:~$ cat /etc/modules
    # /etc/modules: kernel modules to load at boot time.
    #
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.
    bonding

     2. 安装 ifenslave 插件

    apt-get install ifenslave

      3. 配置网卡

    ubuntu@bogon:~$ cat /etc/network/interfaces
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    
    up ifenslave bond0 enp0s3 enp0s8
    down ifenslave -d bond0 enp0s3 enp0s8
    
    auto bond0
    iface bond0 inet dhcp  #此处配置需要正常启动, 否则无法模块4 设备失败
    bond-mode 4
    bond-miimon 100
    bond-slaves enp0s3 enp0s8

    创建Vlan

    1.  系统自动加载 8021q模块

    root@bogon:/home/ubuntu# cat /etc/modules
    # /etc/modules: kernel modules to load at boot time.
    #
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.
    bonding
    8021q

    2.配置网卡

    ubuntu@bogon:~$ cat /etc/network/interfaces
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    
    up ifenslave bond0 enp0s3 enp0s8
    down ifenslave -d bond0 enp0s3 enp0s8
    
    auto bond0
    iface bond0 inet dhcp
    bond-mode 4
    bond-miimon 100
    bond-slaves enp0s3 enp0s8
    
    auto vlan41
    iface vlan41 inet static
    address 192.168.10.10
    netmask 255.255.255.0
    network 192.168.10.0
    broadcast 192.168.10.255
    vlan-raw-device bond0

    注意:  1. bonding模块默认支持一个bond, 如果需要创建2个bond, 配置/etc/modprobe.d/bonding.conf  *(options bonding max_bonds=2)

              2. 如果网卡需要开机启动且不需要IP, 需要使用manual (dhcp/static/manual)

    脚本小记:

    root@bogon:/home/ubuntu# cat /etc/network/interfaces
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    
    up (ifenslave bond0 enp0s3; 
        ifenslave bond1 enp0s8)
    down (ifenslave -d bond0 enp0s3; 
          ifenslave -d bond1 enp0s8)
    
    auto bond0
    iface bond0 inet dhcp
    bond-mode 4
    bond-miimon 100
    bond-slaves enp0s3
    
    auto bond1
    iface bond1 inet static
    bond-mode 0
    bond-miimon 100
    address 192.168.230.100
    netmask 255.255.255.0
    network 192.168.230.0
    broadcast 192.168.230.255
    
    auto vlan41
    iface vlan41 inet static
    address 192.168.10.10
    netmask 255.255.255.0
    network 192.168.10.0
    broadcast 192.168.10.255
    vlan-raw-device bond1
  • 相关阅读:
    hibernate动态切换数据源
    spring mvc之@ModelAttribute注解
    Nhibernate 4.0 教程入门
    关于Ubuntu运行级别、开机启动脚本的说明
    开发工程师面试的秘密( 整理自 Export C Programming )
    Linux (Ubuntu12.04) 下开发工具安装和使用
    Java 7 中的Switch 谈 Java版本更新和反编译知识
    Java语言的个人理解
    Jetty 服务器的知识
    集训培训日记——第二天
  • 原文地址:https://www.cnblogs.com/gaozhengwei/p/9112749.html
Copyright © 2011-2022 走看看