Home   >>   Networking   >>   How To Specify IP Address In Outbound Traffic In Linux
How To Specify IP Address In Outbound Traffic In Linux PDF Print E-mail
( 0 Votes )
How To - Networking
Written by Christian Foronda   
Wednesday, 02 March 2011 09:16

If you setup an IP aliases (e.g., eth0:0, eth0:1) on a single NIC, by default the primary IP assigned to the NIC (eth0) will be used as the source IP for all outbound traffic.

Where:
eth0:0 - 172.16.0.10
external host - xxx.xxx.xxx.xxx
external net - xxx.xxx.xxx.x/xx

Specify what IP should be used for outbound traffic on a specific host:

# route add -host xxx.xxx.xxx.xxx dev eth0:0

All traffic destined to host xxx.xxx.xxx.xxx will be routed to eth0:0, thus the outgoing IP will be 172.16.0.10.

 

Specify what IP should be used for outbound traffic on a specific network:

# route add -net xxx.xxx.xxx.x/xx dev eth0:0



blog comments powered by Disqus
Last Updated on Wednesday, 02 March 2011 09:51