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 ?
brainydexter
  • 19,826
  • 28
  • 77
  • 115

1 Answers1

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.

usinglinux
  • 21
  • 2
  • Thanks for the suggestion. I set up TAP and made link in Mininet with network switch (https://stackoverflow.com/questions/15626088/tap-interfaces-and-dev-net-tun-device-using-ip-tuntap-command) I could see network Namespace by ` ifconfig` in Mininet. In this simulation, should I still need a network bridge? – Cloud Cho Aug 16 '23 at 05:04