Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


Search this Thread
Old 04-10-2013, 05:03 AM   #1
LQ Newbie
Registered: Apr 2013
Location: bangalore
Posts: 3

Rep: Reputation: Disabled
Smile How to connect two systems via virtual network devices like tap in linux.


I have two systems host-A and host-B.
I want to communicate these two host systems via virtual ethernet devices like tap.

I have using to spilt a data strem to two using NIC bonding. Here, my two ethernet cards are eth0 and eth1.
After creating bond0, my two ethernet interfaces attached with bond0.
Now, I have a application stack called GNUradio installed in host-A.Same, GNURadio installed in host-B.

So, I created two tap interfaces in both host-A and host-B. _________
So, if suppose I send 10000 tcp packets from host-A to host-B, it should go through the __________
bond0 |-> eth0 -> tap0 ->| |
-> eth1 -> tap1 ->|GNU Radio | |_________|

So, in GNu radio, I am sending both the tap0 output to OFDM mod and send outside via wireless devices.

Same setup is in other end and it will receive and demodulate and receive on the two tap interfaces and using same NIC bonding mechanism I am combine the data strem at host-B.

In host-A I created a tap0 and tap1 interface and create a bridge interface br0 and br1 to connect with eth0 and eth1.

Here my requirement is whatever ethernet frame/packets comes it should go through eth0 -> tap0 -> Gnuradio OFDM1, same like eth1 -> tap1 -> Gnuradio OFDM2 pathg.

I tried with linux bridging with examle setup.

I created tap0 and attach with br0 which already have eth0 if attached. I try to send some tcp packets to remote host via this bridge, bridge have IP address and subnet mask. I removed IP address to both eth0 and tap0.
When I send packets to remote host, it goes through bridge , but tap0 not seen any packets.I checked via tcpdump.

Whether my approach right?. If mistake correct me.

How to stream data to gnuradio stack via eth0 -> tap0.

Thank you,
Old 04-12-2013, 02:48 PM   #2
Registered: Apr 2009
Posts: 968

Rep: Reputation: 67
You can use the "tap" virtual ethernet driver which lets a userspace program pretend to be an ethernet interface. This is a standard kernel feature for some time now (it might not be enabled in your kernel though).
Old 04-18-2013, 01:09 PM   #3
LQ Newbie
Registered: Apr 2013
Location: bangalore
Posts: 3

Original Poster
Rep: Reputation: Disabled

Hi nini,
thank you.
I tried the tunctl mechanism and created tap devices.
But, not able to send packets via tap.

Is it correct or any method available.

Can I bond two ethernet inetrfaces and forward each interface packets to tap devices.
This I tried, but not able to forward ethernet packets to tap devices.

What is the problem with the setup.
please correct me.

Old 04-18-2013, 02:24 PM   #4
Registered: Apr 2009
Posts: 968

Rep: Reputation: 67
Tun/tap interfaces are software-only interfaces, meaning that they exist only in the kernel and, unlike regular network interfaces, they have no physical hardware component (and so there's no physical "wire" connected to them). You can think of a tun/tap interface as a regular network interface that, when the kernel decides that the moment has come to send data "on the wire", instead sends data to some userspace program that is attached to the interface (using a specific procedure, see below). When the program attaches to the tun/tap interface, it gets a special file descriptor, reading from which gives it the data that the interface is sending out. In a similar fashion, the program can write to this special descriptor, and the data (which must be properly formatted, as we'll see) will appear as input to the tun/tap interface. To the kernel, it would look like the tun/tap interface is receiving data "from the wire".
The difference between a tap interface and a tun interface is that a tap interface outputs (and must be given) full ethernet frames, while a tun interface outputs (and must be given) raw IP packets (and no ethernet headers are added by the kernel). Whether an interface functions like a tun interface or like a tap interface is specified with a flag when the interface is created.
Old 04-19-2013, 02:53 PM   #5
Registered: Apr 2009
Posts: 968

Rep: Reputation: 67
Following link could help you to understand and learn.
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing virtual network Driver for Ethernet devices grreddy Linux - Kernel 0 11-24-2011 06:51 AM
how to create arbitrary network paths with tap devices? krisweston Linux - Networking 0 09-10-2011 10:14 AM
How to connect systems in private network with public network jeetv33 Linux - Networking 2 01-12-2011 08:55 PM
How to connect systems in private network with public network jeetv33 Linux - Newbie 4 01-11-2011 11:26 AM

All times are GMT -5. The time now is 10:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration