Any idea how to send udp ipv6 packet to cooja simulation - c

I have done rpl-border-router.c as router on sky mote and 1 udp-server.c mote on sky in cooja. I connect router using tunslip utility.
I can ping my server as well as router.
I want to send udp data to server via my linux as host via tun0, but i cant manage to send on it. I have notice that by ping from terminal it works , by opening in firefox router shows routes, How to send packet to my server via border router from linux as host.

Use netcat!
netcat -u [node ip] [port]
this opens up a connection to the UDP server on the node and allows you to send UDP messages from the console.

Related

Unable to ping from GNS3 topology to Physical Adapter

I'm trying to setup a connection b/w GNS3 Router and Local PC. Following are the steps done so far in GNS3:-
1. setup a router interface, e0/0/ = 192.168.1.1 255.255.255.0
2. created a cloud loopback adapter, interface, and assigned IP = 192.168.1.5 255.255.255.0
(Note: loopback adapter has been created as Mictosoft KM-Test loopback on my PC. and same interface has been added to cloud in GNS3 which is then connected to Router interface, e0/0)
When I tried ping from my PC to GNS3 R, arp entries get created in Router (running on GNS3 topology). See below:
RTR#sh arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.1.1 - aabb.cc00.0200 ARPA Ethernet0/0
Internet 192.168.1.5 134 0200.4c4f.4f50 ARPA Ethernet0/0
But ICMP isn't successful on Router (See below) :-
RTR#ping 192.168.1.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
Can anyone help here pls ??
Try setting the IP address of the KM-Test adapter to an address outside your home network. Such as 10.0.0.1/24. Attach your cloud to the network adapter and then create persistent static routes by opening a command prompt as administrator and entering the command.
route -p add [Destination] mask [Subnet Mask] [Gateway(KM-Test)]
Note that any additional network you create within GNS3 will need a static route so that windows knows to send your packets through the KM-Test rather than your home network gateway.

Remote access to Unet modems using JSON

I'm trying to use the JsonTypeAdapter in a modem to transmit some data from a remote source.
The adapter is enabled through the modems startup script (JsonAdapter.enable()), and a TCP connection is established
to the modem at port 1100. I follow the "Hello world" example in the Fjåge documentation and send the following JSON to the modem:
{"action":"send","message":{"clazz":"org.arl.unet.DatagramReq","data":{"data":{"clazz":"[B","data":"aGVsbG8gd29ybGQh"},"msgID":"8152310b-155d-4303-9621-c610e036b373","perf":"REQUEST","recipient":"phy","sender":"MyCustomInterface"}}}
I've set the logLevel to 'ALL' and can see that I get an incoming TCP connection in the log, but no data is being transmitted by the modem.
I'm subscribing to the physical agent but am not getting any notifications in the WebShell (using UnetSocket works fine though).
I'm guessing that either the JsonAdapter isn't active on this TCP connection, the JSON string is faulty or not being sent properly by my application, or something else that I've missed.
I copied any pasted your JSON message, and it worked perfectly fine for me. Steps I took:
I used unet audio SDOAM to test:
$ bin/unet -c audio
Modem web: http://localhost:8080/
> iface
tcp://192.168.1.8:1100 [API]
ws://192.168.1.8:8080/ws [API]
tcp:///192.168.1.8:1100//127.0.0.1.55832 [API]
unetsh: console://- [GroovyScriptEngine]
websh: ws://192.168.1.8:8080/fjage/shell/ws [GroovyScriptEngine]
The 192.168.1.8:1100 API interface tells me which port the modem is listening on (port 1100). So, I connect to it:
$ nc 192.168.1.8 1100
{"alive": true}
The {"alive": true} tells me that I'm connected to the right port, and the modem is saying "hello" :-)
Now, I copy'n'paste your JSON message:
{"action":"send","message":{"clazz":"org.arl.unet.DatagramReq","data":{"data":{"clazz":"[B","data":"aGVsbG8gd29ybGQh"},"msgID":"8152310b-155d-4303-9621-c610e036b373","perf":"REQUEST","recipient":"phy","sender":"MyCustomInterface"}}}
I get a response back:
{"action":"send","message":{"clazz":"org.arl.fjage.Message","data":{"msgID":"41b8264c-be98-4bbe-8b72-8986606513ae","perf":"AGREE","recipient":"MyCustomInterface","sender":"phy","inReplyTo":"8152310b-155d-4303-9621-c610e036b373","sentAt":1586233766542}},"relay":false}
confirming that the message was received, and is being relayed to other slave containers. This is shortly followed by a "buzz" sound that my SDOAM makes to send the frame over the sound card, and the two messages (TxFrameStartNtf and TxFrameNtf) to confirm that the transmission was successfully completed:
{"action":"send","message":{"clazz":"org.arl.unet.phy.TxFrameStartNtf","data":{"txTime":15784016,"txDuration":1511416,"type":2,"msgID":"0a5bae1e-b16c-4bbb-8fcf-36ad55ffc64e","perf":"INFORM","recipient":"#phy__ntf","sender":"phy","inReplyTo":"8152310b-155d-4303-9621-c610e036b373","sentAt":1586233767349}},"relay":false}
{"action":"send","message":{"clazz":"org.arl.unet.phy.TxFrameNtf","data":{"txTime":15759432,"type":2,"location":{"clazz":"[D","data":""},"msgID":"f6e1dee6-ed31-4850-9d90-7b591a740971","perf":"INFORM","recipient":"MyCustomInterface","sender":"phy","inReplyTo":"8152310b-155d-4303-9621-c610e036b373","sentAt":1586233768761}},"relay":false}

Problems with receiving udp multicast packets on client side

I have strange problem with multicast server/client application. I wrote simple server and client udp multicast application in C and I tested it using two laptops and one wireless router.Server is connected with the ethernet cable to the wrt54gl linksys router with 192.168.1.101 IP address. Client with IP 192.168.1.105 address is connected to the router via wireless interface. They can ping each other. Server is sending UDP packets using sendto function and client is receiving them using recvfrom function. When I run my server I can see sent udp packet in wireshark destined for multicast group with IP address 226.1.1.1 but on client side I don't receive those packets and also I can't see them in wireshark. I'm pretty sure that code is properly written. Do you have experience with multicast to advice me?
Thank you

Broadcast on different subnets

Please if you can help me about my problem. On one side I have server with IP 172.27.13.2 connected to the WAN interface of router 172.27.13.1 ...Then on wireless LAN of my router 192.168.1.1 I have connected a few clients. Now I will write code in C where client are requesting some UDP streams from server, then server broadcasts streams to clients, and if some packets get lost clients must send NACK to server. My questions is:
Because server and clients are on different subnets how can I broadcast from server?
And how the client can send request and NACKs to server because they are in different subnets?
Are these problems can be solved by router configurations or in C code?
Thank you for helping
You cannot broadcast to different subnets. Routers do not usually forward broadcast packets to different subnets, unless you have a very special router that can be configured properly (e.g. Cisco ...). You could however use multicast for such a task. Here's a C example
Also check this: UDP broadcast packets across subnets
NOTE: some includes in the c example are missing, but they are easy to find
As both server & users are in different subnets .As router donot forward broadcast .But we have solution by modifying the router configuration .
If you have cisco router & users are connected on cisco switch ,you can use ip helper address command on switch on vlan .You can allow udp packet on router ACL

Redirecting outgoing TCP connection from a process on Linux

I have an C application that receives commands/info from a client application on localhost but needs to send data to the client on another IP address. Does someone have any previeous kind of experience of doing such a thing? From what i've read You cannot redirect an TCP connection?
Thanks

Resources