I am working on an embedded system running Yocto. I created an access point using the following commands:
iw dev wlan0 interface add wlan1 type __ap ifconfig wlan1 hw ether 00:25:ca:07:0d:a6 ifconfig wlan1 192.168.3.1 up hostapd /etc/hostapd.conf -B udhcpd /etc/udhcpd.conf
I can see the created wifi network and I can connect to it with my Ubuntu PC. An IP is correctly assigned. However, I cannot ping the Yocto board from my PC, while I can ping the PC from the board. I also noticed that if I run the ping command from the PC and then I run the same command from the board, the ping from the PC starts working as soon as the ping from the board starts.
This is the content of /etc/hostapd.conf:
interface=wlan1 driver=nl80211 logger_syslog=-1 logger_syslog_level=0 logger_stdout=-1 logger_stdout_level=3 ctrl_interface=/var/run/hostapd ctrl_interface_group=0 ssid=softAP hw_mode=g channel=6 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=12345678 wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
Content of /etc/udhcpd.conf:
start 192.168.3.10 end 192.168.3.100 # The interface that udhcpd will use interface wlan1 #default: eth0
Output of ip route on the board:
192.168.3.0/24 dev wlan1 proto kernel scope link src 192.168.3.1
Output of ip route on the PC:
192.168.3.0/24 dev wlx000f005d7551 proto kernel scope link src 192.168.3.10 metric 600 192.168.178.0/24 dev enp14s0 proto kernel scope link src 192.168.178.84 metric 100
An answer here suggests to limit the scope of the address, but I cannot find the network files specified in this page. How can I fix this problem?
ip route? The PC may be sending the ICMP packets through the wrong interface but responding through the same interface it comes in. You can also try specifying the interface with
ping -I wlan1to test this hypothesis.