K
K
kovalr2015-10-01 14:30:07
Computer networks
kovalr, 2015-10-01 14:30:07

Add VLAN to virtual interface in Ubuntu?

Is it possible to add a VLAN to a virtual interface in Ubuntu?
I try
sudo vconfig add eth0:1 20
answer
No such device.
It turns out that VLANs can only be added to physical interfaces?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Fedoseev, 2015-10-01
@martin74ua

VLAN can only be assigned to a physical ethernet interface.
eth0:1 is just an alias, an additional address over the main one.

A
Alexey Serebryakov, 2015-10-01
@VoltSilver

Rather, the problem is that vlan 1, according to the standard, cannot be hung on a package.
Here's what I do (not Ubuntu, but I don't think it makes a difference):
vconfig add enp3s0f0 10
ifconfig enp3s0f0.10 up
vconfig add enp3s0f0.10 100
ifconfig enp3s0f0.10.100 up
ip addr
8: [email protected]: mtu 1500 qdisc noqueue state UP
link/ether 00:e0:ed:12:37:b6 brd ff:ff:ff:ff:ff:ff
inet6 fe80::2e0:edff:fe12:37b6/64 scope link
valid_lft forever preferred_lft forever
9: enp3s0f0 [email protected]: mtu 1500 qdisc noqueue state UP
link/ether 00:e0:ed:12:37:b6 brd ff:ff:ff:ff:ff:ff
inet6 fe80::2e0:edff:fe12:37b6 /64 scope link
valid_lft forever preferred_lft forever
Everything is added great
But what happens when you try to create vlan 1:
vconfig add enp3s0f0 1
Added VLAN with VID == 1 to IF -:enp3s0f0:-
WARNING: VLAN 1 does not work with many switches,
another number consider if you have problems.
However:
ifconfig enp3s0f0.1 up
vconfig add enp3s0f0.1 20
ifconfig enp3s0f0.1.20 up
ip addr
10: [email protected]: mtu 1500 qdisc noqueue state UP
link/ether 00:e0:ed:12:37:b6 brd ff :ff:ff:ff:ff:ff
inet6 fe80::2e0:edff:fe12:37b6/64 scope link
valid_lft forever preferred_lft forever
11: [email protected]: mtu 1500 qdisc noqueue state UP
link/ether 00:e0:ed:12:37:b6 brd ff:ff:ff:ff:ff:ff
inet6 fe80::2e0:edff: fe12:37b6/64 scope link
valid_lft forever preferred_lft forever
There are interfaces. If you are sure of the correct syntax, this may already be an Ubuntu limitation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question