Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a wi-fi router, a linux machine (ubuntu) a Mac, and an iPhone. The router has the address 192.168.1.1, the ubuntu machine connect to that with ethernet (192.168.1.2) and the Mac connect to the router via Wi-fi (192.168.1.6.). Netmask is 255.255.255.0.

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          0.0.0.0         UG    0      0        0 eth0
link-local      *               255.255.0.0     U     1000   0        0 eth0
192.168.1.0     *               255.255.255.0   U     1      0        0 eth0

ifconfig output is

eth0      Link encap:Ethernet  HWaddr 00:1d:60:93:bb:bb  
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21d:60ff:fe93:bbbb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          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 serverfault.com Oct 28 '11 at 23:22

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

1 Answer 1

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 192.168.1.6

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

echo nameserver 8.8.8.8 | 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) –  Walkman 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: cacoo.com/diagrams/VcBnZIl1GB3EDsGv –  Walkman Oct 29 '11 at 0:37
    
yes, I manage it via ssh. here are routing tables for Mac. pastie.org/2776130 –  Walkman Oct 29 '11 at 0:44

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.