TapBridge with PPP

269 views
Skip to first unread message

Henrique Domingues Garcia

unread,
Aug 3, 2018, 3:27:49 AM8/3/18
to ns-3-users
Hi.
I am having problem to connect a TapBridge with a P2P interface. I have two nodes on a P2P link and one of the nodes uses a TabBridge. 

After create tap-device:

sudo tunctl -t tap-device
ifconfig tap
-device 10.0.0.2/24 promisc up

The tap-device created by tunctl on the host system is always Ethernet. When an ethernet packet arrives on NS3 Network, the TapBridge class tries to map the protocol type in the LLC field into a PPP protocol type using PointToPointNetDevice::EtherToPpp().

uint16_t PointToPointNetDevice::EtherToPpp (uint16_t proto)
 
{
   NS_LOG_FUNCTION_NOARGS
();
 
switch(proto)
   
{
   
case 0x0800: return 0x0021; //IPv4
   
case 0x86DD: return 0x0057; //IPv6
   
default: NS_ASSERT_MSG (false, "PPP Protocol number not defined!");
   
}
   
return 0;
 
}

So if an ARP packet (code 2054) occasionally arrives from the host, and Tapbridge try convert to P2P. But the PointToPointNetDevice::EtherToPpp() function no map ARP codes and trow Assert Failed:

...
+0.243931000s 0 PointToPointNetDevice:Send(0x561084e70190, 0x561084e71fc0, 02-06-ff:ff:ff:ff:ff:ff, 2054)
+0.243931000s 0 PointToPointNetDevice:Send(): [LOGIC] p=0x561084e71fc0, dest=0x7ffdc6e53470
+0.243931000s 0 PointToPointNetDevice:Send(): [LOGIC] UID is 1
+0.243931000s 0 PointToPointNetDevice:IsLinkUp(0x561084e70190)
+0.243931000s 0 PointToPointNetDevice:AddHeader(0x561084e70190, 0x561084e71fc0, 2054)
+0.243931000s 0 PointToPointNetDevice:EtherToPpp()
assert failed. cond="false", msg="PPP Protocol number not defined!", file=../src/point-to-point/model/point-to-point-net-device.cc, line=705
terminate called without an active exception

Is there any solution to using tapBridge with PPP links?
No exist a code for ARP on PPP header (https://www.iana.org/assignments/ppp-numbers/ppp-numbers.xhtml), because Address Resolution is for shared medium. How disable the forward of this packet?

My code:

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/tap-bridge-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/internet-module.h"

using namespace ns3;

NS_LOG_COMPONENT_DEFINE
("TapWithPPP");
 
int
main
(int argc, char *argv[])
{
 
LogComponentEnable("PointToPointNetDevice", LOG_ALL);
 
LogComponentEnable("PointToPointNetDevice", LOG_PREFIX_ALL);
 
 
CommandLine cmd;
 cmd
.Parse (argc, argv);

 
GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
 
GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));

 
NodeContainer nodes;
 nodes
.Create (2);

 
InternetStackHelper stack;
 stack
.Install (nodes);
 
 
PointToPointHelper pointToPoint;
 
NetDeviceContainer devicesPPP;
 devicesPPP
= pointToPoint.Install (nodes.Get (0), nodes.Get (1));
 
 
Ipv4AddressHelper ipv4Address;
 ipv4Address
.SetBase ("10.0.0.0", "255.255.255.0");
 
Ipv4InterfaceContainer ipv4Interface = ipv4Address.Assign (devicesPPP);
 
 
TapBridgeHelper tapBridge;
 tapBridge
.SetAttribute ("Mode", StringValue ("UseLocal"));
 tapBridge
.SetAttribute ("DeviceName", StringValue ("tap-device"));
 tapBridge
.Install (nodes.Get(0), devicesPPP.Get (0));
 
 
Simulator::Stop (Seconds (3600.));
 
Simulator::Run ();
 
Simulator::Destroy ();
 
}

Haopeng Wang

unread,
Jan 7, 2022, 8:17:31 PM1/7/22
to ns-3-users
Hi, 
Do you have any ideas?

Tom Henderson

unread,
Jan 8, 2022, 10:24:21 AM1/8/22
to ns-3-...@googlegroups.com
On 1/7/22 5:17 PM, Haopeng Wang wrote:
> Hi,
> Do you have any ideas?

TapBridge is not compatible with interfaces that do not support Ethernet
bridging (such as PointToPoint).

