Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
@Kyle , can't you just setup a physical router in your lab, and just 'route' to and from it? – The Unix Janitor Apr 13 '10 at 12:47
user37899: If you mail it to me, then ya, sure :-P – Kyle Brandt Apr 13 '10 at 12:52
it's in the post buddy, :-)))) – The Unix Janitor Apr 16 '10 at 15:47

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.

share|improve this answer
Raw sockets seem to work for my needs because I can craft the packets. Didn't try the source routing yet. – Kyle Brandt Apr 13 '10 at 17:18
up vote 0 down vote accepted

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=""), iface="tap0", loop=1)

Accomplishes my goal.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.