How does a router obtain its IP address?
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:
- 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 - typically192.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).
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.