Thursday, January 10, 2008

How to supply network to a linux box through a macosx through ethernet

This is for sure no GIS and no java, but it can be usefull to others, so here I go with it.

The problem: supply internet connection to a colleagues computer running linux from my macosx box. I have a broadband connection given me trough an USB-modem.

This was pretty easy, at some point I'll have to get that also throught airport connection, not sure about the security issues tho.

1) the first thing to do is to activate leopard's (my current macosx operating system) internet connection sharing. This is easy. Go under preferences->sharing and just activate it. Select in the combobox the active internet connection and from the list below the way you want to share the connection with the linux box.

In my case I have an ethernet crossed cable for connections between two pcs, so I choose Ethernet.

2) check out the connection properties. In the network settings I see that my modem is connected with the IP address:

BTW I need to know the gateway of that all, i.e. the connection address to the outer world. This can be achieved through the supplied connection software of my modem, though I'm sure there are a lot of other ways. There are also google widgets to trace the connection.

As you can see the connection goes to Now I have to set up properly the ethernet connection, since the connection will not supply dhcp and we need to be all on the same network.

So i simply set up the ethernet connection with a static address of one more than the modem ip address and the proper netmask. The router is the link to the outer world and that's all.

No wait, we need the DNS, which we can retrieve in the advanced settings of the modem connection, in my case:

Alright, now I'm ready to jump to my linux box:


1) Edit the network settings file: /etc/network/interfaces
and put the following into it:

auto lo
iface lo inet loopback

mapping hotplug
script grep

iface eth0 inet static

2) Edit the DNS file: /etc/resolv.conf


And start your network:
sudo ifup eth0

This should work at that point! Enjoy!

UPDATE: I right notice that the static IP thing could be misleading as I put it.

Instead of on your linux box and on your macosx system you could use more usual numbers for the internal networks, as for example and

No comments: