Hi,
your linux box is connected to an ethernet switch where vlan tagging is configured (trunc) and you want to configure your network manually by ifconfig?
Load the module for tagged vlans 802.1q.
1 | root@debdev ~ # modprobe 8021q |
Add the vlan to the interface. In this example VLAN ID 11 at Interface eth0
1 2 | root@debdev ~ # vconfig add eth0 11 Added VLAN with VID == 11 to IF -:eth0:- |
Configure IP Address
1 | root@debdev ~ # ifconfig eth0.11 192.168.254.11 netmask 255.255.255.0 up |
And add a (default) route if necessary
1 | root@debdev ~ # route add default gw 192.168.254.1 |
Or with ip command
1 2 | root@debdev ~ # ip link add link eth0 name eth0.11 type vlan id 11 root@debdev ~ # ip link set eth0.11 up |
Check
1 | root@debdev ~ # ip -d link show eth0.11 |
Set IP
1 | root@debdev ~ # ip a add 192.168.254.11/255.255.255.0 dev eth0.11 |
And delete
1 | root@debdev ~ # ip link delete eth0.11 |