Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently trying to set up a home router using a machine running Ubuntu 12.04. The machine has two ethernet ports. eth0 is LAN and eth1 is WAN.

I have set eth0 to a static ip and have eth1 request an ip via DHCP.


auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

auto eth1
iface eth1 inet dhcp

This allows me to ping LAN computers, but I am unable to ping or access any external hosts. The modem is giving eth1 a valid ip address. The machine is setting it's LAN ip to (to be moved to when everything is working).

I have added the following to /etc/bind/named.conf.options:

    forwarders {

net.ipv4.ip_forward=1 has been added to /etc/sysctl.conf.

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         Vanir.local         UG    100    0        0 eth0        *        U     0      0        0 eth0    *        U     0      0        0 eth1
link-local      *          U     1000   0        0 eth0

Does anybody see what I'm missing in order to allow both WAN and LAN traffic on my machine?

share|improve this question
can you give an output of pinging an external host name and external ip. – wlraider70 Apr 11 '13 at 1:58
Destination Host Unreachable – earthmeLon Apr 11 '13 at 2:29
Run /sbin/ifconfig and route and post the output. – Barton Chittenden Apr 11 '13 at 4:53
I have added route output to the OP. ifconfig reports eth0 with my internal LAN address and eth1 as my external WAN address, as stated. – earthmeLon Apr 11 '13 at 19:25
up vote 1 down vote accepted

I was able to resolve this issue by editing /etc/udev/rules.d/70-persistent-net.rules. By making eth0 my WAN NIC, linux automatically used it's gateway as the default gateway.


# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x10ec:/sys/devices/pci0000:00/0000:00:1c.4/0000:03:00.0 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="FF:FF:FF:FF:FF:F0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x10ec:/sys/devices/pci0000:00/0000:00:1c.5/0000:04:00.0/0000:05:01.0 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="FF:FF:FF:FF:FF:F1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x10ec:0x8169 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="FF:FF:FF:FF:FF:F2", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
share|improve this answer
maybe add the output/content of the file in /etc/udev/.. to your answer for thoroughness, please? – ILMostro_7 Oct 24 '15 at 7:27
Posted. Thanks for the suggestion. – earthmeLon Oct 27 '15 at 16:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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