BollWeevil
Limp Gawd
- Joined
- Feb 9, 2005
- Messages
- 373
Here's the setup. I have a box with two ethernet interfaces, and I want to send packets out one interface and receive them on the other, using a standard TCP/IP stack. This is for the purpose of testing a transparent content filtering product that sits in-line.
Suppose I have a machine with two interfaces which are connected together via a crossover cable. Suppose I assign IP addresses to each and assign static routes specifing the network interface.
ifconfig eth1 10.0.0.1 255.255.255.0
ifconfig eth2 10.0.0.2 255.255.255.0
route add -host 10.0.0.1 dev eth2
route add -host 10.0.0.2 dev eth1
As we all know, if I try to ping 10.0.0.2, packets won't actually be sent across the wire. Instead, the kernel's routing sees that 10.0.0.2 is a local address and routes it through the loopback interface rather than sending it out a physical interface.
So my question is, how do I force it out a particular interface?
Basically, what I'm trying to do is test SMTP traffic through the inline device. I am running an SMTP server listening on eth2 and want to be able to send packets out eth1, through the content filtering device, and receive them by the SMTP server, establishing bi-directional communication characteristic of the SMTP protocol. I need to compare the packet content before and and after passes through the device being tested.
I realize that I could just setup a router in between, but the requirement is the testcases I am writing must use the same wiring setup as the rest of the test suite, which does not support routing.
eth1 -------- test device -------- eth2
Here are some possible solutions I have though of and why they won't work for me:
1. Sending raw packets out the interfaces. This is a last resort, because I would like to have stateful SMTP transmissions between actual client and server software to test how the product will perform in the real world, rather than fake the SMTP session.
2. Use iptables to modify the destination IP in POSTROUTING, just before it is sent out the interface. You can't DNAT in POSTROUTING.
3. Hack up the kernel TCP/IP to not use the loopback interface. Surely there is a simpler way.
4. Static ARP tables. TCP/IP stack still routes through loopback before ARP tables are consulted.
Anyone have any suggestions?
Thanks in advance.
Suppose I have a machine with two interfaces which are connected together via a crossover cable. Suppose I assign IP addresses to each and assign static routes specifing the network interface.
ifconfig eth1 10.0.0.1 255.255.255.0
ifconfig eth2 10.0.0.2 255.255.255.0
route add -host 10.0.0.1 dev eth2
route add -host 10.0.0.2 dev eth1
As we all know, if I try to ping 10.0.0.2, packets won't actually be sent across the wire. Instead, the kernel's routing sees that 10.0.0.2 is a local address and routes it through the loopback interface rather than sending it out a physical interface.
So my question is, how do I force it out a particular interface?
Basically, what I'm trying to do is test SMTP traffic through the inline device. I am running an SMTP server listening on eth2 and want to be able to send packets out eth1, through the content filtering device, and receive them by the SMTP server, establishing bi-directional communication characteristic of the SMTP protocol. I need to compare the packet content before and and after passes through the device being tested.
I realize that I could just setup a router in between, but the requirement is the testcases I am writing must use the same wiring setup as the rest of the test suite, which does not support routing.
eth1 -------- test device -------- eth2
Here are some possible solutions I have though of and why they won't work for me:
1. Sending raw packets out the interfaces. This is a last resort, because I would like to have stateful SMTP transmissions between actual client and server software to test how the product will perform in the real world, rather than fake the SMTP session.
2. Use iptables to modify the destination IP in POSTROUTING, just before it is sent out the interface. You can't DNAT in POSTROUTING.
3. Hack up the kernel TCP/IP to not use the loopback interface. Surely there is a simpler way.
4. Static ARP tables. TCP/IP stack still routes through loopback before ARP tables are consulted.
Anyone have any suggestions?
Thanks in advance.