I learned how to add multiple IP address, based on the Debian instruction here:
Multiple_IP_addresses_on_one_Interface
and thread:
how-do-i-add-an-additional-ip-address-to-etc-network-interfaces
# /etc/network/interfaces
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.42
netmask 255.255.255.0
gateway 192.168.1.1
auto eth0:0
allow-hotplug eth0:0
iface eth0:0 inet static
address 192.168.1.43
netmask 255.255.255.0
auto eth0:1
allow-hotplug eth0:1
iface eth0:1 inet static
address 192.168.1.44
netmask 255.255.255.0
However, I have two curl process running in the same time. And they need different IP address to connect to the same external server. I cannot reboot the machine to switch between IP addresses. What's the best way to let them using different IP addresses to connect to the same server?
Can we make this by playing with IP routing table?