I have a server running Ubuntu Server with four IP addresses aliased on a single NIC.
eth0 192.168.1.100
eth0:0 192.168.1.101
eth0:1 192.168.1.102
eth0:2 192.168.1.103
(Using 192.168.x.x for sake of example, assume these are NAT-ed to a range of public IP addresses)
One of our clients publishes their inventory via FTP, so we log in nightly to download a large file from their server. Their firewall expects our (passive) FTP connection to be made from 192.168.1.100.
Given that my server logically has four IP addresses on a single adapter, how does the operating system determine which IP address is used as source for outbound TCP/IP connections?
Let's say I ssh into my server on 192.168.1.101 and run FTP interactively. Will the outbound TCP/IP connection use 192.168.1.101 because the OS knows that's the interface over which my shell is connected?
What if the FTP task is run non-interactively via a cron job where there is no shell?
As you can probably tell, this has me quite confused, so I hope my questions have at least made sense.
Edit
To clarify why I'm asking -- I haven't made any changes to the routing table and it actually lists 'eth0' as the IFace for the 0.0.0.0 routes. However, all indications are that it is actually using eth0:0 as the source.
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 eth0
I can fiddle with the routing table or have our client change their firewall rules to get the behavior I need, but I'm trying to gain a little insight into how this works to know if there's a bug in the OS or just my naive understanding of how all the pieces fit together.
Thanks