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 Raspberry Pi which connects to my Airport Extreme via DHCP. The Airport is connected to my Cable Modem which gets its IP address via DHCP from Comcast. I would like to be able to address the RPi from a remote location via a domain name that I've registered. I understand that I would use Dynamic DNS to do this, but I'm not sure how to deal with multiple layers of DHCP.

share|improve this question

1 Answer 1

If the cable modem is a simple modem, the only address that counts is the EXTERNAL address it gets from Comcast. This is the one that the rest of the world see.

Anyone connecting to the Pi will still only be able to see that one address and so you need a device that can do Network Address Translation (NAT).

A simple modem won't be able to do this, but if the "modem" is really a router then it will have one or more pages on it's configuration website for setting things like "Virtual Servers", NAT and port forwarding (the names change depending on the manufacturer).

If the modem wont do it, perhaps the Airport will. Either way, the easiest configuration to deal with is to make sure that both the internal address(s) of the modem and those delivered by the Airport are in the same range. So if the modem delivers an internal address(s) such as 192.168.1.x, with a netmask of 255.255.255.0 which is fairly typical - make sure that the Airport is delivering DHCP addresses in the same set of 255 addresses. Just make sure they don't overlap. You will also need to configure the address of the Pi as a fixed address. Good routers such as my Billion 7800N can do this with DHCP, with cheap routers you will need to give the Pi a fixed address that doesn't clash with the DHCP addresses.

At home, for example, I have a router that gives me both wired and wireless networks plus a Wi-Fi access point that delivers a second wireless network. I've set the router's DHCP to deliver 192.168.1.100 - .150 and the Wi-Fi access point to deliver 192.168.1.151 - .199 both with a netmask of 255.255.255.0 so that any device on the internal network can route to any other. I have a number of devices that may act as servers and are given a fixed DHCP address based on their MAC address.

When you've sorted that, configure the "modem", assuming it is really a router (you'll have to try and get the Airport to do this otherwise or configure a PC as a router) to forward requests to your external IP address and a convenient port (e.g. 8080) to the internal address and port of the Pi's service you want to access (e.g. port 22 for SSH).

However, there is one further problem. It may well be that Comcast don't actually give you a fixed external IP address! If that is the case, that's when you will need to set up a Dynamic DNS forwarder. Most decent routers have this built in now. You set up a connection from your router to your chosen Dynamic DNS service and the router updates the service when your external IP address changes.

To configure your purchased domain to use dynamic addressing, instead of pointing the domain name at an IP address as you normally would, you point it that the address provided by the dynamic DNS service. Your DNS service provider should have details.


Wow, that was a rambling answer! Hope it makes some sense. Bottom line is that, it is fairly easy to do if you have a decent router, use a consistent internal IP address range for both router and wi-fi and sign up to a Dynamic DNS service such as NoIP or Dyndns, etc.

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.