0

How can I simulate some incoming traffic on a specific software interface? The reason for this need is that we have a couple of software interfaces between Ether level and IP level, which will parse our own L2.5 headers along the network stack, i.e.

eth header -> virt_dev1 -> virt_dev2 -> IP -> TCP

I was looking at TAP, which looks like it can help. But I do not understand how to chain this TAP interface to our own software interfaces so the packets will go through the expected network stack? Maybe my understanding of TAP is not correct?

Thanks,

Ashwini Chaudhary
  • 244,495
  • 58
  • 464
  • 504
wei
  • 6,629
  • 7
  • 40
  • 52

1 Answers1

1

The tap interface acts like a Layer 2 port to the networking stack - reading and writing from the device node will ingest/retrieve packets from the networking layer. Where those packets go after that point is up to the networking configuration (forwarding, bridging, etc).

Yann Ramin
  • 32,895
  • 3
  • 59
  • 82
  • thanks, so I guess bridging this TAP interface to our private software interface could be an option? – wei Jan 22 '13 at 02:43
  • The `tap` interface is designed to be bridged to a real physical adapter (or used locally on your system). Your software interface would use it as a file device, and would be responsible for handling the Ethernet frame decoding/encoding over that interface. – Yann Ramin Jan 22 '13 at 02:47
  • hm..it might not be possible to change the software interface's driver. So what if I bridge it to the real Ethernet interface? Will the packet go through TAP -> eth -> virt_dev1 -> virt_dev2 -> IP -> TCP this path? – wei Jan 22 '13 at 02:57
  • What are virt_dev1 here? If you write valid TCP inside IP inside Ethernet(II) frames to `tap`, the operating system will use the appropriate logic to move them however your network is configured. This means you might need to even implement ARP in software if you don't have fix your MAC<->IP mapping. `tap` is low level, and really designed for synthetic networks or userspace VPN tunnels. – Yann Ramin Jan 22 '13 at 03:05
  • virt_dev1 is our own software devices which adds/parses additional headers(private) between Ether header and IP header. – wei Jan 22 '13 at 04:32