I'm trying to set up Ubuntu Server 16.04 as a router just to figure out how this works and maybe build a home server/router down the line sometime. Problem is, I can't seem to get it to work, not sure if it even accepts the routes I set up.


auto lo 
iface lo inet loopback

auto enp0s3
iface enp0s3  inet static
    ip route replace default via dev enp0s3

auto enp0s8
iface enp0s8 inet static
    ip route replace via dev enp0s3
    ip route replace via dev enp0s8 

This is probably the eighth or so setup I tried for the routes so it may seem odd. I tried these with "up" before, with "add" instead of "replace" and "||true" as per someone else's previous suggestion here on SE.

Network/VBox setup is as follows: enter image description here The network connection from the router VM to the WAN router in my home LAN is bridged, I can ping to WAN from the router. I can ping to both router interfaces from the host. I can however not ping the host from the router or WAN from the host.

Any suggestions appreciated, thanks.

-Edit-: so I changed the setup a bit as per the suggestions here (thanks for these): enter image description here enter image description here

I've also added a route on my WAN router to point towards the now network via

The client (WX, .2.2) can now ping: both LAN-Router interfaces (.2.254 & .1.254), but not the WAN router (.1.1) or into the WAN (

The LAN router can ping the WAN router, both its own interfaces and into the WAN, but not to the client (.2.2)

The WAN router can ping both LAN router interfaces, but not the Client.

Windows Firewall on the client is disabled.

I've had a prior setup with a ClearOS VM that worked without configuring the WAN router, but ClearOS wasn't what I had in mind so I tried to use that config for the Ubuntu setup which strangely does not work. VBox config is the same.

As always, any help is appreciated.

  • 3
    The ip addresses of belong to General Electric, and shouldn't be used in setups like this (unless you work for GE, and they have actually set those IP's aside for your use). Jul 25, 2016 at 21:30
  • 1
    On seeing your edits I should have asked you about the type of router you try to configure. NAT (hides the inner network, like your WAN-ROUTER does) or "standard" (makes the inner network visible for hosts in your network)?
    – guntbert
    Jul 26, 2016 at 17:10
  • Since the WAN router already does the NAT, I don't think another internal NAT would make any sense. I really just want a system to put in between the WAN router and the client for monitoring etc.
    – cmm
    Jul 26, 2016 at 17:24
  • 1
    Thx for confirming what I assumed. I will add to my answer.
    – guntbert
    Jul 26, 2016 at 20:36

1 Answer 1


The reason why your setup doesn't work is that your WAN-router (let's call it r1) cannot know how to reach the VM behind your Ubuntu router (let's call it r2).

You must (on r1) add a route to the network, with the LAN-address of r2 ( as next hop.

How to do this depends on the software of r2.

As an aside (as has been pointed out in a comment): you should not assign arbitrary network addresses, even if the network is behind a NAT router. Instead use or - see RFC 1918 for details.

You will have to tell the kernel of r2 to forward IP-packets:

echo 1 | sudo tee >   /proc/sys/net/ipv4/ip_forward

Then make it permanent by uncommenting the following line in /etc/sysctl.conf

net.ipv4.ip_forward = 1
  • Thanks a bunch, it worked. Except for the persistent part, but I found that one here edit /etc/sysctl.conf: uncomment net.ipv4.ip_forward = 1
    – cmm
    Jul 27, 2016 at 15:10
  • Thx for reporting back, you are right about "permanent", I obviously copied mindlessly the wrong line from my own blog.
    – guntbert
    Jul 27, 2016 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.