how can I send packets between two processes using TUN/TAP interface?
Asked Answered
P

1

2

I have two processes and I am trying to simulate the situation where the two processes represent two switches which are connected by a wire. I want to be able to send a packet from one process to the other. Another use case is, each of these processes can be hooked up to a packet generator also.

I am new to networking and came across TUN/TAP interfaces and seemed to be the logical interface to use here. However, I am a little confused about one thing:

  • Will the two processes each have their own interfaces ? when I have to send packet from process A to B, will I be sending a packet to B-interface ?

OR

  • What if the two processes attach to the same interface ? How will that work ?
Plant answered 9/10, 2014 at 2:48 Comment(0)
S
2

no two processes can connect to the userland side of the same tun/tap interface. if you want the simulated devices to communicate, put them on a bridge using brctl addbr br0; brctl addif br0 tap0; brctl addif br0 tap1.

Substantial answered 12/3, 2015 at 0:15 Comment(1)
Thanks for the suggestion. I set up TAP and made link in Mininet with network switch (#15626588) I could see network Namespace by <switch ID> ifconfig in Mininet. In this simulation, should I still need a network bridge?Anvil

© 2022 - 2024 — McMap. All rights reserved.