Re: Send Packet Wired and Wireless

348 views
Skip to first unread message
Message has been deleted

γιωργος γιωργος

unread,
Apr 14, 2020, 11:57:44 AM4/14/20
to ns-3-...@googlegroups.com
Hi,

I'll tell you what i have done, since i am implementing the same model(wired and wireless RSUs with 802.11p/Ethernet).

1. You can set up your RSU nodes to have 2 interfaces: 1 for 802.11p and another for wired(CSMA?). Install first the 802.11p protocol on your nodes, asign a range of IPs for them, then install the wired protocol you want to use on the same nodes and assign a second range of IPs. If all goes well, you will have two interfaces on the same node.
You can get each interface IP with something like this:

                    Ipv4Address addr = node->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal (); //should return the address of the 1st interface

2. You can create two pairs of sockets, one for each interface. You bind each Recv socket to the respective interface of the node and you connect each Send socket to the broadcast address of the respective subnet.

George

Στις Τρί, 14 Απρ 2020 στις 4:40 μ.μ., ο/η KS <khaledsar...@gmail.com> έγραψε:
Hello, 

I am new to the forum.


I used Traci application to simulate VANETs (V2V and V2I connection)  and coupling SUMO with ns3
I am trying to simulate an RSU environment where the RSU nodes communicate to the vehicle nodes through ieee802.11p 
However, I want to connect the RSU nodes through a wired connection. 
  1. How to set it up so that the RSU node accepts an ethernet connection to send and receive data.
  2. How can I switch between sending packets through ethernet or sending wirelessly to other cars
 Can anyone guide me?

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/74cdafae-c2f1-478c-a81b-1e52b7216544%40googlegroups.com.
Message has been deleted

Edivaldo

unread,
Apr 14, 2020, 12:57:02 PM4/14/20
to ns-3-users
Hello, Colleagues.

A question about the mobility of RSUs, as they share the same NodeContainer as the moving nodes.

Would it be necessary to select which NodeIDs to be static and apply a SetMobilityModel ("ns3 :: ConstantPositionMobilityModel") to these?

Thank you colleagues for your help and attention.

Health and Peace to you and your family.

Edivaldo
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-...@googlegroups.com.

KS

unread,
Apr 14, 2020, 1:46:02 PM4/14/20
to ns-3-users
Yes, this is what I did!  I set all nodes to have a constant position mobility model. Then each node I either set a fixed position for RSU or set mobility for vehicles.

ABDULJABBAR ALSHARIF

unread,
Apr 14, 2020, 1:56:08 PM4/14/20
to ns-3-...@googlegroups.com
Hi 
 Do you have the full sceirpt for send node in wireless communications like lte ?! 

If u have plz share it 

To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/606372e7-c284-48fb-bcb7-d67dd95a07a8%40googlegroups.com.

KS

unread,
Apr 14, 2020, 2:11:38 PM4/14/20
to ns-3-users
I didn't understand what you are asking but you can find information in this github repository: https://github.com/vodafone-chair/ns3-sumo-coupling

Edivaldo

unread,
Apr 14, 2020, 2:53:31 PM4/14/20
to ns-3-users
Thank you very much.

γιωργος γιωργος

unread,
Apr 14, 2020, 3:50:59 PM4/14/20
to ns-3-...@googlegroups.com
You substitute 1 with 2 in the command:

Ipv4Address addr = node->GetObject<Ipv4> ()->GetAddress (2, 0).GetLocal (); 


George

Στις Τρί, 14 Απρ 2020 στις 7:18 μ.μ., ο/η KS <khaledsar...@gmail.com> έγραψε:
Hello, 

Thank you for your input. how do you get the IP of the second interface?


To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-...@googlegroups.com.

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.

γιωργος γιωργος

unread,
Apr 14, 2020, 3:54:05 PM4/14/20
to ns-3-...@googlegroups.com
Thank you for your input. how do you get the IP of the second interface?  

You change the argument of GetAddress(), like this:

Ipv4Address addr = node->GetObject<Ipv4> ()->GetAddress (2, 0).GetLocal ();  


George

To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/5237c034-c9e1-4298-9f0f-739b68dc483f%40googlegroups.com.

KS

unread,
Apr 14, 2020, 4:09:47 PM4/14/20
to ns-3-users
Thank you so much!!!
I tried deleting the comment because I figured it out. 
But I really appreciate your help.
Message has been deleted

KS

unread,
Apr 15, 2020, 8:12:51 AM4/15/20
to ns-3-users
I used it and sent a packet over the CSMA channel for the wired connection.  When I tried to animate it using NetAnim, and it shows a vector that has an origin different from that of the source node sending the packet, do you have any idea if there is something in the configuration or any idea of how to fix it?!



--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
--- 
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-...@googlegroups.com.

γιωργος γιωργος

unread,
Apr 15, 2020, 12:53:06 PM4/15/20
to ns-3-...@googlegroups.com
I am not sure on what might happening.I would start by looking at the pcap trace files to see what packets are generated and when. If you send the relevant code I might take a look, though i am in not very confident on my ns-3 skills :)

George

