码迷,mamicode.com
首页 > 系统相关 > 详细

Ubuntu bonding + vlan

时间:2018-05-30 21:09:45      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:否则   网卡   版本   sys   module   ESS   启动   4.4   esc   

系统版本: 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

 

Ubuntu bonding + vlan

标签:否则   网卡   版本   sys   module   ESS   启动   4.4   esc   

原文地址:https://www.cnblogs.com/gaozhengwei/p/9112749.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!