Topics

#LWM2M #Leshan #QEMU #Networking #networking #lwm2m #leshan #qemu


Thomas LE ROUX
 

Hi everybody !


I'm trying to build a projet using Zephyr & LWM2M (& Leshan).

For now, I’m prototyping on QEMU.

TL;DR before explaining more precisely my issue : There must be a way to connect a QEMU instance to a remote server, but I’m stuck trying to do this.



I have made my small application to test things out, and except Firmware Update (my previous mail), everything is working fine on a local scale.

Running my client & Leshan server on the server along with the loop-socat and loop-slip-tap scripts given on /tools/net-tools/ causes no issue.

(Procedure followed here : https://docs.zephyrproject.org/latest/guides/networking/qemu_setup.html).


I’d like to connect my client to a Leshan server running on an AWS EC2 Instance.

I have made a small schematic. The goal would be to connect my Client (aka QEMU) to the Leshan server running on the Instance.


image.png

From the QEMU instance, I am able to run small commands. One of them is « net ping xxx ». From my client, I am able to ping the local Leshan and my computer. The ping request direct to other peripherals (other computers, my Internet modem, remote Leshan …) all end up in a timeout.

From my computer, I am able to ping basically anyone on the network.


I have followed the tutorial (given here : https://docs.zephyrproject.org/latest/guides/networking/qemu_setup.html#setting-up-zephyr-and-nat-masquerading-on-host-to-access-internet), and added to my prj.conf : CONFIG_NET_CONFIG_MY_IPV4_GW="192.168.0.20".

Running the following commands didn’t raise any error message, so I assume that eveything went right :

  • iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.0.2.1

  • sysctl -w net.ipv4.ip_forward=1


I used Zenmap, a GUI tool for Nmap and here is my network’s map. Center point is my internet modem (choose this for a viewing perspective.) The long blue line going up is the route for reaching my EC2 instance. It confirms that my computer can reach anything, but only my computer can reach 192.0.2.1.

image.png

I used Wireshark on the tap0 interface generated by loop-slip-tap.sh and it seems that the registration’s frame sent to the EC2 instance stays on the tap0 interface and never leaves my computer.


I think the issue might be related to the use of those 2 scripts but I’m not sure and I’m (clearly) not the best in terms of networking.

My problem is pretty much described, if needed, I can send some logs.


Thank you for your help !

Best regards,

Thomas





Khaled Elsayed
 

Seems like a problem in the local host 192.168.0.20. Could you route any traffic from another local machine (not Qemu) via that host, i.e. set 192.168.0.20 as their G/W? Also are you able to ping from Qemu to 192.168.0.1 (I assume not, but just trying to localize where the problem is). 

Also make sure you issue these commands as root on  192.168.0.20. 

On Tue, Nov 10, 2020 at 7:13 PM Thomas LE ROUX <thomas.leroux@...> wrote:

Hi everybody !


I'm trying to build a projet using Zephyr & LWM2M (& Leshan).

For now, I’m prototyping on QEMU.

TL;DR before explaining more precisely my issue : There must be a way to connect a QEMU instance to a remote server, but I’m stuck trying to do this.



I have made my small application to test things out, and except Firmware Update (my previous mail), everything is working fine on a local scale.

Running my client & Leshan server on the server along with the loop-socat and loop-slip-tap scripts given on /tools/net-tools/ causes no issue.

(Procedure followed here : https://docs.zephyrproject.org/latest/guides/networking/qemu_setup.html).


I’d like to connect my client to a Leshan server running on an AWS EC2 Instance.

I have made a small schematic. The goal would be to connect my Client (aka QEMU) to the Leshan server running on the Instance.


image.png

From the QEMU instance, I am able to run small commands. One of them is « net ping xxx ». From my client, I am able to ping the local Leshan and my computer. The ping request direct to other peripherals (other computers, my Internet modem, remote Leshan …) all end up in a timeout.

From my computer, I am able to ping basically anyone on the network.


I have followed the tutorial (given here : https://docs.zephyrproject.org/latest/guides/networking/qemu_setup.html#setting-up-zephyr-and-nat-masquerading-on-host-to-access-internet), and added to my prj.conf : CONFIG_NET_CONFIG_MY_IPV4_GW="192.168.0.20".

Running the following commands didn’t raise any error message, so I assume that eveything went right :

  • iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.0.2.1

  • sysctl -w net.ipv4.ip_forward=1


I used Zenmap, a GUI tool for Nmap and here is my network’s map. Center point is my internet modem (choose this for a viewing perspective.) The long blue line going up is the route for reaching my EC2 instance. It confirms that my computer can reach anything, but only my computer can reach 192.0.2.1.

image.png

I used Wireshark on the tap0 interface generated by loop-slip-tap.sh and it seems that the registration’s frame sent to the EC2 instance stays on the tap0 interface and never leaves my computer.


I think the issue might be related to the use of those 2 scripts but I’m not sure and I’m (clearly) not the best in terms of networking.

My problem is pretty much described, if needed, I can send some logs.


Thank you for your help !

Best regards,

Thomas






--

Khaled Elsayed

Technical Fellow


Si-Vision LLC

Square 1142, Al Ezaei Salah Zaki St.,

Sheraton Heliopolis,

Cairo, 11361 EGYPT

Mob. +(20)100 1649292



The information contained in this message is privileged, confidential or otherwise protected from use and disclosure. If you are not the intended recipient, you are hereby notified that any review, disclosure, copying or dissemination of this message or the taking of any action in reliance on its contents, or other use is strictly prohibited.  If you received this message in error, please notify us immediately by replying to the message and deleting it from your computer.  Thank you.
Si-Vision, LLC.