Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

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 (10.42.0.1) and netmask (255.255.255.0) with ifconfig. Finally, I set the static ip address of the raspberry pi to be the one I had with the shared connection +1 (= 10.42.0.2) and set the gateway to the address of the laptop (10.42.0.1), 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
address 10.42.0.2
netmask 255.255.255.0
gateway 10.42.0.1

So far, this is working.

share|improve this answer

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.