Super User is a question and answer site for computer enthusiasts and power users. 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 have a wi-fi router, a linux machine (ubuntu) a Mac, and an iPhone. The router has the address, the ubuntu machine connect to that with ethernet ( and the Mac connect to the router via Wi-fi ( Netmask is

I share the 3G internet from the iPhone to the Mac via USB, and want to share it to the ubuntu machine too.

How can I do this ? route command output on ubuntu

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         router         UG    0      0        0 eth0
link-local      *          U     1000   0        0 eth0     *        U     1      0        0 eth0

ifconfig output is

eth0      Link encap:Ethernet  HWaddr 00:1d:60:93:bb:bb  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::21d:60ff:fe93:bbbb/64 Scope:Link
          RX packets:113 errors:0 dropped:0 overruns:0 frame:0
          TX packets:126 errors:0 dropped:0 overruns:0 carrier:1
          collisions:0 txqueuelen:1000 
          RX bytes:14751 (14.7 KB)  TX bytes:19834 (19.8 KB)
share|improve this question

migrated from Oct 28 '11 at 23:22

This question came from our site for system and network administrators.

First, configure the Mac share the internet connection.

Then, simply configure the default route (either on the router or the Ubuntu machine) to be the Mac. On the Ubuntu machine, enter the following in the shell:

sudo route del default
sudo route add default gw

You may also want to adapt the address of the DNS server. Use the following to set it to google's:

echo nameserver | sudo tee /etc/resolv.conf
share|improve this answer
@KissGyörgy First, keep your calm and don't panic. Disabling the internet sharing and running ifdown eth0 && ifup eth0 on the Ubuntu machine will restore the old state. Make sure you share the correct connection. Before you typed anything on the Ubuntu machine, could you still connect to the Mac, for example via ping? – phihag Oct 29 '11 at 0:04
I cannot log in to the ubuntu machine after I set up Internet sharing on the mac. (no screen on that machine) – kissgyorgy Oct 29 '11 at 0:23
@Walkman Are you configuring your Ubuntu machine via ssh from the Mac? If so, that's a pretty important detail you should have included in the question. What is the Mac's routing table before/after you enable internet sharing? – phihag Oct 29 '11 at 0:27
here is my local network: – kissgyorgy Oct 29 '11 at 0:37
yes, I manage it via ssh. here are routing tables for Mac. – kissgyorgy Oct 29 '11 at 0:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .