Can the router's ethernet interface have multiple IP's of the same subnet or different subnet mask?
If yes what's the use?
Network Engineering Stack Exchange is a question and answer site for network engineers. It only takes a minute to sign up.Sign up to join this community
Can the router's ethernet interface have multiple IPs of the same subnet
Generally yes, but that may be be limited by the system.
or different subnet mask?
No, not if there's overlap. E.g.
192.168.0.129/25 simultaneously aren't possible because they overlap.
192.168.0.129/24 (same subnet), or
192.168.1.129/25 (distinct subnets) are generally possible.
Overlapping subnets make no sense on a single interface and normally cannot even be configured. Different subnet masks (prefix lengths) are possible for different subnets, however, e.g.
what's the use?
One use is with NAT, when multiple public IP addresses are mapped across the same router and usually forwarded differently. Another use is with services bound to specific IP addresses and using different default gateways. Also, if you're renumbering your network you often use multiple IP addresses for key devices temporarily and route between them.
Note that while multiple IPv4 addresses are not that common, IPv6 uses multiple addresses routinely (link-local, unique-local, global, ...), even of the same type. For instance, you can slowly phase out a changing global prefix while phasing in the new one at the same time.
Juniper router allows multiple IP addresses from the same subnet to be configured on an interface. However, practically only one is chosen to be the primary:
The preferred address on an interface is the default local address used for packets sourced by the local router to destinations on the subnet. By default, the numerically lowest local address is chosen. For example, if the addresses 172.16.1.1/12, 172.16.1.2/12, and 172.16.1.3/12 are configured on the same interface, the preferred address on the subnet (by default, 172.16.1.1) would be used as a local address when you issue a ping 172.16.1.5 command.