To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/e0868a3f-aeb9-4140-8b9a-fcf0db68835c%40googlegroups.com.
Message has been deleted
Message has been deleted

γιωργος γιωργος

unread,
Apr 15, 2020, 4:57:11 PM4/15/20
to ns-3-...@googlegroups.com
I don't see any relevant code on the attached file. Perhaps you posted the wrong file.

On the code you pasted in the previous email, seems ok about installing CSMA. Do you install the internet stack somewhere else? What is the implementation of the sockets?

I have attached a part of my code in case it helps a bit.

Στις Τετ, 15 Απρ 2020 στις 11:11 μ.μ., ο/η KS <khaledsar...@gmail.com> έγραψε:
Please check out my scratch file!!


On Wednesday, April 15, 2020 at 7:53:06 PM UTC+3, George Katsouris wrote:
I am not sure on what might happening.I would start by looking at the pcap trace files to see what packets are generated and when. If you send the relevant code I might take a look, though i am in not very confident on my ns-3 skills :)

George

Στις Τετ, 15 Απρ 2020 στις 3:13 μ.μ., ο/η KS <khaledsar...@gmail.com> έγραψε:
I used it and sent a packet over the CSMA channel for the wired connection.  When I tried to animate it using NetAnim, and it shows a vector that has an origin different from that of the source node sending the packet, do you have any idea if there is something in the configuration or any idea of how to fix it?!



--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
--- 
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-...@googlegroups.com.

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-...@googlegroups.com.

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
example1.cc

KS

unread,
Apr 15, 2020, 5:53:08 PM4/15/20
to ns-3-users
Hello,

Thank you for your help.
Can you check if you can help me with the following question I opened another thread for it?
 it would be great please check the link below:



Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-...@googlegroups.com.

γιωργος γιωργος

unread,
Apr 15, 2020, 6:03:31 PM4/15/20
to ns-3-...@googlegroups.com
Sorry, but I haven't any experience on that particular subject.

George

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/95e01cb6-e5d9-4851-848d-9a6877bd637f%40googlegroups.com.

Edivaldo

unread,
Apr 15, 2020, 11:25:33 PM4/15/20
to ns-3-users
Hello George!

Please.
In the attached code, in addition to the communication between RSUs and vehicles in traffic mobility, would you be storing the data that each RSU receives and / or retransmits?

In my case, I would need the vehicle to send a specific package to a RSU, which would store it and then send it (broadcast) to the other vehicles in its coverage.

Thank you very much your attention and helping.

Health and Peace.

Sincerely,
Edivaldo

γιωργος γιωργος

unread,
Apr 16, 2020, 3:29:31 AM4/16/20
to ns-3-...@googlegroups.com
Hi Edivaldo,

