RHEL setup Trunking & VLAN

 


 **Trunking**

 
Target NIC: eth0,eth1 > VIF NIC:bond0
 
step00.
lsmod | grep -i bond // check have bond options
 
step01.
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.bak
cp /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconifg/network-scripts/ifcfg-eth1.bak
 
step02. // modify NIC
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
—————————————————-

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

—————————————————-

# vi /etc/sysconfig/network-scripts/ifcfg-eth1

—————————————————-

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

—————————————————-
step03. // modify vif "bond0"
—————————————————-
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETWORK=10.1.0.0
NETMASK=255.255.0.0
IPADDR=10.1.1.241
USERCTL=no
—————————————————-
 
step04.
# vi /etc/modprobe.d/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=4 lacp_rate=1  

————————————————————-
PS:
miimon用途為進行網連監看,如miimon=100表示100ms監看一次,若有一線路不通就走另一線路!
mode為運作模式,有6種:

mode=0 (Balance-rr) – This mode provides load balancing and fault tolerance.
mode=1 (active-backup) – This mode provides fault tolerance.
mode=2 (balance-xor) – This mode provides load balancing and fault tolerance.
mode=3 (broadcast) – This mode provides fault tolerance.
mode=4 (802.3ad) – This mode provides load balancing and fault tolerance.
mode=5 (balance-tlb) – Prerequisite: Ethtool support in the base drivers for retrieving the speed of each slave.
mode=6 (Balance-alb) – Prerequisite: Ethtool support in the base drivers for retrieving the speed of each slave.
————————————————————-
 
step05.

# modprobe bonding
# modprobe -r -v bonding
# modeprobe -r -b bonding -o bond0

step06.

#/sbin/service network restart
 
step07.
#cat /proc/net/bonding/bond0  // check LACP status
#ifconfig -a


 

 
**VLAN**
 
Target make tag port NIC: eth0 , VLAN-ID:192
 
step00.
#lsmod | grep -i 8021q  // check have 802.1Q options,if not > #modprobe 8021q
 
step01.
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.192
 
step02.
#vi /etc/sysconfig/network-scripts/ifcfg-eth0.192
—————————————————-
DEVICE=eth0.192
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.1
NETMASK=255.255.255.0
USERCTL=no
NETWORK=192.168.1.0
VLAN=yes
—————————————————-
 
step03.
#vi /etc/sysconfig/network-scripts/ifcfg-eth0  // remove original eth0 config ip-address & netmask
—————————————————-
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.1
NETMASK=255.255.255.0
USERCTL=no
NETWORK=192.168.1.0
VLAN=yes
—————————————————-
 
step04.
#/sbin/service network restart

step05.
#cat /proc/net/vlan/eth0.192

 
reference > 
 

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com 標誌

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google photo

您的留言將使用 Google 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 /  變更 )

連結到 %s