Port forwarding is very slow, only when outbound

Hi everyone,

I am use OpenWrt 18.06.2 running on x86_64 hardware. Outbound is very slow when External port is not equal Internal port.

Port forwarding rules: External port 5201 to 10.0.0.8:5201
iperf3 test:

# iperf3 -c WAN_IP -R
Connecting to host WAN_IP, port 5201
Reverse mode, remote host WAN_IP is sending
[  7] local 10.0.5.24 port 64183 connected to WAN_IP port 5201
[ ID] Interval           Transfer     Bitrate
[  7]   0.00-1.00   sec  3.72 MBytes  31.2 Mbits/sec
[  7]   1.00-2.00   sec  2.74 MBytes  23.0 Mbits/sec
[  7]   2.00-3.00   sec  2.98 MBytes  25.0 Mbits/sec
[  7]   3.00-4.00   sec  3.66 MBytes  30.7 Mbits/sec
[  7]   4.00-5.00   sec  3.09 MBytes  25.9 Mbits/sec
[  7]   5.00-6.00   sec  3.60 MBytes  30.2 Mbits/sec
[  7]   6.00-7.00   sec  3.82 MBytes  32.1 Mbits/sec
[  7]   7.00-8.00   sec  3.56 MBytes  29.8 Mbits/sec
[  7]   8.00-9.00   sec  3.20 MBytes  26.8 Mbits/sec
[  7]   9.00-10.00  sec  2.39 MBytes  20.0 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  7]   0.00-10.00  sec  32.9 MBytes  27.6 Mbits/sec  125             sender
[  7]   0.00-10.00  sec  32.8 MBytes  27.5 Mbits/sec                  receiver

iperf Done.

Port forwarding rules: External port 52010 to 10.0.0.8:5201
iperf3 test:

# iperf3 -c WAN_IP -p 52010 -R
Connecting to host WAN_IP, port 52010
Reverse mode, remote host WAN_IP is sending
[  7] local 10.0.5.24 port 64172 connected to WAN_IP port 52010
[ ID] Interval           Transfer     Bitrate
[  7]   0.00-1.00   sec  5.62 KBytes  46.0 Kbits/sec
[  7]   1.00-2.00   sec  5.62 KBytes  46.0 Kbits/sec
[  7]   2.00-3.00   sec  5.62 KBytes  46.2 Kbits/sec
[  7]   3.00-4.00   sec  4.22 KBytes  34.6 Kbits/sec
[  7]   4.00-5.00   sec  2.81 KBytes  23.0 Kbits/sec
[  7]   5.00-6.00   sec  9.84 KBytes  81.0 Kbits/sec
[  7]   6.00-7.00   sec  12.7 KBytes   104 Kbits/sec
[  7]   7.00-8.00   sec  22.6 KBytes   185 Kbits/sec
[  7]   8.00-9.00   sec  70.7 KBytes   578 Kbits/sec
[  7]   9.00-10.00  sec  59.4 KBytes   488 Kbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  7]   0.00-10.00  sec   218 KBytes   178 Kbits/sec   92             sender
[  7]   0.00-10.00  sec   199 KBytes   163 Kbits/sec                  receiver

iperf Done.

Does anyone know the reason? Please tell me how to solve it.

qdisc? ifb?
10.0.0.8 < iperf local only ( no router traversal ) + hw specs?
iperf minus nat? ( may require trickyness )

No qdisc, no ifb.
iperf by Internet, Not LAN.

I do not understand:

iperf minus nat? ( may require trickyness )

my english is not good.

  • Please tell us about the DNAT endpoint hardware
  • Please test without the router and report speeds
  • Please test without NAT ( via router ) and report speeds

DNAT endpoint hardware:

  • Intel CPU N3700
  • 4 GB Memory
  • Realtek RTL8111 *4

iperf server in openwrt:

# iperf3 -c WAN_IP -p 5201 -R
Connecting to host WAN_IP, port 5201
Reverse mode, remote host WAN_IP is sending
[  7] local 10.0.5.24 port 61749 connected to WAN_IP port 5201
[ ID] Interval           Transfer     Bitrate
[  7]   0.00-1.00   sec  4.37 MBytes  36.6 Mbits/sec
[  7]   1.00-2.00   sec  4.01 MBytes  33.7 Mbits/sec
[  7]   2.00-3.00   sec  4.01 MBytes  33.6 Mbits/sec
[  7]   3.00-4.00   sec  5.06 MBytes  42.5 Mbits/sec
[  7]   4.00-5.00   sec  5.48 MBytes  45.9 Mbits/sec
[  7]   5.00-6.00   sec  5.20 MBytes  43.6 Mbits/sec
[  7]   6.00-7.00   sec  3.96 MBytes  33.2 Mbits/sec
[  7]   7.00-8.00   sec  4.15 MBytes  34.9 Mbits/sec
[  7]   8.00-9.00   sec  4.61 MBytes  38.7 Mbits/sec
[  7]   9.00-10.00  sec  4.54 MBytes  38.1 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  7]   0.00-10.01  sec  45.5 MBytes  38.2 Mbits/sec  126             sender
[  7]   0.00-10.00  sec  45.4 MBytes  38.1 Mbits/sec                  receiver

iperf Done.

iperf client in openwrt:

local only

# iperf3 -c 10.0.0.8 -R
Connecting to host 10.0.0.8, port 5201
Reverse mode, remote host 10.0.0.8 is sending
[  5] local 10.0.0.254 port 60026 connected to 10.0.0.8 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   112 MBytes   941 Mbits/sec
[  5]   1.00-2.00   sec   112 MBytes   941 Mbits/sec
[  5]   2.00-3.00   sec   112 MBytes   942 Mbits/sec
[  5]   3.00-4.00   sec   112 MBytes   942 Mbits/sec
[  5]   4.00-5.00   sec   112 MBytes   942 Mbits/sec
[  5]   5.00-6.00   sec   112 MBytes   941 Mbits/sec
[  5]   6.00-7.00   sec   112 MBytes   941 Mbits/sec
[  5]   7.00-8.00   sec   112 MBytes   942 Mbits/sec
[  5]   8.00-9.00   sec   112 MBytes   941 Mbits/sec
[  5]   9.00-10.00  sec   112 MBytes   941 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  1.10 GBytes   943 Mbits/sec    0             sender
[  5]   0.00-10.00  sec  1.10 GBytes   941 Mbits/sec                  receiver

iperf Done.

Can't test without the router, need go home.

1 Like

@antonchen
hi, did you fix that problem? i have that same problem with my forwarded port. when i connect outside/inside my network with IP:forwardedport it takes looooong time to load page but when i use inside ip and port it is ok...

This problem is not fixed.

1 Like

same situation on both of my wrt1900acs and a x86 router
openwrt 19.07.5

any news about this problem? i see that it is still there ;/

Are you all saying that using a redirect from LAN is slow; but testing with a host from the Internet (WAN) works?

Interesting problem.

Please run the following commands (copy-paste the whole block) and paste the output here, using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have

ubus call system board; \
uci export network; uci export dhcp; uci export firewall; \
head -n -0 /etc/firewall.user; \
iptables-save -c; \
ip -4 addr ; ip -4 ro li tab all ; ip -4 ru
1 Like

This problem still persists. I belive it's related to flow offloading.

1 Like

It's related to flow offloading.

I have a device running openwrt with kernel 4.19.75, if flow offloading is disabled, port forwarding speed around 7MB/s, but if flow offloading enabled, port forwarding will slow down to 50KB-500KB/s.