Force local IP traffic to an external interface
Posted
by calandoa
on Server Fault
See other posts from Server Fault
or by calandoa
Published on 2010-03-30T10:05:54Z
Indexed on
2010/03/30
14:03 UTC
Read the original article
Hit count: 381
I have a machine with several interfaces that I can configure as I want, for instance:
- eth1: 192.168.1.1
- eth2: 192.168.2.2
I would like to be able to forward all the traffic to one of these local address trhough the other interface. For instance, all requests to an iperf, ftp, http server at 192.168.1.1 are not just routed internally, but forwarded through eth2 (and the external network will take care of re-routing the packet to eth1).
I tried and looked at several commands, like iptables, ip route, etc... but nothing worked.
The closest behavior I could get was done with:
ip route change to 192.168.1.1/24 dev eth2
which send all 192.168.1.x on eth2, except for 192.168.1.1 which is still routed internally.
The goal of this setup is to do interface driver testing without using two PCs.
I am using Linux, but if you know how to do that with Windows, I'll buy it!
© Server Fault or respective owner