Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

After setting up network sharing the easy way on the Ubuntu machine, and getting an IP address via DHCP on the Arch Linux machine downstream, the Arch machine is able to ssh to the Ubuntu machine and resolve DNS, but not communicate with the Internet (ping, pacman time out). From the Arch Linux machine:

$ ip route show dev net0
default via metric 202 proto kernel scope link src metric 202
$ ip addr show dev net0
inet brd scope global net0

On the Ubuntu machine:

$ ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether e8:11:32:66:e3:4d brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
    inet6 fe80::ea11:32ff:fe66:e34d/64 scope link 
       valid_lft forever preferred_lft forever
$ ip addr show dev wlan0
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 88:53:2e:1b:4b:1c brd ff:ff:ff:ff:ff:ff
    inet brd scope global wlan0
    inet6 fe80::8a53:2eff:fe1b:4b1c/64 scope link 
       valid_lft forever preferred_lft forever

Could it be that the automatic NAT setup on Ubuntu failed? I'm not sure how that works, so how would I detect that?

share|improve this question
Can I answer Internet share using iptables ? –  Rahul Patil Sep 7 '13 at 7:20
@RahulPatil If it explains how in a concise manner, sure. The goal is to solve routing in the simplest manner possible. –  l0b0 Sep 7 '13 at 8:51
you mean "" should act as gateway/router for other computer in network ? –  Rahul Patil Sep 7 '13 at 19:06
once check with enable ip forwarding then let me know. ducea.com/2006/08/01/how-to-enable-ip-forwarding-in-linux –  Rahul Patil Sep 7 '13 at 20:02
IP forwarding was enabled. –  l0b0 Sep 22 '13 at 7:45

1 Answer 1

Only one thing puzzles me, here: you say that DNS from the Arch machine is working. If your DNS server is your Ubuntu box, great. If your DNS server is external, then I'm confused. I'm not intimately familiar with Arch — only installed it once — but you can usually check /etc/resolv.conf to see who your DNS servers are. If they are internal, most likely your NAT or forwarding on the Ubuntu box aren't working. If they are external — which means you are successfully resolving DNS queries against an external host — your problem is likely an iptables issue.

From a "what's likely to go wrong" perspective, it's far more likely to be forwarding/NAT. So: verify forwarding is, indeed, enabled on the Ubuntu box:

fireapple# cat /proc/sys/net/ipv4/conf/all/forwarding 

If it returns "0", likely your forwarding isn't enabled. To temporarily fix it, simply

fireapple# echo 1 > /proc/sys/net/ipv4/conf/all/forwarding

To make it last through a reboot, edit /etc/sysctl.conf and add (or modify to look like) the following line:

net.ipv4.ip_forward = 1

Next, a quickie how-to-set-up-NAT script. Plug the following into, say, NAT.sh, make sure you've chmod +x'd it, and put it in /usr/local/bin/. Note that I've made assumptions about which interface is doing what, based on the fact that both hosts have addresses:

export INTERNET=wlan0  # Assuming eth0 is your Internet-facing address
export INTERNAL=eth0 # Likewise, assuming your WiFi is internal
iptables --flush      # Clean slate

Once that's in-place, execute it (e.g., sudo /usr/local/bin/NAT.sh); if all goes well, you should be able to talk freely to the outside world.

share|improve this answer

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.