PDA

View Full Version : Help with giving my server a static IP address



Brian Ritchie
2007-12-11, 19:06
Sigh. There's just something about networks that gets to me. I decide to make a change. I try to find instructions on how to do it. I follow the instructions. They don't work. Every single bloody time. Anyway...

My network is fully DHCP'd. It all gets turned off each night, at the wall socket (including the SB3). So sometimes when I turn everything back on, the server gets a different IP address; and the SB3 needs a bit of mummying to find the new one.

So: let's assign a static IP address to the server. Every single example I've found online boils down to this: run ipconfig, note current gateway address etc.; pick an IP number that's outside the router's DHCP range (and which isn't the router's own IP :-) ); change the (server's) network settings to static, with these values. Sounds simple.

Well, I tried that. My router's DHCP range starts at 100, so I chose 99. It *almost* worked, without rebooting or power-cycling anything; just a "back one step" on the SB3 for it to pick up the new server address. Great!

The "only" problem was that the web browser on the server stopped working: I could still connect to the router's config pages (phew!) but the outside world no longer existed. The laptop's browser still works OK, so it's not the network... surely?

My first guess was that it was the usual Windows left-hand/right-hand crap ("network status?: network is working properly; OK, use network: what network?" etc.) So I rebooted the server. No change.

Second guess: the router and cable modem no longer agree about which machine is which on my network. (Indeed, the router's DHCP clients list still shows the old IP address for the server.) Power cycle both devices. Still no change. (Well, except that router status now shows *no* DHCP clients, yet both laptop and SB3 are definitely connected and still working... huh?)

In between each attempt are the usual rounds of restoring the network settings (and the occasional reboot for good measure). Turning DHCP back on wipes the static settings, which means having to go through the whole rigmarole all over again. (Not a lot of effort to be honest, but still bloody annoying in repetition.) And there's something about sitting watching a machine take an age to shut down, and then another age to start up again... especially when you know you're going to have to do it at least one more time afterwards.

What haven't I tried? Well, as ever with networks, there are 10 million things I haven't tried, but who on earth can tell which ones are worth trying? I haven't tried going to the main fuse box and power cycling the whole damn house. I haven't tried sacrificing a different breed of chicken. OK, perhaps more saliently, I haven't tried turning everything off and then on again all at once; but by now my patience buffer has run out. Now I remember why I've put off doing this for so long!

So, where am I going wrong? Is the number 99 sacrosanct in some secret way? Maybe power cycling the whole house isn't so far off?

-- Brian

JJZolx
2007-12-11, 19:26
What operating system? What do the IP addresses look like on your network - something like: 192.168.x.x ?

Sounds like maybe you didn't enter the correct gateway address on the PC. This is generally the address of the router itself, such as

192.168.0.1

What is the output of ipconfig now on the PC?

SuperQ
2007-12-11, 19:50
it sounds like windows dropped your default gateway (the router's IP) or your netmask is wrong (which is probably 255.255.255.0)

Please post all the numbers (and what you think they're for) that you know about.. this can give us a starting point for debugging. Also, what brand/model of router/modem do you have.. (we can infer some of the default behavior if we know)

JJZolx
2007-12-11, 19:55
Something else just occurred to me... You may have gotten the IP adress, subnet mask and default gateway correct, but failed to enter any (or entered incorrect) DNS servers on the PC. This is something that the DHCP server would have been telling the PC previously.

Meaning that your PC may still be able to 'get out' to the outside world, but it can't use host names such as 'slimdevices.com'. An easy way to tell is to try PINGing a web server by its IP address and see if you get a response. At a command prompt try (using the address of slimdevices.com):

C:\>ping 207.7.156.2

Run 'ipconfig /all' to see the assigned DNS servers. Run it also on the laptop to see what the DHCP server is handing out and enter the same IP addresses on the PC.

pfarrell
2007-12-11, 19:59
Brian Ritchie wrote:
> So, where am I going wrong? Is the number 99 sacrosanct in some secret
> way? Maybe power cycling the whole house isn't so far off?

My solution to the world of problems is to install a DHCP server on a
random computer in the house, wire the MAC addresses to fixed IP
addresses, and turn off the router's DHCP server. This lets you control
which box gets which IP address. You can even run bind/named locally,
and resolve names to the now fixed IP addresses.

There is a bit of a chicken and egg problem here, you have to make the
DHCP server have a fixed IP address. I bet really smart people can make
this all work with Windows, its fairly easy with any Linux distro, I did
it first with mandriva, then Ubuntu and now pure debian.

Some routers let you assign fixed IP addresses to specific MAC
addresses, so if you have one of them, you don't need the Linux server.
Of course, SlimServer/SlimCenter runs great on wimpy boxes that can't
run modern Windows, so you can move everything to one server.

--
Pat Farrell
http://www.pfarrell.com/

JJZolx
2007-12-11, 20:11
Some routers let you assign fixed IP addresses to specific MAC
addresses, so if you have one of them, you don't need the Linux server.
Of course, SlimServer/SlimCenter runs great on wimpy boxes that can't
run modern Windows, so you can move everything to one server.

Good idea. Ideally, do it on the router if possible. This also solves the problem of getting the correct gateway, subnet and DNS servers assigned to the PC. You just worry about assigning the IP address. Depending on the DHCP server, it will either insist on any fixed IP addresses being _within_ the DHCP pool, or it will insist that fixed addresses are _outside_ of the pool. Make sure you know which it wants.

ftlight
2007-12-11, 20:13
JJZolx wrote:
> Something else just occurred to me... You may have gotten the IP
> adress, subnet mask and default gateway correct, but failed to enter
> any (or entered incorrect) DNS servers on the PC. This is something
> that the DHCP server would have been telling the PC previously.

That's what I was thinking. With most routers you can just enter the
router IP for the DNS address on the PC, and the router will do the DNS
lookups.

--
Bill Burns
Long Island NY USA
http://ftldesign.com

Mark Lanctot
2007-12-12, 08:08
You don't happen to have DHCP on both the router and the cable modem do you? Use only one or odd things like this can happen - it's most natural to use it in the router and deactivate it at the cable modem, but (at least here in North America) often the cable modem is locked out to you because the cable company owns it.

amcluesent
2007-12-12, 12:35
So this how I set me router to control the DHCP range, then I set the TCP/IP properties on the PC's LAN port to assign a static IP address, while using the router as the default gateway and DNS server.

radish
2007-12-12, 12:43
Try setting DNS to 4.2.2.1 and see if that makes any difference.

gcogger
2007-12-12, 13:20
Have you tried Jim's advice? Go to a command prompt and try the following commands and, in each case, see what response you get:

ping 207.7.156.2

ping www.slimdevices.com

If the first version gives you responses but the second does not then we will know it's a DNS problem. If neither gets you a response then we know it is something else.

Brian Ritchie
2007-12-12, 17:23
Thanks for all the suggestions. As ever, it was a PICNIC (Problem In Chair, Not In Computer)...

I was certain that I had the mask and gateway correct - exactly the same values as reported by ipconfig when using DHCP. I was about to post the results of ipconfig before and after setting a static IP. *This* time - and yet *none* of the umpteen times I'd looked before - I noticed that in the second half of the setup dialog, the "obtain DNS server address automatically" radio button had been deselected. Not explicitly by me, but when I chose "Use the following IP address" some lines above.

Setting the DNS / alt DNS to the values reported by ipconfig /all appears to have done the trick. No reboots required (and though the SB3 had gone blank in a huff, a simple power-button, left-arrow then right-arrow did the trick).

Doh! You hit the nail on the head, Jim. In (admittedly weak) defence, I argue that the Windows DNS dialog looks almost the same when the automatic button is selected, and when it isn't, as the DNS details in both cases are blank. And none of the instructions I found said anything about having to set the DNS manually - not even those that were in responses to questions about changing from dynamic to static. I guess they thought it was obvious.

(Which begs the question: why should I? Why can't it be left as automatic? And for an OS that delights in popping up all sorts of irritating and pointless warnings, reminders and confirmation dialogs, why isn't there a network settings paperclip(*) that pops up and says, "You appear to have forgotten to set a DNS address; you must really like IP numbers..."?)

For the record: the server's running Windows XP; the router is a Linksys WRT54G; I don't see any way to associate MAC addresses to IP addresses in its configuration, and so I assumed it had to be set on the server itself.

And yes, when I get annoyed at something like this, it's partly because I just *know* it's going to turn out to be my own fault, and it's really myself I'm annoyed at...

Here's hoping that it all still works when I turn it all on again...

-- Brian


(*) A few seconds' thought suggests that the best creature for a "network assistant" would have to be a gremlin; or maybe a chicken with an axe sticking out of its head.

JJZolx
2007-12-12, 18:15
Which begs the question: why should I? Why can't it be left as automatic?

When you disable getting the IP address, subnet mask and gateway 'automatically' you disable all DHCP. I suppose it _might_ still get only DNS servers from a DHCP server, but I've never heard of doing that. Note that you can do it the other way 'round - get the address automatically but assign DNS servers manually.


And for an OS that delights in popping up all sorts of irritating and pointless warnings, reminders and confirmation dialogs, why isn't there a network settings paperclip(*) that pops up and says, "You appear to have forgotten to set a DNS address; you must really like IP numbers..."?

That's a very good question.

SuperQ
2007-12-12, 21:45
When you disable getting the IP address, subnet mask and gateway 'automatically' you disable all DHCP. I suppose it _might_ still get only DNS servers from a DHCP server, but I've never heard of doing that. Note that you can do it the other way 'round - get the address automatically but assign DNS servers manually.



That's a very good question.

Yes, a very good question.. http://www.ietf.org/rfc/rfc2131.txt

After skimming the RFC a bit, I can't find anything forbidding making a DISCOVER and grabbing the nameservers from the OFFER, without completing the REQUEST and ACK sequence.

It would be very bad to have clients requesting an IP lease, and then not using it from an administrative point of view.

DHCP goes like this: (log from my slimserver/dhcp server)

DHCPDISCOVER from 00:04:20:1a:01:2e via eth0
DHCPOFFER on 192.168.19.140 to 00:04:20:1a:01:2e via eth0
DHCPREQUEST for 192.168.19.140 (bonk) from 00:04:20:1a:01:2e via eth0
DHCPACK on 192.168.19.140 to 00:04:20:1a:01:2e via eth0

So I guess it would work, but would go against the spirit of the DHCP design.

Mark Lanctot
2007-12-13, 07:17
I was certain that I had the mask and gateway correct - exactly the same values as reported by ipconfig when using DHCP. I was about to post the results of ipconfig before and after setting a static IP. *This* time - and yet *none* of the umpteen times I'd looked before - I noticed that in the second half of the setup dialog, the "obtain DNS server address automatically" radio button had been deselected. Not explicitly by me, but when I chose "Use the following IP address" some lines above.

I always wondered why Windows did that - if you specify a manual IP address you must specify a DNS server manually as well. If you specify DHCP then DNS server is obtained automatically, you have no options.

Glad to hear you sorted it out.

Efraim
2008-01-01, 15:42
Although your problem is solved already:

There is excellent alternative firmware available for your linksys WRT54G, all linksys routers in fact.
www.dd-wrt.com

Running this on the router allows setting static dhcp leases based on MAC-address, plus a ton of other options, not available in the default firmware.
I run this on my router, and it works perfectly: stable and fast, no problems encountered.

kidjan
2008-01-02, 14:08
the router is a Linksys WRT54G; I don't see any way to associate MAC addresses to IP addresses in its configuration, and so I assumed it had to be set on the server itself.

I second the vote for third-party firmware. If you have a version 4 or lower WRT54G, you can upgrade the firmware to an open source linux-based solutions. Here are two popular distributions:

DD-WRT (http://www.dd-wrt.com/dd-wrtv2/index.php)
Tomato (http://www.polarcloud.com/tomato)

Both have support for static DHCP leases, which is what you'd need to have your server assigned the same IP address. DD-WRT is perhaps a bit more full-featured, but Tomato has a cleaner, more simple interface. Both of them are substantial improvements over the stock Linksys firmware.

In general, I don't trust SOHO routers as far as I can throw them, but DD-WRT and Tomato are both superb.