Communication between native_posix board and external hardware via router


Lei Xu <lei.xu@...>
 

Hi everyone!


I'm trying to setup the communication between a native_posix board and a sensor. The sensor is connected to my router, and the native_posix program is running on my Linux host, which is also connected to the same router.


I have tried to setup a zeth interface using the provided net-tools. The configuration file used for setup zeth is as follows:

INTERFACE="$1"
HWADDR="00:00:5e:00:53:21"
IPV6_ADDR_1="2001:db8:2100::1"
IPV6_ROUTE_1="2001:db8:2100::/64"
IPV4_ADDR_1="192.168.1.104/24"
IPV4_ROUTE_1="192.168.1.0/24"
ip link set dev $INTERFACE up
ip link set dev $INTERFACE address $HWADDR
ip -6 address add $IPV6_ADDR_1 dev $INTERFACE nodad
ip -6 route add $IPV6_ROUTE_1 dev $INTERFACE
ip address add $IPV4_ADDR_1 dev $INTERFACE
ip route add $IPV4_ROUTE_1 dev $INTERFACE > /dev/null 2>&1


Correspondingly, the configurations in my native_posix project are as follows:

CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.168.1.105"
CONFIG_NET_CONFIG_MY_IPV4_GW="192.168.1.1"
#CONFIG_ETH_NATIVE_POSIX_STARTUP_AUTOMATIC=y
CONFIG_ETH_NATIVE_POSIX_RANDOM_MAC=n
CONFIG_ETH_NATIVE_POSIX_MAC_ADDR="00:00:5e:00:53:22"
CONFIG_ETH_NATIVE_POSIX_DRV_NAME="zeth"

where "192.168.1.1" is the router's address.


After building and running the native_posix program, it can only communicate with the local host but cannot communicate with my sensors. May someone figure out what's the problem?


Best regards,

Lei

Join users@lists.zephyrproject.org to automatically receive all group messages.