The meaning of your first question is not clear. Yes a router can have 2 IP addresses. This can happen in several ways. If a router has 2 interfaces and each interface has an IP address then the router will have 2 IP addresses. Or a router can have 1 interface and on that interface can configure a primary IP address and a secondary IP address.
Your second question seems to indicate that your question is really about secondary addresses. Perhaps an example will help to explain what this is and how it works. So if we have an interface:
and on that interface we configure:
ip address 172.16.1.1 255.255.255.224
this would be the primary address. And then we could configure:
ip address 172.16.2.1 255.255.255.224 secondary
and this would create the secondary address. When we do this it makes 2 different subnets to be active on that interface at the same time. So the router will treat all devices in subnet 172.16.1.0/27 as locally attached and will also treat all devices in subnet 172.16.2.0/27 as locally attached.
FYI: An interface can have more than two IP addresses. Each additional IP address is applied to the interface using the secondary argument.
To enable to the router's (Ethernet) interface to particpate in multiple subnets. If you're wondering about VLANs, many of the older routers didn't support VLAN trunks.
Since we're on the subject, if those subnets you mention were created as primary and secondary subnets on an SVI, would both those subnets be part of the same vlan/broadcast domain?
I think yes.
You are Spot on. By definition an SVI is a single broadcast domain.
While we typically think of subnets as providing isolation and that devices in one subnet need a layer 3 device to be able to communicate with devices in another subnet, that assumption is not true when there is a primary and a secondary subnet on an interface (including an SVI). Since they are in the same broadcast domain the devices in one subnet would be capable of communicating directly with devices on the other subnet.
Not meaning to be argumentative but I dont think it would be. If you have a secondary and a primary IP address of x.x.1.0/24 and x.x.2.0/24. If x.x.2.255 broadcasts out... it would not be forwarded to the 1.0/24 network. It would actually be dropped. Also, if you consider any traffic that you want to cross, for example you want 2.10 to talk to 1.10... the traffic would need to go to the router.
You are mistaken about this. Your opinion reflects the usual assumption that different subnets are in different broadcast domains. The question in this thread is specifically about what is the case when both subnets are in the same broadcast domain. By definition in a broadcast domain when a layer 2 broadcast is sent it is delivered to EVERY device in the broadcast domain. There is no need to forward from one subnet to the other for the broadcast. So in your suggestion if a broadcast is sent to x.x.2.255 then it becomes a layer 2 broadcast to every device in the broadcast domain, and every device in x.x.1.0 will receive the broadcast.
Cool. I thought otherwise. There is still part of me believing otherwise but the only way or me to prove it is to test in a lab. But, thank you for correcting me.
Thank you. It is, again, a pleasure to interact with you on the forum.
Thank you for your response. I understand your desire to understand the issue in the traditional framework. Most of us have been trained that x.x.1.0 is separate and distinct from x.x.2.0 and that a router is necessary for them to communicate (and the corresponding understanding that a broadcast in one subnet is not forwarded to other subnets). But these are founded on the basic assumption that a subnet is a broadcast domain and a broadcast domain is a subnet (which is how it usually is). But secondary addresses invalidate that assumption.
One of the lessons that I learned as I prepared for my CCIE was to be very careful about the assumptions that are made. I tested in the lab to come to an understanding of what happens when secondary addresses are configured. I hope that you will have a similar learning experience when you put into the lab the configuration of secondary addresses.