In my case, I have implemented the response from RSU in the socket callback function. First of all i have created different classes for vehicles and RSUs, each with their own members and functions, so you can store data in them. If you want to send a custom packet, you can add a header at the packet with your content, and then consume it on the Receive(reference: https://www.nsnam.org/docs/release/3.3/doxygen/packet-header-trailer.html)
Once RSU receives that packet, it can forward it to the network with its own socket. To summarize:

  1. A custom packet is created using ns3 Headers.
  2. A vehicle broadcasts/sends that packet to a RSU.
  3. RSU receives the packet, gets out the content and creates a new custom packet.
  4. RSU broadcasts/sends the new packet.
Disclaimer: I do not claim this is the best/correct method to do that. It's just the way I thought of doing that sort of communication, since I'm not aware of any better. If there is a better way, please let me know.

P.S. Out of curiosity, what is the use case you are researching?

Best regards,
George 

To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/df2f1b8a-a4d8-4909-b9fa-2c8f36aca225%40googlegroups.com.

Edivaldo

unread,
Apr 16, 2020, 3:20:08 PM4/16/20
to ns-3-users
Hi George,

My process is really similar to yours. Share communication and data between vehicles and RSUs.

If it is working in your case, then it is the basis of correct understanding for you to evolve it later.

My job is based on information security, that is, detecting anomalies in data communication between vehicles in traffic.

And your job?

Thank you for your attention and feedback.

Greetings,
Edivaldo

γιωργος γιωργος

unread,
Apr 16, 2020, 3:26:45 PM4/16/20
to ns-3-...@googlegroups.com
Hi Edivaldo,

Working is a bit relevant, I have issues with simultaneous broadcasts as it causes packets to get dropped. I will find a workaround though.

I am doing my thesis in Security on IoV. I am testing different cryptographic methods during the communication between vehicles and RSUs.

George

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.

γιωργος γιωργος

unread,
Apr 16, 2020, 3:28:36 PM4/16/20
to ns-3-...@googlegroups.com
Working in my case is a bit relative :/ I have issues with simultaneous messages getting dropped but I'm working on it to find a workaround.

I am doing my thesis on Security in IoV. I am testing different cryptographic methods in the communication between vehicles and RSUs.

Regards,
George

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.

KS

unread,
Apr 17, 2020, 7:32:39 AM4/17/20
to ns-3-users
Hello,

If I may ask what is the density of traffic in your simulation when packets start to get dropped??
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-...@googlegroups.com.

Malik Saad

unread,
Apr 17, 2020, 9:44:48 AM4/17/20
to ns-3-...@googlegroups.com
Hi. Hope you are all good. I was going thorough this thread. I am also working on VANETS. In my scenario i want all nodes to have multiple interfaces. The interface is selected based on the SNR value. That is when to choose between wired and wireless interface. 

I am using ns3-sumo-coupling-simple file. To install the CSMA interface i get the code from this thread as: 

NodeContainer csmaNodes;
csmaNodes.Create(2);

NodeContainer nodePool;
nodePool.Add(csmaNodes);
nodePool.Create(3); //number of nodes in the pool

CsmaHelper csma;
csma.SetChannelAttribute("DataRate", StringValue("100Mbps"));
csma.SetChannelAttribute("Delay", TimeValue(NanoSeconds(6560)));

NetDeviceContainer csmaDevices;
csmaDevices = csma.Install(csmaNodes);

address.SetBase("10.0.1.0", "255.255.255.0");
Ipv4InterfaceContainer csmaInterfaces;
csmaInterfaces = address.Assign(csmaDevices);

I want to ask is it required to install internet stack for csma nodes as:

stack.Install (csmaNodes);

Thanks.

To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/34feb6bb-f765-40e5-94f5-eea8543260e8%40googlegroups.com.

Malik Saad

unread,
Apr 17, 2020, 9:45:46 AM4/17/20
to ns-3-users
Hi. Hope you are all good. I was going thorough this thread. I am also working on VANETS. In my scenario i want all nodes to have multiple interfaces. The interface is selected based on the SNR value. That is when to choose between wired and wireless interface. 

I am using ns3-sumo-coupling-simple file. To install the CSMA interface i get the code from this thread as: 

NodeContainer csmaNodes;
csmaNodes.Create(2);

NodeContainer nodePool;
nodePool.Add(csmaNodes);
nodePool.Create(3); //number of nodes in the pool

CsmaHelper csma;
csma.SetChannelAttribute("DataRate", StringValue("100Mbps"));
csma.SetChannelAttribute("Delay", TimeValue(NanoSeconds(6560)));

NetDeviceContainer csmaDevices;
csmaDevices = csma.Install(csmaNodes);

address.SetBase("10.0.1.0", "255.255.255.0");
Ipv4InterfaceContainer csmaInterfaces;
csmaInterfaces = address.Assign(csmaDevices);

I want to ask is it required to install internet stack for csma nodes as:

stack.Install (csmaNodes);

Thanks.

KS

unread,
Apr 17, 2020, 10:51:09 AM4/17/20
to ns-3-users
No, you are not required to do so.

KS

unread,
Apr 17, 2020, 10:52:19 AM4/17/20
to ns-3-users
You are using wired interface for stationary nodes, right?


On Friday, April 17, 2020 at 4:44:48 PM UTC+3, Malik Saad wrote:

Malik Saad

unread,
Apr 17, 2020, 11:47:40 AM4/17/20
to ns-3-users
Actually i am not very much experienced with the ns3. yes wired interface for the stationary nodes. But i want to install both interfaces such as 802.11p and csma on each node. In the scenario prime goal is to use LTE and wifi based interfaces. But in this example i am using CSMA as an alternative for LTE.  Once i established this basic setup i will move to look for clustering in VANETS and cluster head will communicate with the back hul via CSMA interface and with vehicles using 802.11.

Edivaldo

unread,
Apr 17, 2020, 12:54:51 PM4/17/20
to ns-3-users
Hello, Malik.
I also hope that everything is fine.

Look, you commented on clustering in VANET. I haven't implemented it yet, but colleagues were dealing with this: 

Sucess, Health and Peace.

Sincerely,
Edivaldo

γιωργος γιωργος

unread,
Apr 17, 2020, 2:51:17 PM4/17/20
to ns-3-...@googlegroups.com
It can happen with 2 nodes sending simultaneously data on a 3rd one. The receiving node drops both packets if they come simultaneously.

George

To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/34feb6bb-f765-40e5-94f5-eea8543260e8%40googlegroups.com.

Malik Saad

unread,
Apr 18, 2020, 5:54:15 AM4/18/20
to ns-3-users
Many thanks Edivaldo,

Malik Saad

unread,
Apr 19, 2020, 5:54:24 AM4/19/20
to ns-3-users
Hi Edivaldo,

I tried to install the v2v module. I copied the v2v module and clustering module into the src Folder of ns3 root. Then after running following command:

./waf configure --enable-examples

It ran sucessfully, but after this command

./waf

I got an error in v2v-control-client.cc

/src/v2v/model/v2v-control-client.cc:100:74: error: ‘ns3::TypeId ns3::TypeId::AddTraceSource(std::__cxx11::string, std::__cxx11::string, ns3::Ptr<const ns3::TraceSourceAccessor>)’ is deprecated [-Werror=deprecated-declarations]
                     MakeTraceSourceAccessor(&V2vControlClient::m_rxTrace))


Looking for the suggestions to resolve this error.
Regards
Reply all
Reply to author
Forward
0 new messages