Static IP Address.
how to get one..
This page describes how to assign a "Static IP" to your local computer. If you are looking to get an external static IP, that is; a static IP for your whole internet connexion; see the notes at the foot of the article for more details, and also this post.
What is an IP address?
An IP address is like a telephone number that any computer can use to find any other computer in a network. All networked computers have IP addresses. Most have a static ip, that is, they don't change (for instance, at the time of writing, Google is 64.233.183.147, and typing http://64.233.183.147/ into your browser will take you straight to Google. That is Google's "public IP", aka. "external IP" (one of them), behind their NAT are probably thousands of separate machines, each with different "private" IP's (probably static, or more likely a mix of dynamic and static IP's), 192.168.1.1, 192.168.1.2, etc., we don't see those. But some IP's do change..Home computers, by default, are set to get their private IP address dynamically from your gateway device (router), via dhcp, In other words, the router supplies a private IP address for your computer to use, temporarily (your router is probably doing NAT, too, and needs your computer to have an IP address, so it knows where to send your data packets). However, dhcp is not an ideal setup; if there is any interruption in the computer's network connexion to the router (you reboot your PC, for instance), a completely new IP address may be assigned1.
For general (beginner's) use, dhcp is just fine, because it's easier; generally works "out of the box", requiring no configuration at all. But if you want to do more; run servers, p2p applications, interesting communication devices, etc, you'll be creating port forwarding/NAT rules on your router, to direct incoming traffic to a particular computer (the one running the server), and if you want those rules to be effective past your next reboot, you will need to get a static IP on your computer, so that the incoming data packets can still find you. Imagine the fun your friends and family would have contacting you if your telephone number changed every day!
okay, let's do it!
Okay, so you understand why you need to get a static IP, (apart from the obvious "cuz I want to forward my ports!") it's time to move on to the how part."Private" IP addresses usually begin with 192.168** and must be on the same "subnet" that the router is on, in other words, 192.168.1.something, and NOT 192.168.4.something. Only the last number will be different from the address of your router which by default (at least for Voyager routers), lives at 192.168.1.1. 192.168.0.1 is also common.
** There are other private ranges, too, but most people don't need to know about those, 192.168.1.something is what most folk use, and though thousands of millions of machines in the world have 192.168.1.something as their private IP address, they don't interfere with each other because they are behind NATs and other gateways; from the outside, we only see the public IP address, aka. "external IP".
HOWEVER, if your router uses 192.168.0.something, or 10.0.0.something, or something else from the private IP ranges..
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
..then don't hesitate to use THAT instead of the 192.168.1.something addresses I use in my examples, that's what most routers use, but not all. Do check.
The best way to know what subnet your router uses, and thereby which IP to use, is to look and see what IP it has currently assigned to your computer. In Windows, it's in the Support tab of the connexion's Status dialog. A netstat command will get you the same information (and more) on most platforms, perhaps netstat -n. Your router's web interface will likely have all this information, too.
Remember to disable dhcp in your router before you start assigning static IP's.
Alternatively, somewhere away from your regular static IP's, handy for guests and what-not, perhaps 192.168.1.50 - 192.168.1.99
Fortunately, assigning a static IP is very easy to achieve, and the same principle applies to every computing platform, the only real difference being where to apply the settings. I'll start with the trickiest..
Windows®..
The dialog you are looking for is here..Control Panel >> Network Connections >>
Local Area Connection >> Properties >> TCP/IP >> Properties*phew*
In other words, open the control panel, open Network Connections, right-click the "Local Area Connection" (unless you've renamed it to something else) and chose "Properties", then (in the "general" tab) select "Internet Protocol(TCP/IP)" and click the "Properties" button. Check the "Use the Following IP address" checkbox and enter your desired IP address. If you use 192.168.1.3 as your IP address, the dialog will look something like this..
..which is a clever screencap, showing you just how to get there. When you're done, okay everything to close all the dialogs. It's smart to use 192.168.1.3 as your address, especially if you plan to use any of the ready-made script kicking around here.
I you are plugging your computers into a network switch (Good Idea!), it's also smart to plug each machine into its corresponding CAT-5 socket, router (192.168.1.1) into the first, 192.168.1.3 into the third, and so on, so you can see which is which at-a-glance.
Mac OS X..
What you need is in the "Network" dialog of the System Preferences, and will look something like this..
Simply click the drop-down menu for "Show", and choose "Built-in Ethernet" to get that screen, enter all the details as above. Click "Apply Now", and you're done!
Did you notice that on the Mac, you enter the Router's address into a space labelled as "Router", whereas, on Windows, you enter it into a space labelled "Default Gateway"? But then, the space for DNS servers is clearer in the Windows box. Seems we all still have a lot to learn from each other.
Linux..
This probably isn't necessary, most Linux users know how to alter this stuff, but I suspect one or two may not. Usually you need to edit some plain text file (as root). On some Linux systems, the settings will be in /etc/rc.d/rc.inet1 (or whatever interface you are using), or possibly /etc/network/interfaces. I guess it might look something like this..
Usually, your distro will have a utility for setting up your network, and one of the first things it will ask you, after you tell it you want "manual" and not "automatic" configuration, is what IP address to assign to the machine. It's usually called something like "Network Configuration", or "inet configurator" or whatever. you'll find it! In a shell you can probably do "netconfig", "netcfg", "Ifconfig", "neat", or "netset" (depending on your distro). Same story for Unix, Solaris, BSD, etc..
That's it!
From now on, your machine will always be reachable at your chosen address. NAT rules will be permanent, and you can dabble in all sorts of interesting and esoteric communications devices, servers and p2p applications.If you have a few computers on your private network (LAN), you might want to consider giving them all names to go with their permanent addresses, so you can reach them by typing "workshop" or something into a telnet session/web browser/whatever. You could telnet to your router by simply doing
telnet router, for instance. If you develop web sites, this is near essential. See here for more details.If you like, you can leave feedback (I thought it was about time this page had comments of its own - folk are coming straight here from the search engines, and it's getting popular!). If this page didn't help you, tell me about it!
Have fun!
;o)
(or
notes..
- If you were actually wondering how to get a static IP for your whole internet connexion; aka. external IP, aka. "WAN IP"; perhaps to run some live website or interesting server from your home or office, well, that's not something we mere mortals can do from our side of the router. You will need to talk to your ISP. Note: Not all ISP's offer this service, and those that do will usually charge a premium. However..
Most people do not need this!
Even those that think they do, or have been told they do. Perhaps you simply need to get yourself a dyndns.org or no-ip.com address, and a DUC.
- Note: you can always get your current external IP address, in plain text, right here. Very handy for automatic shell scripts, and more. Right now, it's 38.103.63.61.
references:
1. This is very similar to the way you get a new external IP whenever you dial-up to the internet (some folks still do that) or disconnect your ADSL for a few minutes2 (less scrupulous net citizens use this "feature" regularly!).
2. Although it's usual to get a new external IP when you reconnect your DSL, it's not guaranteed. With some ISP's it happens rarely, with others you need to disconnect for a few minutes or more, with some ISP's, you always get a fresh IP with each connect, nomatter how quickly you do it. One thing is certain, though; unless you are paying them for a static IP, your current external IP address will change!
3. Remember, your external IP, and your local computer's IP, are two totally separate things (well, in this context). Almost no one needs a static IP for their external connexion, but almost everyone who wants to run peer-to-peer applications, ftp servers, and so on, will need a static IP for their local computer. The former is supplied by your ISP, the latter is down to you.
2. Although it's usual to get a new external IP when you reconnect your DSL, it's not guaranteed. With some ISP's it happens rarely, with others you need to disconnect for a few minutes or more, with some ISP's, you always get a fresh IP with each connect, nomatter how quickly you do it. One thing is certain, though; unless you are paying them for a static IP, your current external IP address will change!
3. Remember, your external IP, and your local computer's IP, are two totally separate things (well, in this context). Almost no one needs a static IP for their external connexion, but almost everyone who wants to run peer-to-peer applications, ftp servers, and so on, will need a static IP for their local computer. The former is supplied by your ISP, the latter is down to you.
Useful Links..
Your current external ip address, in plain text. Always avaliable. Handy for scripting.
What was your external IP before you reconnected your DSL? Handy.
My handy port probe - instantly check if your server or p2p app is receiving connexions.
Highly useful free IP scanner - handy for finding lost puters and routers on your LAN.
Troubleshooting..
A number of things can go wrong when trying to configure a static IP on your local machine.The most common issues are..
- A second network adapter on your computer already has that IP address assigned to it.
Note: Firewire (aka. 'IEEE 1394') adapters usually get automatically setup as network adapters in Windows. - Another computer on your local network already has the IP you are attempting to assign.
- You do not have sufficient security privileges to make such a change (i.e. not admin)














When I do all this, there is nothing filled out in the Local Area Connectoin
Very interesting, Bob.
What are you talking about?
;o)
(or
I have just speed read the bulk of this Info/Blog and it appears to be what I need to setup my new router. A job well done for the creator and/or web host.
Thanks for the excellent work.
u.a.e. UNITED ARAB EMIRATES . . . that's where Dubai is and where I am now. Anyways, the internet providers here block skype (most VOIP) access...and apparently by adopting a static IP address...which identifies the computer as being ?somewhere else on the planety(?) . . .you can still make voip calls...
does this make sense?
and, is there something i can easily download that will set the ip address?
Thanks.
Jonid
I didn't read all the comments posted, but HUGE thanks for this great page on setting up a Static IP address in the context of routers and switches.
I always understood the concepts, but now I am trying to creat a static IPs for my work's server network so that we can have greater access and communication between hosts and clients.
It is really the best thanks for your good site it is all...
I dont understand anything....Maybe because im ten. Please help me I wanna play with my mate...
Hey,
I'm only mildly computer literate, but I just got a new Macbook laptop. We installed a wireless router, and I can connect to the network but not the internet. My mac keeps telling me that "AirPort does not have an IP address and cannot connect to the Internet" Is this something I can fix with a static IP address? I tried to follow your instructions for the Mac, but since mine is a wireless router, I guess that's why it's different. What's your advice?
Hey (or,
I want to know details of IP address, can u please send me some links and UR valuable comments.
one thing more I have a broadband service which is not giving any Static IP but I need to avail it, is there any software which help me.
To sknarfenilorac:
Make sure that your wireless router is set to Dynamic /DHCP unless your ISP gives you a specic set of IP for Static. Because even though your accessing a wireless connection, for a Dynamic connection, it automatically assigned to ur laptop an ip address range to ur router. I assume that you know how to configure the settings of your router.
Hope it helps,
Grace
To subrato
Contact first ur ISP provider if u can avail the Static ip address. I believe that most corporate companies use this Internet Connection type ( STATIC ) because of many hosts they have. Unlike for DYNAMIC which usually home computers have.
Regarding using a static ip behind a router. You are the only one of the many instructions I have read that got it right. If your router is 192.168.1.x
Then your static IP for your network card must be 192.168.1.x. I kept trying to set it up as 192.168.0.x.
Thanks so much for your thorough explanation. To bad microsft can't do as well.
Stan Ralph
I am in the process of setting up my own network. I have bought the additional hardware, and was a bit lost with regard to static ip's/ip address blocks. I read this post through and there it was, the part where you explain that the external ip and internal (local) ip are two separate things. I subscribe to 8 ip address block through my isp, and they have given me the range to use, and explained that the reason for 8 being available and only 5 usable is that the modem router takes the first two, and the last one.
It goes on to say that I can specify one of the remaining as the port the VPN uses. I take it that this done during setup of the VPN router? Anyway, your posts were of great help and I'll try and set things up tomorrow morning. If any one would like to know how I get on and the hardware used, just say.
Cheers.
very useful, thanks.
can anybody suggest how to set static IP address in linux programmatically.is there any API for it
barney, certain types of DSL connexion pass-through the internet hand-shaking directly to the individual computers, and each computer gets a direct connexion to the net, with its own External IP.
You could assign only one of the available 5, send it to a second router/firewall, and then via that, dole out up to 255 private IP's inside your internal network all sharing the same external IP (assigned to router 2). An IPCop box would be ideal right here.
Or you can connect all your computers directly to the broadband device (assuming it has the physical capability for multiple connexions), and assign different external IP addresses to each computer. It all depends on how secure your broadband device and individual computers are, and what hardware you have available, though either setup would work.
stanralph, if you can, cast your mind back to Windows 98 networking; it was a black art, a mess of confusing dialogs, endless restarting, and pure luck. Microsoft has gone a long way to make things easy, and today's networking is mostly plug-and-play, and so long as you understand the basics of what a network is, what an IP is, and how they relate to each other, you can probably connect any device to any other device with no more than Cat-5 and common sense.
I agree, it could get simpler yet, but still, it's no longer rocket science.
aswe, the configuration files are plain text. And Linux/UNIX comes with a huge kit-bag of plain-text-altering tools that can be controlled with simple shell scripts, as can the services that control the network adapters themselves.
Your shell scripts can be activated in a number of ways; at startup, shutdown, on a repeating schedule (cron), and so on. You already have all the tools you need. Start with this command, in a *nix shell..
man bash
;o)
(or
cor,
Thanks for the reply, I have my new hardware and the setup now consists of:
D-LINK ADSL ROUTER connected via WAN to D-LINK VPN ROUTER
DESKTOP RUNNING XP
LAPTOP RUNNING XP
QNAP TS209 NAS SERVER
As the VPN Router has 4 ports then your second option of an individual connection/ISP to each device seems feasible. Would this setup compromise security in any way?
cheers
Well Barney, I know enough about the underlying architecture of modern operating systems to never connect Windows boxes directly to the net. But that's just me, and I know that many people do exactly that, every day. I also know that a great many of these machines regularly crash, fall over, get infected, become unwitting participants in bot-nets, and worse. Hardening Windows is a task that few people undertake, at least thoroughly. There are better alternatives..
My advice would be to put everything behind the D-Link, and secure that (it probably has lots of Cat-5 sockets and such, anyway). Sure, it's nice to have all those extra external IP's, but unless you actually *need* them, it's probably not worth the risk, hooking them up, at least not to your regular machines (though they could be fun for other things*). Also, if you don't actually need them, you could maybe get rid of them, perhaps get a cheaper plan from your ISP.
If your boxes were BSD or something, it would be a different story, even without firewalls. As for Windows; Vista is more secure than XP, but not so much as to be worth the upgrade, IMHO. Windows can certainly be made fairly secure, but whatever you do, it's still not going to be close to the level of security afforded by a dedicated gateway, and intelligent network segmentation.
The D-Link probably has a decent firewall you could enable; do that, and you have a secure gateway device. It may have wireless, too - you didn't mention the model - as well as other useful services; DHCP, time server, caching name server, NAT, and so on. As I love to say; true security is in the mind; and a solid gateway goes a long way towards creating this state of mind; knowing that their are at least two distinct and separate networks, with our data "in-side", and everything else, "out-side". Security-wise, the more hops between you an the WAN, the better.
With a secure gateway, you can connect any old device to your LAN with no concern for its individual security status (remember; if a secure device shares files and logins with an insecure device, it too becomes an insecure device). Also the LAN will likely be considerably easier to setup, and join.
Both ways are doable; it all depends on what you need.
;o)
(or
ps. if security is a concern for you, don't forget physical security. I still get a laugh, thinking about a mate of mine who spent a shit-load of money, not to mention many hours setting up a "totally secure" NAS, which turned out, after a fairly crazy party, to also be totally portable!
A spare external IP would be handy for testing all sort of things. It's definitely a great way to find out if a particular system's firewall works! And for free; all you need is a tempting honey-pot! But for actual workstations, behind a gateway is usually best.
This site is great , i gives me practical knowledge of trouble shooting and also navigation screens of the computer, thank u.
cor,
From your previous post and if i've got it right, my best bet is to assign a static ip to the dlink vpn router (DI-804HV) which is connected by to the net via a D-LINK DSL 504T. I have the pc's connected to the Cat-5 sockets on this. Would this setup allow me to connect remotely and securely with the QNAP server? I do appreciate your help on this and maybe it's helping others also?
Cheers
Hi there, I am currently using a Mac and a XP both connected to this router. My Mac is the host machine.
I have a printer installed in XP, and I want to get my Mac to use that printer. I use the local IP of the XP machine to do that. But it always changes. Is it possible to get my Mac using a dynamic local ip address and my XP a static one, so that I can always connect to it without any problems to do any printing jobs?
Hope to hear from you soon.