侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

ubuntu 802.1Q VLAN Tagging

2023-12-12 星期二 / 0 评论 / 0 点赞 / 108 阅读 / 1292 字

环境准备sudo apt-get install vlansudo modprobe 8021q检查环境A quick review of lsmod will ensure the kernel m

  • 环境准备

    sudo apt-get install vlansudo 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 restartsudo ifdown enp2s0f1sudo ifup enp2s0f1.102sudo 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]

广告 广告

评论区