Switch – inter VLAN routing with Ubuntu

switchubuntu-14.04vlan

I have 4 VLANs created and I'm trying to use my Ubuntu machine as the DNS,DHCP, and L3 router. I want my 4 VLANs separated but still able to talk each other. Here is a bit about my setup.

Cable modem (Bridged)–>Ubuntu Server box (see below)–>Dell Power connect 2824 (in Managed mode) – L2 switch w/ IP address of 192.168.1.1

(4 VLANs setup within the Dell L2 switch)
vlan1 (Mgmt) 192.168.1.0/24

vlan10 (home network) 192.168.10.0/24

vlan20 (Storage/Backups/Media server) 192.168.20.0/24

vlan30 (Work) 192.168.30.0/24

Ubuntu server 14.4 LTS
eth0 – Cable modem IP (WAN) Netmask 255.255.224.0

eth1 – LAN side – 192.168.10.2 Netmask 255.255.255.0

I can NOT get the static routes setup on this to save my life. On Ubuntu server DNS works great. DHCP hands out addresses fine only for the 192.168.10.x network. It will not hand out addresses for the other VLANs. I assume that will work once we get all of the VLANs talking properly.

I understand the concepts but need specifics of what to change to get this working and routes should be persistent upon reboot. Thank you for the assist.


ip address show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:23:7d:f3:10:d2 brd ff:ff:ff:ff:ff:ff
    inet 70.115.129.7/19 brd 255.255.255.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::223:7dff:fef3:10d2/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:23:7d:f3:10:d0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.2/24 brd 192.168.10.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::223:7dff:fef3:10d0/64 scope link
       valid_lft forever preferred_lft forever


ip route show

default via 70.115.128.1 dev eth0
70.115.128.0/19 dev eth0  proto kernel  scope link  src 70.115.129.7
192.168.10.0/24 dev eth1  proto kernel  scope link  src 192.168.10.2

The new routing table after the VLAN interfaces were configured on the Linux router:

$ ip r s
default via 70.115.128.1 dev eth0
70.115.128.0/19 dev eth0 proto kernel scope link src 70.115.129.7
192.168.1.0/24 dev eth1.1 proto kernel scope link src 192.168.1.10
192.168.10.0/24 dev eth1.10 proto kernel scope link src 192.168.10.2
192.168.20.0/24 dev eth1.20 proto kernel scope link src 192.168.20.1

Best Answer

On Linux server you need to create the vlan interfaces and assign static IP addresses. Follow the official Ubuntu documentation for details 1.

Configure DHCP to listen to all VLANs except the one facing the cable modem. You will need separate DHCP subnet for each VLAN. Make sure that you send via DHCP as default route the IP of the VLAN interface directly connected with that VLAN.

Use tshark/wireshark/tcpdump for debugging. Use them on both VLAN interfaces and on ethernet interface. You can filter for DHCP packets only if you have too much traffic:

Could you please edit your question and add the output of following commands from the router:

ip address show
ip route show

Edit /etc/network/interfaces and make sure you have for each VLAN a vlan interface configured. Here is only VLAN10:

# Disable IP on eth1, we are not using the native VLAN
iface eth1 inet manual

# VLAN 10 - home network
auto eth1.10
iface eth1.10 inet static
    address 192.168.10.1/24
    vlan-raw-device eth1

Make sure that eth1 has no IP assigned. you will assign IP addresses on VLAN interfaces (like eth1.10).

Related Topic