Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 macbook with ubuntu quantal running on it and I also have a device with a linux distro (FYI, a raspberry pi*).

I've been trying to set up the device to share my laptop's wireless connection through the ethernet port. The problem is that I do not want to allow the ip address of the device to change (so I guess I don't want to use DHCP), since it has no interface other than the ssh connection that I open from my ubuntu laptop.

Thus, the question is: how can I set up both ubuntu and the device to have it using ubuntu's wireless connection through the ethernet cable, but without ever changing the ip address of the eth0 port in the device? I do not want to change it because I'd like to always be able to find it on the network without having to edit its filesystem in another machine...

* I think this problem is more related to ubuntu than to the raspberry pi, so I believe this is the right forum to ask this question.

share|improve this question

I've managed so far, but I don't know if that's the ideal solution. Anyhow, it might be useful enough for someone else:

I created a wired internet-share connection (click on the network icon on the top left corner of the screen -> edit connections... -> Wired tab -> Add -> IPv4 settings -> Method -> Shared to other computers; also made sure that the box "Available to all users" in the same window was checked). Once I connected to this connection, I checked my ipaddress ( and netmask ( with ifconfig. Finally, I set the static ip address of the raspberry pi to be the one I had with the shared connection +1 (= and set the gateway to the address of the laptop (, ending up with the following contents in the /etc/network/interfaces on the raspberry pi:

auto lo

iface lo inet loopback

#iface eth0 inet dhcp

iface eth0 inet static

So far, this is working.

share|improve this answer
but how can you ping your raspberry device of 10.42.0.X ip from your main network 192.168.1.X? – mowienay Mar 20 at 0:48

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.