How to change IP for MQTT Publisher sample for online kapua server


Brenton Chetty
 

Hi, I am trying to connect the MQTT_Publisher via qemu to an online Kapua server.

I managed to connect mqtt_pub to a localhost kapua server using the "zeth" interface "./net-setup.sh"

I assume I need to change these 2 lines in prj.conf
"
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"
"
If the kapua server is on "http://146.34.8.67:8080/" (altered ip)
1. How do I change my IP values?
2. I am currently compiling with "-- -DOVERLAY_CONFIG=overlay-e1000.conf". Do I need to change this?

With thanks
Brenton


Lubos, Robert
 

Hi Brenton

> 1. How do I change my IP values?

 

You can either use “west build -t menuconfig” command to open a configuration window, or modify the `prj.conf` file directly. I rather suggest the latter, as it’s clear then what exactly you’ve changed.
You’d need to modify “CONFIG_NET_CONFIG_PEER_IPV4_ADDR” to the value of the server IP address, and in order to reach external network you’d also need to set the gateway address (“CONFIG_NET_CONFIG_MY_IPV4_GW”).

 

>  2. I am currently compiling with "-- -DOVERLAY_CONFIG=overlay-e1000.conf". Do I need to change this?

I’m assuming you’re using https://docs.zephyrproject.org/latest/guides/networking/qemu_eth_setup.html , in that case you need that overlay to enable appropriate Ethernet driver. There’s also an alternative way to enable networking in Qemu (https://docs.zephyrproject.org/latest/guides/networking/qemu_setup.html), in that case SLIP driver is used and you don’t need any extra overlay. This approach is considered slower though.

 

Genereally, I suggest to try and run the `net/sockets/http_get` sample, which should connect to the web server on the internet out-of-the-box. This should help you to verify that you network configuration is correct to reach the internet from Qemu.

 

Regards,

Robert

 

From: devel@... <devel@...> On Behalf Of Brenton Chetty via lists.zephyrproject.org
Sent: poniedziałek, 21 czerwca 2021 15:20
To: devel@...
Subject: [Zephyr-devel] How to change IP for MQTT Publisher sample for online kapua server

 

Hi, I am trying to connect the MQTT_Publisher via qemu to an online Kapua server.

 

I managed to connect mqtt_pub to a localhost kapua server using the "zeth" interface "./net-setup.sh"

 

I assume I need to change these 2 lines in prj.conf

"
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"

"

If the kapua server is on "http://146.34.8.67:8080/" (altered ip)

1. How do I change my IP values?

2. I am currently compiling with "-- -DOVERLAY_CONFIG=overlay-e1000.conf". Do I need to change this?

 

With thanks

Brenton