I appear to have some fundamental misunderstanding of how VLANs work on Linux, and I'm hoping the good people here can educate me.
Cast: One Cisco
WS-C3560X-24T-L, one VLAN, and one Linux box [1].
Cisco --------------- Linux
ge0/1 eth0
The Cisco has a Vlan 37 interface, with IP address 10.40.37.252/24. I want to place 10.40.37.1/24 on the Linux box.
When the Cisco de-encapsulates vlan 37, everything works fine [2]:
# Cisco
interface Vlan37
ip address 10.40.37.252/24
interface GigabitEthernet 0/1
switchport mode access
switchport access vlan 37
# Linux
ip link set eth0 up
ip addr add 10.40.37.1/24 dev eth0
$ ping 10.40.37.252 && echo It works
However, when I set the port to trunking and assign vlan 37 on the Linux side, it stops working:
# Cisco
interface GigabitEthernet 0/1
switchport trunk encapsulation dot1q
switchport mode trunk
! [3] [4] [7]
# Linux
vconfig add eth0 37
ip link set eth0.37 up
ifconfig eth0 0.0.0.0 up # ensure no address
ip addr add 10.40.37.1/24 dev eth0.37
$ ping 10.40.37.252 || echo Why does this not work
What am I missing here?