I have an ubuntu server and I want to set a static ip for it.
The ip will be 192.168.1.7, the subnet mask 255.255.255.0 the gateway 192.168.1.1 and the VLAN 50.
What lines should be in /etc/network/interfaces file to get that vlan setting and those ip subnet-mask and gw settings?
Is it correct to connect the server to a port tagged vlan 50 or shoul I connect it to a port that carries all vlans?
should this work?
auto eth1.50
iface eth1.50 inet static
address 192.168.1.7
netmask 255.255.255.0
gateway 192.168.1.1
vlan-raw-device eth1
I am not sure if your example would work, but can show you my configuration that works fine.
As you see, first I bring up the unaddressed eth1, then set
vlan-raw-device
globally (that will apply to all following VLAN subinterfaces), and finally bring up the actual 802.1q vlan subinterface.It does not matter if the port on the switch is a trunk with all vlans or just this one (50). What matters is that frames on that port are tagged. Frames not belonging to vlan 50 would be skipped anyway.