ubuntu 802.1Q VLAN Tagging

  • 环境准备

    sudo apt-get install vlan sudo modprobe 8021q


  • 检查环境

A quick review of lsmod will ensure the kernel module was loaded:

lsmod | grep 8021q

The output of the command should look similar to this:

8021q 26896 0”


  • 给enp2s0f1划到vlan102:
sudo vim  /etc/network/interfaces

auto enp2s0f1
iface enp2s0f1 inet static

auto enp2s0f1.102
iface enp2s0f1.102 inet static
address 10.0.0.220
network 10.0.0.0
netmask 255.255.255.0
broadcast 10.0.0.255
vlan_raw_device enp2s0f1

sudo /etc/init.d/networking restart
sudo ifdown enp2s0f1
sudo ifup enp2s0f1.102
sudo ifup enp2s0f1

  • 遇到错误

Cannot find device "enp2s0f1.102"

或者网络不通

重启机器:

reboot

或者:

init 6

  • 检查环境

Once the interface is initialized you may want to refer to the following proc locations for configuration information:

/proc/net/vlan/config
/proc/net/vlan/[vlan-device]

转载于:https://my.oschina.net/readerror/blog/785537

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值