Click here to Skip to main content
15,885,767 members
Articles / Routers
Tip/Trick

Giving Your Devices Constant IP Addresses

Rate me:
Please Sign up or sign in to vote.
4.33/5 (2 votes)
21 Oct 2015CPOL5 min read 15.8K   3  
Giving your devices constant IP addresses

Introduction

I have a standard wireless router provided by my internet provider Telus. It's an Actiontec V1000H. Even this device supports setting up permanent IP address, so the chances are, yours probably has that feature too.

What is an IP Address?

An IP address is an Internet Protocol address.

Each device on a network must have a unique network address in order to differentiate itself from other devices on the network. So think of an IP address as a devices telephone number on your home network.

Lots of devices are now connected to your wifi/network router, these now include your TV set, DVD/Blueray Player, Games Console, Mobile Phones, Tablets, PCs, Laptops, Hifi Receiver, Home Entertainment system, etc. And all of them have at least one IP address. I say at least one, because some devices can have more than that.

Consider your PS4, it has 2 routes through which to connect to your router and thus gain access to the internet and/or other devices on your home network, the first route is through its wired connection, and the other is through its wifi connection. Each one of these routes goes through a piece of networking hardware inside the PS4.

Each piece of networking hardware in your device has a MAC address. This is a permanent and globally unique identification number. Number with letters in ? Yes it's a number, but it's not in base 10 (decimal), it's in base 16 or hexadecimal (0-9, then 10=a etc f=15). So this MAC address is almost guaranteed to be unique in the whole world, the network router uses this MAC number to identify the device and give it an IP address so that all devices on the network can talk to each other through the internet protocol (hence IP address).

So each device has one or more MAC addresses and each MAC address is given an IP address by your router. When a device connects to your network, either wirelessly or through a cable, the router gives it an IP address randomly. That's why every time you plug in a device to your network, it ends up with a different IP address. If we want to connect to a certain device through remote desktop, VNC, SSH, ftp, etc. we want to know the IP address every time.

Note that the IP address given to your device is a local IP address only, that is, its context is on the LAN (Local Area Network) it is connected to. So this IP address is not your devices IP address on the internet, you will not be able to connect to that device from the web with that IP address. That's a more complicated task and beyond the scope of this tip.

Let's Go !

Ok, first of all bring up your web admin page for your wifi router. Don't have one? Check your instruction manual online (there are lots of instruction manual web sites), the chances are your router does have a web portal or admin page, even if you don't think so.

A good way to discover the IP address of your wifi router and hence its URL (or admin web page address), is to bring up a command shell in windows/linux and ask for the network info. On Windows goto Start->Run->cmd.exe, now in the command shell type:

ipconfig

Here is an example of the output of PC:

Windows IP Configuration

Ethernet adapter Ethernet:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 3:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . : telus
   Link-local IPv6 Address . . . . . : fe80::9910:XXXX:8b88:9956%4
   IPv4 Address. . . . . . . . . . . : 192.168.1.68
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.254

Ethernet adapter Bluetooth Network Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Tunnel adapter isatap.telus:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : telus

Tunnel adapter Teredo Tunneling Pseudo-Interface:

   Connection-specific DNS Suffix  . :
   IPv6 Address. . . . . . . . . . . : XXXX:0:5ef5:99fb:XXXX:27a6:3a57:fabb
   Link-local IPv6 Address . . . . . : XXXX::241a:20a6:XXXX:febb%9
   Default Gateway . . . . . . . . . : ::

From here, we can see my routers (Default Gateway) IP address is 192.168.1.254, ok type that in your web browser in the address text entry box. for me this brings up my routers web admin page, like I said before check your manual, your router may have its admin page hosted on a different address.

For linux/unix OS, simply type:

ifconfig

Discovering the Device MAC Address

You will now need to find the MAC address of each device. The best way to do this is to look at the web admin  page of your router, and turn off the device whose MAC address you want to know, then write down what MAC addresses are already connected, then connect the device. Obviously the new MAC address will be your devices MAC address.

Reserving an IP Address for a Specific Network Device

From the MAC address of your device, we now allocate a specific IP address, so that every time the device connects to your home network, it will be given the same reserved IP address.

For most routers, you need to look for a settings page/tab called DHCP Reservation. For me, I have to log in to the device first, then go to my Advanced settings, from here, I can open the DHCP Reservation page.

On this page, I select the MAC address of my device and give it a specific IP address. I use numbers such as 192.168.1.100 for my PC, 192.168.1.101 for my Raspberry Pi, 192.168.1.102 for my goflex network drive, etc.

Conclusion

So you can now set a device to have a static IP address on your home network, no more searching for IP addresses!

Another benefit is to only allow the MAC addresses you recognize (i.e., your own network devices) to connect to your wifi (use the security page of your router). That way, anybody who knows/cracks your wifi router password cannot connect to the internet through your router, so no more strange old men sitting in cars outside your house!

Happy networking!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
Canada Canada
I have a blog here

http://www.electricalengineeringschools.org/blog/

And my robotics web site is here :

http://www.roboticsfordreamers.com/

I have been a software engineer for over 20 years now. I'm an expert in writing scalable restful web API services, which I've been doing for over 7 years now for games companies such as EA and Ubisoft. I've also worked on several video games, including Skate 2 and 3, NHL, Need for Speed, various Assassins Creed games, Far Cry 3 and 4, Driver San Francisco and most recently with a team of 15 on EA's UFC free to play. On this latest project I designed, implemented, tested (including load tests in Gatling and JUnit on AWS), deployed and supported all the web services for the game client, supporting up to a half a million active sessions.

I am proficient at programming in C, C++, C#, Java etc. I've developed many types of games, applications, SDKs and web services in Linux, Unix, iOS, Android and Windows.

My spare time is spent teaching and lecturing computing languages and science. I have a PhD in Artificial Intelligence (specialising in knowledge representation - Semantic networks with inference engines).

Currently I am also building an A.I. general purpose robot. The brains behind it are a mix of 6 Raspberry Pi and Banana Pros, with 2 USB cameras, SATA drive, Router Switch with inter-pi Comms, 2 motorised track systems, plus various sensors including motion/pir/sound etc.

The six pi's are split according to functions, including eyes (image processing/recognition), ears (speech processing and simulated speech),motor (object avoidance, environment mapping, drives all movement), entertainment (web browsing, media playing etc), brain (knowledge system, and adaptive learning/memory systems) and development system ( logging, diagnostics, debugging).

I am available as a consultant, so if you need to get something out the door quick, or want to set down an expandable and resilient framework, ping me !

Comments and Discussions

 
-- There are no messages in this forum --