UDP port forwarding not working, TCP port forward works

I am having trouble getting port forwarding to work for UDP. In this case I opened port 43500.
For TCP it works just fine. For UDP, the port does not show open when tested and I captured a single udp package going from WAN to BR-LAN. Also attached my firewall rules. I disabled any software firewall on my PC for this test. Not sure where else to look.


root@OpenWrt:~# tcpdump -e -v -i eth0 udp port 43500
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
04:06:43.640979 <MAC> (oui Unknown) > <MAC> (oui Unknown), ethertype 802.1Q (0x8100), length 64: vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 49, id 57114, offset 0, flags [DF], proto UDP (17), length 39)
    www.emule-project.net.56340 > ###-###-###-###.res.spectrum.com.43500: UDP, length 11

root@OpenWrt:~# tcpdump -e -v -i br-lan udp port 43500
tcpdump: listening on br-lan, link-type EN10MB (Ethernet), capture size 262144 bytes
04:11:00.921760 <MAC> (oui Unknown) > <MAC> (oui Unknown), ethertype IPv4 (0x0800), length 53: (tos 0x0, ttl 48, id 62537, offset 0, flags [DF], proto UDP (17), length 39)
    192.168.1.1.52698 > 192.168.1.158.43500: UDP, length 11


Firewall rule:


root@OpenWrt:~# uci show firewall
firewall.@defaults[0]=defaults
firewall.@defaults[0].syn_flood='1'
firewall.@defaults[0].input='ACCEPT'
firewall.@defaults[0].output='ACCEPT'
firewall.@defaults[0].forward='REJECT'
firewall.@zone[0]=zone
firewall.@zone[0].name='lan'
firewall.@zone[0].network='lan'
firewall.@zone[0].input='ACCEPT'
firewall.@zone[0].output='ACCEPT'
firewall.@zone[0].forward='ACCEPT'
firewall.@zone[1]=zone
firewall.@zone[1].name='wan'
firewall.@zone[1].network='wan' 'wan6'
firewall.@zone[1].input='REJECT'
firewall.@zone[1].output='ACCEPT'
firewall.@zone[1].forward='REJECT'
firewall.@zone[1].masq='1'
firewall.@zone[1].mtu_fix='1'
firewall.@forwarding[0]=forwarding
firewall.@forwarding[0].src='lan'
firewall.@forwarding[0].dest='wan'
firewall.@rule[0]=rule
firewall.@rule[0].name='Allow-DHCP-Renew'
firewall.@rule[0].src='wan'
firewall.@rule[0].proto='udp'
firewall.@rule[0].dest_port='68'
firewall.@rule[0].target='ACCEPT'
firewall.@rule[0].family='ipv4'
firewall.@rule[1]=rule
firewall.@rule[1].name='Allow-Ping'
firewall.@rule[1].src='wan'
firewall.@rule[1].proto='icmp'
firewall.@rule[1].icmp_type='echo-request'
firewall.@rule[1].family='ipv4'
firewall.@rule[1].target='ACCEPT'
firewall.@rule[2]=rule
firewall.@rule[2].name='Allow-IGMP'
firewall.@rule[2].src='wan'
firewall.@rule[2].proto='igmp'
firewall.@rule[2].family='ipv4'
firewall.@rule[2].target='ACCEPT'
firewall.@rule[3]=rule
firewall.@rule[3].name='Allow-DHCPv6'
firewall.@rule[3].src='wan'
firewall.@rule[3].proto='udp'
firewall.@rule[3].src_ip='fc00::/6'
firewall.@rule[3].dest_ip='fc00::/6'
firewall.@rule[3].dest_port='546'
firewall.@rule[3].family='ipv6'
firewall.@rule[3].target='ACCEPT'
firewall.@rule[4]=rule
firewall.@rule[4].name='Allow-MLD'
firewall.@rule[4].src='wan'
firewall.@rule[4].proto='icmp'
firewall.@rule[4].src_ip='fe80::/10'
firewall.@rule[4].icmp_type='130/0' '131/0' '132/0' '143/0'
firewall.@rule[4].family='ipv6'
firewall.@rule[4].target='ACCEPT'
firewall.@rule[5]=rule
firewall.@rule[5].name='Allow-ICMPv6-Input'
firewall.@rule[5].src='wan'
firewall.@rule[5].proto='icmp'
firewall.@rule[5].icmp_type='echo-request' 'echo-reply' 'destination-unreachable' 'packet-too-big' 'time-exceeded' 'bad-header' 'unknown-header-type' 'router-solicitation' 'neighbour-solicitation' 'router-advertisement' 'neighbour-advertisement'
firewall.@rule[5].limit='1000/sec'
firewall.@rule[5].family='ipv6'
firewall.@rule[5].target='ACCEPT'
firewall.@rule[6]=rule
firewall.@rule[6].name='Allow-ICMPv6-Forward'
firewall.@rule[6].src='wan'
firewall.@rule[6].dest='*'
firewall.@rule[6].proto='icmp'
firewall.@rule[6].icmp_type='echo-request' 'echo-reply' 'destination-unreachable' 'packet-too-big' 'time-exceeded' 'bad-header' 'unknown-header-type'
firewall.@rule[6].limit='1000/sec'
firewall.@rule[6].family='ipv6'
firewall.@rule[6].target='ACCEPT'
firewall.@rule[7]=rule
firewall.@rule[7].name='Allow-IPSec-ESP'
firewall.@rule[7].src='wan'
firewall.@rule[7].dest='lan'
firewall.@rule[7].proto='esp'
firewall.@rule[7].target='ACCEPT'
firewall.@rule[8]=rule
firewall.@rule[8].name='Allow-ISAKMP'
firewall.@rule[8].src='wan'
firewall.@rule[8].dest='lan'
firewall.@rule[8].dest_port='500'
firewall.@rule[8].proto='udp'
firewall.@rule[8].target='ACCEPT'
firewall.@include[0]=include
firewall.@include[0].path='/etc/firewall.user'
firewall.@redirect[0]=redirect
firewall.@redirect[0].src='wan'
firewall.@redirect[0].name='Torrent'
firewall.@redirect[0].target='DNAT'
firewall.@redirect[0].dest='lan'
firewall.@redirect[0].dest_port='20696'
firewall.@redirect[0].dest_ip='192.168.1.158'
firewall.@redirect[0].src_dport='20696'
firewall.@redirect[1]=redirect
firewall.@redirect[1].dest_port='43500'
firewall.@redirect[1].src='wan'
firewall.@redirect[1].src_dport='43500'
firewall.@redirect[1].target='DNAT'
firewall.@redirect[1].dest='lan'
firewall.@redirect[1].dest_ip='192.168.1.158'
firewall.@redirect[1].name='eMule'
firewall.@redirect[1].proto='tcp' 'udp'

1 Like

UDP normally does not reply to port scans.

The test was from website, it works when I am using a vpn and passing a port. Is there another way to test?

You can check the relevant traffic passthrough like this:

tcpdump -evni any udp port 43500

The rest is basically unrelated to OpenWrt and depends on the destination host.

1 Like