[Nottingham] NIC MACs aliases & IP aliases
Mike Cardwell
nlug at lists.grepular.com
Fri Mar 27 09:23:12 UTC 2009
Graeme Fowler wrote:
>> And... Is there a simple way to set the source IP address of outbound
>> packets to be from a particular IP alias (and MAC alias)? Or must
>> individual routing "via" commands be given for each case?
>
> If you have two IP aliases, return traffic for sessions established on
> them as destinations will always be answered by the address the request
> arrived on (or the TCP handshake would fail).
> If you want to initiate sessions from different IP addresses according
> to some sort of policy, then usually the application manages that itself
> (like the "interface" option to Exim's "remote_smtp" driver).
>
> You can, however, use the iproute2 toolkit to classify traffic as it
> arrives and make sure it always leaves via a specified upstream router.
> This, however, is *not* for the faint of heart and successful boot-time
> setup varies according to distro of choice...
You can also use iptables to do it. Eg, if you wanted all outgoing SMTP
connections to come from the ip alias 10.0.0.1, this works:
iptables -t nat -A POSTROUTING -p tcp --dport 25 -o eth0 -j SNAT
--to-source 10.0.0.1
Mike
More information about the Nottingham
mailing list