如何在没有 vconfig 命令的情况下添加 vlan?

Joh*_*ohn 8 linux debian vlan

有没有办法在不使用 vconfig 的情况下创建 vlan 接口?我只有 KVM 控制台和中继端口连接到机器,所以我无法使用 apt,因为我没有互联网访问权限。我在 /etc/network/interfaces 中定义了 vlan,但它不起作用,因为没有创建 vlan 接口。谢谢。

Joh*_*ohn 10

ip link add link eth0 name eth0.5 type vlan id 5 
Run Code Online (Sandbox Code Playgroud)

不要忘记制作链接:

ip link set eth0 up
ip link set eth0.5 up
Run Code Online (Sandbox Code Playgroud)