On 08/21/2017 07:07 PM, Gene Heskett wrote: > On Monday 21 August 2017 12:11:38 Christian Seiler wrote: > >> On 08/21/2017 05:03 PM, Gene Heskett wrote: >> iface eth0 inet static >> address 192.168.0.1/24 >> address 192.168.0.42/24 >> address 10.5.6.7/8 >> >> This will work, and it will assign all IPs to the interface (the first >> one being the primary and the source IP of outgoing packets where the >> program doesn't explicitly bind anything). And "ip a" will show all >> three addresses, but "ifconfig -a" will only show the first. >> > Ok, but then how do you differentiate between the addresses without > the :1 [:2 etc] notation?
I don't understand the question? Where do you want to specify an address? When removing the address you just say "remove address XYZ from interface ABC". > It doesn't seem right that is would bang all the assigned addresses with > duplicate data. I don't get what you mean here. What is duplicate? If you open an outgoing connection by default the primary (first) IP that matches the outgoing subnet will be used as the source IP for that connection - but a program can override that by binding the socket to any of the other IPs of that interface. In the above example: any connection to 192.168.0.23 will by default carry the source IP 192.168.0.1, and any connection to 10.1.1.1 will by default carry the source IP 10.5.6.7. An application can create an outgoing connection with source IP 192.168.0.42 by explicitly binding the socket to that IP before making the connection. Which is kind of similar to alias interfaces: with alias interfaces the route metric of the alias interfaces relative to each other defines what IP will be used by default, but again it is possible for an application to override that by binding the socket to a specific IP address. And incoming connections are trivial anyway in these setups. >From the point of view of applications that just use the socket layer (and don't care about network interface names) the system will react in the same way whether you use multiple addresses per interface or whether you use alias interfaces. The main differences are in how it is configured and how the kernel code works. Regards, Christian