0

I am setting up a dynamips/dynagen lab and am wondering if there is any way to get traffic to route out one tap devices, go into the lab, and come back to a tap device on the same machine. I have tried host specific routes as well as removing the route created when I give the tun device an ip via ifconfig. With both of these, traffic always preferes the attached devices and won't go through my lab.

Any way to make this work without a separate machine or vm?

Kyle Brandt
  • 83,619
  • 74
  • 305
  • 448

2 Answers2

1

I don't think it's trivially doable, as the host machine will do a lookup in its own routing table and see that the IP you're wanting to reach is easiest reached by just passing the traffic internally.

If you're using linux, it is possible to create source routes using ip this page has an example taht you should be able to work from.

Vatine
  • 5,440
  • 25
  • 24
0

Apparently raw sockets bind to an interface and can gleefully bypass the routing tables. Scapy is capable of this, so for example:

>>> sendp(IP(dst="192.168.8.2"), iface="tap0", loop=1)

Accomplishes my goal.

Kyle Brandt
  • 83,619
  • 74
  • 305
  • 448