44

So let's assume I connect a secondary router to my first. An Ethernet cable from one of the LAN ports to the secondary router's WAN.

Now, how does my secondary router actual obtain its IP address? Is it through DHCP protocol or any other?

The reason that I ask is that, when my ISP upgraded my 1st router (it's also a modem) firmware, apparently according to them I had to bridge the 2nd router through its LAN interface 4. There's no possibility to assign an IP Address manually to this interface, they started use the concept of "DMZ" somehow misleadingly. However, when I configured the first router to bridge LAN interface 4 like they said – my 2nd router started acting like a switch, even though it was connected through WAN. Although, a DHCP server (Windows Server 2012) connected to the 2nd router works perfectly fine; it receives an IP address from 1st router's DHCP and hands out addresses to its clients.

So perhaps a weird question, but do routers obtain their external addresses differently from DHCP clients? From a theoretical standpoint, routers shouldn't be any different.

4
  • 5
    A diagram would help... Routers (typically) have more than one IP... to which are you referring?
    – Attie
    Oct 9, 2017 at 9:50
  • 5
    Your question is a bit confusing. You say "when that happened", but it's not clear if the "that" is your first router's firmware being upgraded or your second router being configured in bridge mode. What changes did you make in the second router exactly? Oct 9, 2017 at 9:52
  • See update. The bridge configuration was made in the first router, which had the firmware upgrade. Oct 9, 2017 at 9:55
  • Ahh, then my answer is correct and LPChip's answer, though correct about what can happen, does not quite describe what happened in your situation. Oct 9, 2017 at 10:12

4 Answers 4

112

Many people don't realise that a consumer "Router" is usually a number of components smushed into a single box.

The WAN / external ports are typically set to 'auto configure' using DHCP... that is they will ask for an IP address, and then use it. Many people don't care what the external IP is, so long as things work.

Hopefully this diagram will help to clarify some points, and hopefully I've drawn it correctly from your description:

Network

  • Each of the colored IP stacks will typically have a distinct IP address... thus each router will have an 'internal' and an 'external' IP.
  • The Blue IP stack will have an IP address assigned by your ISP. Don't even try to configure it yourself.
  • The Green IP stack will have a private address - typically 192.168.0.0/24 or similar by default. You are free to configure this.
    • The "Computer" in Router 1 will likely be running a DHCP server, and will lease addresses to clients on the network in this range. You can disable this.
  • The Red IP stack will follow on in a similar vein to the Blue... it will likely request an address from the service provider (in this case, Router 1).
  • If, instead of LAN4 of Router 1 acting like a dumb switch, you have configured it to act as a bridge, then you might find that Router 2's WAN port will try to get an IP directly from your ISP, not from Router 1's DHCP server... I suspect this is not what you want, as you'll need to have provision from your ISP for two public IPs.
  • It's not clear what you mean by "my 2nd router started acting like a switch"... If you could now communicate directly with clients connected to Router 1's LAN* ports, then as has been mentioned before, this is typical.
    • Router 2 would be 'Masquerading', allowing its internal hosts to communicate with external hosts using it's external IP. This is a standard feature of Network Address Translation.
    • Hosts on Router 1's LAN* ports likely won't be able to communicate with hosts on Router 2's LAN* ports.

As a side note, the "Router 2" block in the diagram above is often marketed as a "Cable Router", as many cable providers will supply their own external cable modem. This is just a marketing term, and it is of course possible to use such a router in this configuration, with an external DSL modem, etc...

Equally, it is possible to purchase a "Router" that contains a DSL modem, or a Cable modem built-in (as per "Router 1" above).

11
  • 3
    The part labelled 'computer', contains the actual router, doesn't it? This is the part that has more than one network interface and connects two networks together. The DHCP server could be excluded, from what we call the router, since that sits purely on the local network and doesn't touch the wide area network.
    – bdsl
    Oct 9, 2017 at 13:29
  • 2
    Correct... but the router software, and DHCP software both run on this "computer"... You'll notice that the DHCP block only has a link to the internal interface.
    – Attie
    Oct 9, 2017 at 14:10
  • 5
    I would argue, that often it's better if you are able to switch the provider's router into bridge mode and do all your network configuration on your own box (configured as a router, not switch), under your control. If you know what you are doing.
    – Edheldil
    Oct 9, 2017 at 16:11
  • 3
    @Prinsig, every time a router requests an IP address by DHCP, it sends some identifying information (typically its MAC address). The DHCP server uses this to ensure that the router only gets one IP address at a time.
    – Mark
    Oct 9, 2017 at 17:51
  • 5
    Your diagram is a very accurate depiction of what is inside a typical consumer router. You even captured a bit of the variations between different models. I think that is a very helpful diagram for those who don't know as much about what is inside such a router. (Of course there are more details, but details of no relevance to the question would have made the diagram less useful.)
    – kasperd
    Oct 9, 2017 at 21:08
4

Typical home or small office routers typically, by default, use DHCP to determine what address to assign to their WAN interface.

I think you're mistaken about your router acting as a switch. Likely, it operated precisely as it typically does -- as a router. It likely was assigned one IP address by your modem/router for its WAN port and it masqueraded for all the clients on its LAN ports, assigning each of them IP addresses by DHCP. This is precisely what it would do if the WAN port was connected to a modem.

2
  • Read the post again. The ISP made the router function as bridged, so in essence the modem is doing all the routing now and the router became a switch.
    – LPChip
    Oct 9, 2017 at 9:45
  • @LPChip That's the opposite of what the post said! The post said his ISP told him that he had to set his router to function as bridged but that he didn't and it still worked. Oct 9, 2017 at 9:50
1

Normally when you have two routers connected together, the second one retrieves its own IP address from the first router, and if you have DHCP switched on in the second router then it will start handing out its own IP address to everything that is connected to it. In the same manner that the first router does from the ISP.

The ISP gives the first router an IP address specifically for that router, then that first router starts dishing out its own IP addresses to any other device that is connected to it (regardless of whether or not the next device is a computer, or another router - the second router should have a specific port to plug into to use this like a WAN port or a "Cable Modem" ethernet port - usually these are separate from the other ports). The second router in the chain should do exactly the same thing: it should retrieve an IP address from the WAN port and then start dishing out its own IP address from its own DHCP server.

If you don't want it to do this then you need to turn the DHCP off on the second router; that makes the second router act like a switch and whenever a new device connects it then goes back to the first router and asks for a new IP address.

The only thing you've got to watch for if you're using the two routers, is that the IP addresses don't clash - usually you'd set the IP addresses of one router to be something like 192.168.1.x and the second router to be 192.168.0.x with subnet masks of 255.255.255.0 on each (subnet masks mark which parts of the IP address belong to which network - 255.255.255.0 means the first 3 parts of the IP address are referring to that specific network and the final digit refers to the specific computer on that network - which ultimately means you can have 255 devices on that router before you run out of IP addresses (192.168.1.0-254 or 192.168.0.0-254) (depending also on what range you set on the DHCP, changing the range and also changing the last number on the subnet mask can reduce this). That way router one would be giving out the IP addresses 192.168.1.x and router 2 would be giving out the IP addresses 192.168.0.x, and you shouldn't have a case where router 2's DHCP server gives out an IP address that router 1 has already given out.

-1

Yes? Pretty sure the router uses the same exact DHCP protocol to get its ip address from the wan link just like any other ip device does. After all, you can plug in your computer directly into the cable modem (those that have separate modems and routers) and use the internet that way.

Anyway to keep it simple, to increase the number of ethernet links or ports using a secondary router, you're going to want to plug in a lan port into another lan port. Then the 2nd router will switch (as a verb) over the frames (which have packets encapsulated in them) to the appropriate destination that's connected on the lan ports. If the frame is destined for the internet, it'll send the frame out the link connected to the 1st router. The first router will assign all the ip address. The 2nd router (acting as a switch remember) will forward those DHCP assignments so all the devices connected to the lan ports on router 2 will get their IP from router 1.

If you like you can access the web interface for router 2, and turn off DHCP (you might actually have to do this step, and assign it an IP address manually. ) Then, you can still configure router 2 using that IP address. It wouldn't have an ip address otherwise, since switches typically don't have IP addresses.

This is the exact setup I have in my house, and it works totally fine.

You must log in to answer this question.

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