2

I'm running a home server inside my NATed LAN, which is connected to the Internet through a D-link DIR-652 home router. I have specified the necessary port forwards at the router settings and have everything working.

However, recently I had some downtime because the DHCP server on the router had changed the server's private IP address on its own, and the forwards etc. stopped working. To prevent any trouble in future, I decided to make the server's private IP address static. It works sweet and there seems to be no problems in practice, but I'm troubled with one thing: how does the router know the static address, now that it doesn't assign it by itself through DHCP? How do routers generally know, is it just specified by hand in the routing table or is there some protocol that hosts who know their own address use to broadcast it to everyone else?

Is there any chance that my router "forgets" my server's IP address, causing downtime again? Do I have to configure the routing table to ensure that it won't break in the future?

3 Answers 3

1

In the IP settings, when you specify the Default Gateway, you usually use the routers local IP address (e.g. 192.168.0.1). This is how the router knows the static IP address assigned to your server. You shouldn't have to change anything else in order for the router to "remember" your servers IP address.

2
  • Allright, so the router just gets the info from the IP packets sent form the server. Hypothetically speaking, what if there weren't any outbound traffic from the server for a long time?
    – GolDDranks
    Commented Oct 1, 2013 at 21:04
  • Not sure if that makes a difference. If it was assigned an IP address through DHCP, it would be on a fixed lease, meaning that the IP address assigned to it would likely be released after a given time period (of inactivity). Because you have assigned an IP address statically, this shouldn't be an issue.
    – Yass
    Commented Oct 1, 2013 at 21:07
1

You can reserve an IP address based on MAC address (= a unique text string that identifies each hardware device).

According to the manual of your router (page 31, DHCP Reservation), you have that option. The only thing remaining is to find the MAC address of your ethernet/wifi network device. The manual also shows that it has a button to copy your machine's mac address.

3
  • I had actually an IP reserved for the MAC address of the server. Why it got changed beats me... Maybe the router firmware is just buggy.
    – GolDDranks
    Commented Oct 1, 2013 at 21:08
  • If you reserved an IP, then perhaps you changed the network device? The MAC address is different when you use Ethernet "Some Brand/Model", Ethernet "Some Other Brand/Model", or Wireless USB dongle. Commented Oct 1, 2013 at 21:16
  • Now that you mention it, I actually did :--D I know that the MAC address is different for different devices but I somehow managed to overlook it. Thanks for pointing that out.
    – GolDDranks
    Commented Oct 1, 2013 at 21:56
1

Your router does not "know" anything about the IP address of your statically assigned IP address. As yassarikhan786 mentioned, your server knows about your router because of the default gateway that you setup in the IP settings, however the router does not learn about your server from traffic coming from the server (because of the question you raised in the comments).

The router just uses the rules of IP to figure out how to communicate with your server. All the devices on your network use a netmask in their IP configuration (usually something like 255.255.255.0). This netmask is how the router knows your server's IP address is on the network. At that point, if the router wants to communicate with your server, the router uses ARP to lookup the MAC address of your server and then sends the packet.

So, to answer your question, no, the router won't "forget" about about your server, it doesn't know about it in the first place, but it does know how to find it if they need to communicate. And no, you don't need to configure routing tables either.

3
  • Nice explanation :)
    – Yass
    Commented Oct 1, 2013 at 21:42
  • Thanks for the explanation! So basically, when we talk about "routing", it generally means routing between networks, not between individual hosts, right? And ARP protocol (which I have heard of, but didn't know too well about) is used to resolve the IP addresses to MAC addresses. Got it! Thanks!
    – GolDDranks
    Commented Oct 1, 2013 at 21:50
  • Exactly! Routing really only comes into play between networks.
    – heavyd
    Commented Oct 1, 2013 at 21:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .