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
  • 相关阅读:
    SQL Server之4:游标原理和使用方法
    .Net MVC3之2:前台异步获取json数据的实例(2)
    通过url读取页面内容
    SharePoint 在页面查看错误信息
    添加列表时修改Title字段报错
    滚动新闻
    视频列表
    自定义列表部署
    SharePoint 2010 使用”日历重叠“功能(转)
    沙盒解决方案与场解决方案之间的差异(转)
  • 原文地址:https://www.cnblogs.com/gaozhengwei/p/9112749.html
Copyright © 2011-2022 走看看