Routing packets through specific interface

Rick Stevens ricks at alldigital.com
Fri Nov 2 17:05:19 UTC 2012


On 11/01/2012 07:48 PM, Alex issued this missive:
> Hi,
>
> I have a host with an ethernet interface and an alias that I've
> created. I need packets to specifically be routed through the alias
> interface because that is the IP address the remote host is expecting.
>
> Should I do this using SNAT or otherwise with iptables? Does someone
> have an example they can forward on for routing all packets through a
> specific interface?
>
> Just to be clear, when I telnet to a specific port on a remote host,
> the remote host receives it as the primary interface. It should be
> leaving the source through the virtual IP.

Add a route:

	route add -net <www.xxx.yyy.zzz> netmask <aaa.bbb.ccc.ddd> dev 
<desired-network-device>

Example:

	route add -net 10.1.1.0 netmask 255.255.255.0 dev eth1:0

----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ricks at alldigital.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-    "Hello. My PID is Inigo Montoya.  You `kill -9'-ed my parent    -
-                     process.  Prepare to vi."                      -
----------------------------------------------------------------------


More information about the users mailing list