Page 1 of 1

What are the side effects of multiple IP addresses on one port???

Posted: Thu Oct 03, 2019 8:49 am
by dazz100
Hi

I have figured out that I can add multiple IP addresses to the eth0 port using the command:

Code: Select all

ip address add 192.168.1.69/24 dev eth0 
and delete with

Code: Select all

ip address del 192.168.1.69/24 dev eth0 
I have confirmed this works on Buster.


I am concerned that the side effect of adding multiple IP addresses to a single port is the risk of generating multiple packets from the port.
If I have two IP addresses on one port, does that cause two packets to be generated for each packet to be transmitted from eth0?
How would I measure this?

Dazz

Re: What are the side effects of multiple IP addresses on one port???

Posted: Thu Oct 03, 2019 9:06 am
by topguy
Is the other ip-address also on the same 192.168.1.x sub-net address ?
If I have two IP addresses on one port, does that cause two packets to be generated for each packet to be transmitted from eth0?
No usually not.
When any program opens a local socket to talk to a socket on a different computer, you bind that socket to only one IP/port combination.

Linux doesnt really much care which physical device this IP-address is connected to ( eth0, wan0, wlan0, ppp0 ).
So programs that choose to send out broadcast packets on all IP addresses will generate double the traffic, but if they need to reach machines on different sub-nets that is necessary.

Re: What are the side effects of multiple IP addresses on one port???

Posted: Thu Oct 03, 2019 9:12 am
by B.Goode
dazz100 wrote:
Thu Oct 03, 2019 8:49 am
Hi

I have figured out that I can add multiple IP addresses to the eth0 port using the command:

Code: Select all

ip address add 192.168.1.69/24 dev eth0 
and delete with

Code: Select all

ip address del 192.168.1.69/24 dev eth0 
I have confirmed this works on Buster.


I am concerned that the side effect of adding multiple IP addresses to a single port is the risk of generating multiple packets from the port.
If I have two IP addresses on one port, does that cause two packets to be generated for each packet to be transmitted from eth0?
How would I measure this?

Dazz

port is an unfortunate choice of vocabulary, since that word has a specific meaning in the context of the IP network protocols. 'interface' would be clearer.


Using IP, data packets are generated for a duple of ip_ address and ip_port, and are passed to an appropriate network interface for transmission. So no, this will not of itself generate duplicates.


To measure for yourself, look at tools like tcpdump or wireshark.


Edit: unintended echo of what @topguy said as I was typing this. Left to show we are on the same wavelength - pun intended!

Re: What are the side effects of multiple IP addresses on one port???

Posted: Thu Oct 03, 2019 10:37 am
by epoch1970
In other words, no side-effect.
Only the normal effects of having an IP address on a network.