IP Address Reservation and Port Forwarding - Linksys Router.
(Other routers have similar setups)
Why reserve IP addresses?
If you use SSH or Remote Desktop, you will need to know the IP address assigned to the RPi.
You could always hunt around on your devices or look on your router
pages to find the number. BUT next time you boot your devices you may
get a different IP.
Also you can get IP conflicts if 2 or more devices think they have the same IP address.
To avoid this I reserve IP's so that the devices always get the same IP.
Note this is not quite the same as setting up static IP addresses.
No configurations normally have to be done on the device itself as you would if you were to use a static IP setup.
Some applications may have IP addresses stored in configuration files.
If your IP changes then they will stop working:
- Web Server
- NAS (Samba)
Also if you use port forwarding then that system always meeds have the same IP
Router Setup Page
The screen shot below is the main
setup page for my Linksys router. It is accessed via any internet
browser by entering http://192.168.1.1
the default for Linksys routers and many other routers.
Other routers may default to 192.168.0.1. Check with documentation that
came with your router. Some routers may have the IP labeled on the
bottom or back of the router.
Look at the DHCP Server Setting area and note the following:
DHCP Server - Enabled
Start IP Address: = 192.168.1.100
Maximum Number of Users = 50
IP Address Range = 192.168.1.100 to 149
- Your setup may be slightly different. The start IP address could
be 192.168.1.5 or 192.168.1.25 etc. (Any number between 2 and 254 are
- Be sure you have enough users to accommodate all the equipment that may connect to your network at the same time.
- Note the IP address range then click the [DHCP Reservations] button.
DHCP Reservations Page:
In my example above the first 3 systems are not reserved. The router gives out IP's in order of how they were switched on.
To reserve a device:
- Click the Select box next to the device you want then click [Add Clients]
- The device will now show up on the Clients Already Reserved section.
- Change the IP in the Assign IP Address column to suit your needs... staying within your IP range.
(I like to have my reservations above the non reserved devices but it is up to you).
- Save Settings.
- You may need to reboot your computers or devices as well.
Now the RPi and other reserved devices will always get the same IP numbers.
Port forwarding is required when you want to connect to your RPi from outside your local LAN.
SSH, FTP or Web server etc.
On the Linksys router log on and go to the Applications & Gaming tab & then Single Port Forwarding sub tab.
My RPi has an IP address 192.168.1.123 yours may be different.
I have opened these ports for my RPi:
21 for FTP
80 for HTTP (but my ISP does not allow this)
86 for HTTP (I have chosen another port for HTTP Web Server)
22 for SSH (but not enabled at this time)
After your router is configured you may want to test your setup.
You can go to one of the many on line port scanners and scan your ports to see if they are open properly.
Note that some ISP's will block ports such as 80, 21, 22 etc. If so you will have to use non standard ports.
Be sure you don't attempt to use a port which is already in use by something else in your system!
Here is an on line port scan tool I like:
Or search [port scan tool].