Hardware Reference
In-Depth Information
Port forwarding
So once again you're over at your friend's house trying to connect to your Pi at your
own house through SSH. This time you come prepared with a snazzy domain name
that you know for a fact points to the external IP of your home network, thanks to
the wonders of dynamic DNS... and yet PuTTY complains about not being able to
connect, what gives?
Well, home routers usually put up one or two barriers preventing you from
connecting from outside (through the Internet) to the inside of your home network.
One such barrier is called Network Address Translation ( NAT ) and is a common
solution for sharing one external IP address among several computers. The other
barrier is the firewall , which is a more explicit way of allowing or denying traffic to
pass based on certain criteria.
Port forwarding is a way of telling your router to forward certain packets coming in
through the Internet to a specific computer on your home network. To set up a port
forward rule, we need to know the following three things:
• The IP address of the computer that will receive the packets (your Pi in
this case)
• Which IP protocol to expect:
° TCP : This is the most common, used by services like SSH, HTTP
and XMPP
° UDP : This is the other common protocol, used for DNS queries and
audio/video transportation for VoIP applications and so on
° ICMP : This is used primarily by the ping utility and is usually
blocked by the firewall and not forwarded
• Which destination port to expect
To find out which network interface, port, and protocol a certain service is
using on the Pi, issue the following command:
pi@raspberrypi ~ $ sudo netstat -tulpn
List of network services running on the Pi
 
Search WWH ::




Custom Search