My suggestion is to change your ns-3 topology so that you can use it
with an Ethernet-compatible interface. For instance, you could add an
extra IP hop that has negligible (e.g. 1 nanosecond) delay and very high
bit rate, for the purpose of converting from CSMA to P2P

real ghost P2P P2P
host node node node

Tap<->CSMA<->P2P<----------->P2P

- Tom

Haopeng Wang

unread,
Jan 9, 2022, 6:23:31 PM1/9/22
to ns-3-users
Thanks, Tom.
I am new to NS3 and network.
So you mean I could use csma as ghost node connecting to tapbridge and p2p, like this: tap---csma ghost--p2p?
But there is still ARP in P2P, how does arp work with P2P after I change my topo? 

Thanks a lot

Haopeng



Tom Henderson

unread,
Jan 9, 2022, 9:05:56 PM1/9/22
to ns-3-...@googlegroups.com
On 1/9/22 3:23 PM, Haopeng Wang wrote:
> Thanks, Tom.
> I am new to NS3 and network.
> So you mean I could use csma as ghost node connecting to tapbridge and
> p2p, like this: tap---csma ghost--p2p?
> But there is still ARP in P2P, how does arp work with P2P after I
> change my topo?

There will not be ARP across a P2P link.  The ARP will go to the CSMA
device and stop there.   The node that has both CSMA and P2P is an IP
hop so the P2P link will be on a different subnet.

- Tom

Haopeng Wang

unread,
Jan 9, 2022, 9:35:59 PM1/9/22
to ns-3-users

Ok, I see. Really appreciate it.
And in fact, i want to use two tapbridges to connect two real computers, in ns3, the nodes are connected by P2P.  So, I just need four nodes, two nodes with csma and tapbridge, and two nodes with csma and p2p.
Could you help me check if i am right?

Thanks
Haopeng
ns3-ubuntu-direct.png

Tom Henderson

unread,
Jan 10, 2022, 12:56:11 PM1/10/22
to ns-3-...@googlegroups.com
On 1/9/22 6:35 PM, Haopeng Wang wrote:
>
> Ok, I see. Really appreciate it.
> And in fact, i want to use two tapbridges to connect two real computers,
> in ns3, the nodes are connected by P2P.  So, I just need four nodes, two
> nodes with csma and tapbridge, and two nodes with csma and p2p.
> Could you help me check if i am right?

That looks workable to me.

- Tom

Haopeng Wang

unread,
Jan 23, 2022, 10:37:39 PM1/23/22
to ns-3-users
Hi I have tried your idea. But the right P2P node receives the ARP "Who has 192.168.100.2, tell 192.168.200.2",  similarly, left P2P node receives the ARP "Who has 192.168.200.2, tell 192.168.100.2"?  Technically, the arp should ask the gateway in their subnet instead of 100.2 or 200.2? Do you have any idea?

Thanks
Haopeng

Soulimane Mammar

unread,
Jan 25, 2022, 11:01:34 AM1/25/22
to ns-3-users
Hi,
In fact you don't need 4 ns3 nodes !! just 2 nodes with 2 netdevices each (1 csma and 1 ppp). The csma netdevices should be connected to tap.
Don't forget to configure properly the routing.
With the topology your are using it's weird that the P2P nodes are receiving the arp request unless the mask is 255.0.0.0 or 255.255.0.0, in this case the host with ip 192.168.200.2 thinks that 192.168.100.2 is in the same subnet
Regards

Haopeng Wang

unread,
Jan 25, 2022, 9:02:11 PM1/25/22
to ns-3-users
Thanks, I also tried to use csma without pointtopoint, like this, computerA----ghost0----node0---node1----ghost1-----Computer C, but I found when I ping C from A, that the node0 having two csma devices, does not forward the arp from one device to another csma device. Any idea about this?

Thanks a lot
Haopeng

Haopeng Wang

unread,
Jan 25, 2022, 9:30:26 PM1/25/22
to ns-3-users
Actually, I found I need to add an route on computer A and C, then the link works, but could it work without configuring computer A and C?

Soulimane Mammar

unread,
Jan 26, 2022, 6:28:59 AM1/26/22
to ns-3-users
Hi,
I don't know if there is a way to bridge two csma netdevices in a node. 

leo li

unread,
Mar 18, 2023, 3:36:43 PM3/18/23
to ns-3-users
Hi,
I have the same problem,  could you share your ideas or code?

Thanks a lot
Qinyong
Reply all
Reply to author
Forward
0 new messages