I have two interfaces uap0 and eth0 in my iMX8MPEVK. uap0 acts as an access point for other devices to connect to this device. eth0 interface is connected to my router. And my router is connected to internet.
Details about the interfaces:
uap0 - 172.24.100.1/24
DHCP range for devices connecting to AP: 172.24.100.50 - 172.24.100.100
eth0 - 192.168.1.26/24
Router's IP (which is gateway): 192.168.1.253
route add default gw 192.68.1.253 since this is the router's IP. I tried with 172.24.100.1 as well. But it also didn't work.
I have allowed ipv4 forwarding in sysctl.conf file. I have also added following entries to the iptables:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o uap0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i uap0 -o eth0 -j ACCEPT
Ping results:
ping 172.24.100.50 -I uap0 ---> Success (.50 is one of the devices connected to AP)
ping 8.8.8.8 -I uap0 ---> Failure
ping 192.168.1.26 -I uap0 ---> Failure
ping 172.24.100.1 -I eth0 ---> Failure
Whenever I have a device connected to AP, there is no internet access in the device. Almost every solution I have gone through in the web recommends to add entries to the iptables which I have already done.
I had implemented AP+STA mode in Raspberry Pi previously. I had to configure dnsmasq and hostapd in RPi. But since this is a minimal linux system, I don't have the dnsmasq preinstalled. Also, package managers don't work as expected.
Network diagram as per my current setup:

The green part is the EVK.
Output of iptables-save:

Output of sysctl:
