Unable to forward IP in NanoPi M1 Plus

Recommended Posts

Hi I trying to create an Access Point from NanoPi M1 plus device having Ubuntu_bionic_next_4.14.78.7z OS.

I am able to create the AP and my devices are able to connect to it. But somehow they are not able to use the internet.


I have eth0 interface as plugged in to the board which whose IP will be forwarded. via wlan0 interface.


I have already set net.ipv4.ip_forward=1 in /etc/sysctl.conf and /proc/sys/net/ipv4/ip_forward to 1.


I issued the following iptables commands, but it didn't work...


sudo iptables -F
sudo iptables -t nat -F
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT





eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        inet6 fe80::81:14ff:fea2:1b15  prefixlen 64  scopeid 0x20<link>
        ether 02:81:14:a2:1b:15  txqueuelen 1000  (Ethernet)
        RX packets 599  bytes 40641 (40.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 59  bytes 9337 (9.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 39

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet  netmask
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 571  bytes 41372 (41.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 571  bytes 41372 (41.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        ether b0:f1:ec:2c:dd:0c  txqueuelen 1000  (Ethernet)
        RX packets 32  bytes 2796 (2.7 KB)
        RX errors 0  dropped 1  overruns 0  frame 0
        TX packets 18  bytes 2316 (2.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


ip addr


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 02:81:14:a2:1b:15 brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::81:14ff:fea2:1b15/64 scope link
       valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether b0:f1:ec:2c:dd:0c brd ff:ff:ff:ff:ff:ff
    inet brd scope global wlan0
       valid_lft forever preferred_lft forever

I dont know, where I am wrong?


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now