Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

/etc/network/interface

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
  address 10.1.1.10
  netmask 255.255.255.0
  gateway 10.1.1.10
  dns-nameservers 10.1.1.1 10.1.1.10

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 10.1.1.10 (to be moved to 10.1.1.1 when everything is working).

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

    forwarders {
            8.8.8.8;
            8.8.4.4;
    };

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     0.0.0.0         UG    100    0        0 eth0
10.1.1.0        *               255.255.255.0   U     0      0        0 eth0
98.162.168.0    *               255.255.252.0   U     0      0        0 eth1
link-local      *               255.255.0.0     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
1  
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
1  
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

1 Answer 1

up vote 0 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.

share|improve this answer

Your Answer

 
discard

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.