2020年5月28日 星期四

CentOS/RHEL 使用 "IP" 設定VLAN Tag

 CentOS / RHEL 6 7 8 版本均適用

預先載入模組 8021q
#  modprobe 8021q
#  lsmod | grep -i 8021q 


增加一個 eth0.2020的介面卡 PS:請依主機的介面卡為主 eno ethx等等
#  ip link add link eth0 name eth0.2020 type vlan id 2020
#  ip link set eth0.2020 up
ip -d link show eth0.2020
   eth0.2020@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc   noqueue state UP mode DEFAULT
    link/ether 00:0c:29:1f:dd:ed brd ff:ff:ff:ff:ff:ff promiscuity 0
    vlan protocol 802.1Q id 2020 <REORDER_HDR>

最後一個步驟請在 eth0.2020 介面補上IP 位址 
#  ip addr add 192.168.1.10/24 dev eth0.2020

VLAN介面刪掉指令
#  ip link del eth0.2020

Refer to this link : 
http://puremonkey2010.blogspot.com/2011/11/linux-vconfig-vlan.html

10.4.2 Configure 802.1Q VLAN Tagging Using ip Commands
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-configure_802_1q_vlan_tagging_using_the_command_line#sec-Configure_802_1Q_VLAN_Tagging_ip_Commands

沒有留言:

張貼留言