BPI-R2 How to Config for NAT


(Yusuf Bülbül) #1

Hi, I want use BPI-R2 like modem on lastest ubuntu image. I want to make NAT, WAN to LAN. How can I make this on Ubuntu Image ? Or Can I make?


(Yusuf Bülbül) #2

that is the link which tell how to config NAT.

http://www.nairabytes.net/81-linux/418-how-to-set-up-a-nat-router-on-ubuntu-server-16-04


(Frank W.) #3

Started a separate page for network-setup: http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:network:start#natrouting


(gary) #4

Please note that the hardware NAT(HNAT) is NOT supported in current Ubuntu image with 4.4 kernel, all packets will be forwarded by linux kernel, so the performance is not good.


(xbgmsharp) #5

To clarified, to HNAT, we can use the same subset of command, eg: iptables?


(Frank W.) #6

Except ledes 4.9 kernel no other kernel currently support hnat.

It seems that hnat needs second gmac (selecting upstream port), i can’t get that working (tried with ledes 4.14 patches) so hnat also failes


(gary) #7

I checked the code, in theory the HNAT works if we use iptables to create/delete/modify forwarding rule, but I don’t validate it, can you please do it by following below steps:

  1. Create a forwarding rule
  2. Make sure the traffic is available,
  3. Check the all forwarding entries in hardware, please use the debugfs hnat
  4. And please check if there are few or no interrupts on eth0 and eth1.

(Yusuf Bülbül) #8

Hi, I can forward eth1 packets to eth0 with iptables. It seems fine. How can I measure forwarding performance?


(Frank W.) #9

which Kernel do you have running? eth0 and eth1 as direct interfaces are only in 4.4 where no hnat is available.

For hnat you can make

cat /proc/interrupt

Also you can measure throughput with iperf