0

If a network interface has two different IP addresses 1 and 2 assigned to it. and the port numbers in (IP address 1, port number) and (IP address 2, port number) are the same number, does it mean the same port for two different IP addresses? In other words, do different IP addresses correspond to nonoverlapping sets of ports? Thanks.

Tim
  • 1,545
  • 15
  • 27
  • Port numbers are addresses for some layer-4 protocols (TCP and UDP), and IP knows nothing about them, just as IP know nothing about MAC address, DLCI, VPI/VCI, etc. The network layers are separate. – Ron Maupin Feb 13 '19 at 19:32
  • About your 0.0.0.0 confusion, if you understand IPv4 math, you will understand that 0.0.0.0/0 actually matches every IPv4 address. That is why it is used for a default route. All IPv4 networks are subnets of 0.0.0.0/0, and every IPv4 address is part of that network. – Ron Maupin Feb 13 '19 at 20:19
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer. – Ron Maupin Dec 14 '19 at 20:18

1 Answers1

3

They might and they might not.

Generally, a port X on IP address A (A:X) is different from port X on IP address B (B:X). Think of a port as a subaddress of an IP address. You can e.g. have two completely different web servers running on TCP A:80 and on TCP B:80.

It is however very common that a server application binds its listener to 0.0.0.0:X - port X on any IP address on the local machine. So, on the transport layer the ports are different, but on the application layer they can both be held by the same process with the same function.

The function can also differ by IP address, depending on the application - a web server could serve different pages or an SMTP server could serve different domains or require authentication on one IP but not on the other. A DHCP server would (obviously) serve different scopes.

Zac67
  • 84,333
  • 4
  • 69
  • 133