[SOLVED] Problem with port forwarding

I recently switched from td-lte to adsl.
the td-lte had a modem that gave out a Ethernet connection that I would connect to my openwrt-enabled router/AP.
the td-lte modem had a dmz option which I would enable and then use port forwarding on my openwrt.

now my adsl (which is what I used before td-lte) has a modem that also has a dmz option too.
I have tried with using pppoe on adsl modem and also with bridge mode and pppoe on my openwrt router. but what ever I do I dont see my port from internet (ports are not open).

is there something that I am missing?
could this be my ISP firewall stopping incoming connections that are not originating from my side? I have asked them and they say no, but I could only ask from level 1 help service that are not really knowlegeable and was trying to convince my that my problem was that I didnt have static ip and I needed to buy that, and would just say that "we dont block ports"

when I ping my public ip from my mobile phone I get the massage that destination port unreachable.
I played around with firewall in luci and saw that if I change the wan rule for input to accept from reject I can ping my public ip but my ssh port forwarding still doesnt work.

I think this is not advised way to configure the wan side but I was just testing to see if anything changes.

also am I correct to assume that if I put the modem in bridge mode I dont have to enable dmz on it? as in all the connection and firewall are managed by my openwrt device?

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 firewall; \
head -n -0 /etc/firewall.user; \
iptables-save -c; \
ip -4 addr ; ip -4 ro li tab all ; ip -4 ru

Yes, then OpenWrt runs PPPoE and gets the public wan IP.

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

{
        "kernel": "4.14.229",
        "hostname": "openwrt",
        "system": "ARMv7 Processor rev 1 (v7l)",
        "model": "Linksys WRT1200AC",
        "board_name": "linksys,caiman",
        "release": {
                "distribution": "OpenWrt",
                "version": "19.07-SNAPSHOT",
                "revision": "r11333-cc0b70467d",
                "target": "mvebu/cortexa9",
                "description": "OpenWrt 19.07-SNAPSHOT r11333-cc0b70467d"
        }
}
package network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth1'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option delegate '0'
        option ipv6 '0'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3 6'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '4 5'

config interface 'adsl_modem'
        option ifname 'eth0'
        option proto 'dhcp'

package firewall

config defaults
        option input 'ACCEPT'
        option output 'ACCEPT'
        option synflood_protect '1'
        option forward 'REJECT'

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        list network 'lan'

config zone
        option name 'wan'
        option output 'ACCEPT'
        option masq '1'
        option mtu_fix '1'
        option input 'REJECT'
        option forward 'REJECT'
        list network 'adsl_modem'

config forwarding
        option src 'lan'
        option dest 'wan'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'
        option enabled '0'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'
        option enabled '0'

config rule
        option name 'Allow-IGMP'
        option src 'wan'
        option proto 'igmp'
        option family 'ipv4'
        option target 'ACCEPT'
        option enabled '0'

config include
        option path '/etc/firewall.user'

config rule
        option dest 'wan'
        option dest_ip '10.10.34.0/24'
        option target 'DROP'
        option name 'to 10.10.34.0/24'
        option src 'lan'
        option proto 'tcp udp'

config rule
        option proto 'all'
        option src 'wan'
        option target 'DROP'
        option src_ip '10.10.34.0/24'
        option name 'from 10.10.34.0/24'
        option dest 'lan'

config redirect
        option target 'DNAT'
        option src 'wan'
        option dest 'lan'
        option dest_ip '192.168.1.20'
        option dest_port '1800-1802'
        option src_dport '1800-1802'
        option name 'odroid-torrent'
        list proto 'tcp'
        list proto 'udp'

config redirect
        option target 'DNAT'
        option src 'wan'
        option dest 'lan'
        option proto 'tcp'
        option dest_port '22'
        option name 'wan-ssh'
        option src_dport '1822'
        option dest_ip '192.168.1.1'

config redirect 'adblock_dns'
        option src 'lan'
        option src_dport '53'
        option dest_port '53'
        option target 'DNAT'
        option proto 'udp'
        option dest 'lan'
        option dest_ip '192.168.1.1'
        option name 'force local DNS'

config redirect
        option target 'DNAT'
        option src 'wan'
        option dest 'lan'
        option src_dport '14662'
        option dest_port '14662'
        option proto 'tcp udp'
        option dest_ip '192.168.1.20'
        option name 'odroid-amule-tcp-udp'

config redirect
        option dest_port '1083'
        option src 'wan'
        option name 'odroid freshrss'
        option target 'DNAT'
        option dest_ip '192.168.1.20'
        option dest 'lan'
        option src_dport '11083'

# This file is interpreted as shell script.
# Put your custom iptables rules here, they will
# be executed with each firewall (re-)start.

# Internal uci firewall chains are flushed and recreated on reload, so
# put custom rules into the root chains e.g. INPUT or FORWARD or into the
# special user chains, e.g. input_wan_rule or postrouting_lan_rule.

ipset destroy myfilterset
ipset create myfilterset iphash

ipset destroy telegram
ipset create telegram iphash
ipset add telegram 149.154.160.0/20
ipset add telegram 91.108.12.0/22
ipset add telegram 91.108.16.0/22
ipset add telegram 91.108.4.0/22
ipset add telegram 91.108.56.0/22
ipset add telegram 91.108.8.0/22

iptables -t nat -A PREROUTING  -p tcp -d 10.192.0.0/11 -j REDIRECT --to-port 9039;

# acts on lan processes
iptables -t nat -A PREROUTING  -p tcp -m tcp -m set --match-set myfilterset dst -m multiport --dports 80,443 -j REDIRECT --to-ports 9040;

#telegram
iptables -t nat -A PREROUTING  -p tcp -m tcp -m set --match-set telegram dst -m multiport --dports 80,443 -j REDIRECT --to-ports 9040;

# acts on processes on openwrt
#iptables -t nat -A OUTPUT      -p tcp -m tcp -m set --match-set myfilterset dst -m multiport --dports 80,443 -j REDIRECT --to-ports 9040;

# for magnetico
#iptables -I PREROUTING -t raw -p udp --sport 59260 -j CT --notrack
#iptables -I POSTROUTIONG -t raw -p udp --dport 59260 -j CT --notrack

#ipfs 4001 bootstrap @104.131.131.82/tcp/4001
#iptables -t nat -A PREROUTING  -p tcp -m tcp --destination 104.131.131.82  --dport 4001 -j REDIRECT --to-port 9040;

/etc/init.d/dnsmasq restart
# Generated by iptables-save v1.8.3 on Thu Apr 29 14:16:56 2021
*nat
:PREROUTING ACCEPT [134180:13802801]
:INPUT ACCEPT [5428:396798]
:OUTPUT ACCEPT [12867:2257747]
:POSTROUTING ACCEPT [56405:6127788]
:postrouting_lan_rule - [0:0]
:postrouting_rule - [0:0]
:postrouting_wan_rule - [0:0]
:prerouting_lan_rule - [0:0]
:prerouting_rule - [0:0]
:prerouting_wan_rule - [0:0]
:zone_lan_postrouting - [0:0]
:zone_lan_prerouting - [0:0]
:zone_wan_postrouting - [0:0]
:zone_wan_prerouting - [0:0]
[0:0] -A PREROUTING -d 10.192.0.0/11 -p tcp -j REDIRECT --to-ports 9039
[0:0] -A PREROUTING -p tcp -m tcp -m set --match-set myfilterset dst -m multiport --dports 80,443 -j REDIRECT --to-ports 9040
[78:4680] -A PREROUTING -p tcp -m tcp -m set --match-set telegram dst -m multiport --dports 80,443 -j REDIRECT --to-ports 9040
[192168:20042200] -A PREROUTING -m comment --comment "!fw3: Custom prerouting rule chain" -j prerouting_rule
[130449:13512977] -A PREROUTING -i br-lan -m comment --comment "!fw3" -j zone_lan_prerouting
[61719:6529223] -A PREROUTING -i eth0 -m comment --comment "!fw3" -j zone_wan_prerouting
[188320:20494864] -A POSTROUTING -m comment --comment "!fw3: Custom postrouting rule chain" -j postrouting_rule
[52719:5886440] -A POSTROUTING -o br-lan -m comment --comment "!fw3" -j zone_lan_postrouting
[131915:14367076] -A POSTROUTING -o eth0 -m comment --comment "!fw3" -j zone_wan_postrouting
[52719:5886440] -A zone_lan_postrouting -m comment --comment "!fw3: Custom lan postrouting rule chain" -j postrouting_lan_rule
[0:0] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.20/32 -p tcp -m tcp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent (reflection)" -j SNAT --to-source 192.168.1.1
[0:0] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.20/32 -p udp -m udp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent (reflection)" -j SNAT --to-source 192.168.1.1
[0:0] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.1/32 -p tcp -m tcp --dport 22 -m comment --comment "!fw3: wan-ssh (reflection)" -j SNAT --to-source 192.168.1.1
[0:0] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.20/32 -p tcp -m tcp --dport 14662 -m comment --comment "!fw3: odroid-amule-tcp-udp (reflection)" -j SNAT --to-source 192.168.1.1
[0:0] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.20/32 -p udp -m udp --dport 14662 -m comment --comment "!fw3: odroid-amule-tcp-udp (reflection)" -j SNAT --to-source 192.168.1.1
[0:0] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.20/32 -p tcp -m tcp --dport 1083 -m comment --comment "!fw3: odroid freshrss (reflection)" -j SNAT --to-source 192.168.1.1
[0:0] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.20/32 -p udp -m udp --dport 1083 -m comment --comment "!fw3: odroid freshrss (reflection)" -j SNAT --to-source 192.168.1.1
[130449:13512977] -A zone_lan_prerouting -m comment --comment "!fw3: Custom lan prerouting rule chain" -j prerouting_lan_rule
[0:0] -A zone_lan_prerouting -s 192.168.1.0/24 -d 192.168.2.2/32 -p tcp -m tcp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent (reflection)" -j DNAT --to-destination 192.168.1.20:1800-1802
[0:0] -A zone_lan_prerouting -s 192.168.1.0/24 -d 192.168.2.2/32 -p udp -m udp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent (reflection)" -j DNAT --to-destination 192.168.1.20:1800-1802
[0:0] -A zone_lan_prerouting -s 192.168.1.0/24 -d 192.168.2.2/32 -p tcp -m tcp --dport 1822 -m comment --comment "!fw3: wan-ssh (reflection)" -j DNAT --to-destination 192.168.1.1:22
[5273:354276] -A zone_lan_prerouting -p udp -m udp --dport 53 -m comment --comment "!fw3: force local DNS" -j DNAT --to-destination 192.168.1.1:53
[0:0] -A zone_lan_prerouting -s 192.168.1.0/24 -d 192.168.2.2/32 -p tcp -m tcp --dport 14662 -m comment --comment "!fw3: odroid-amule-tcp-udp (reflection)" -j DNAT --to-destination 192.168.1.20:14662
[0:0] -A zone_lan_prerouting -s 192.168.1.0/24 -d 192.168.2.2/32 -p udp -m udp --dport 14662 -m comment --comment "!fw3: odroid-amule-tcp-udp (reflection)" -j DNAT --to-destination 192.168.1.20:14662
[0:0] -A zone_lan_prerouting -s 192.168.1.0/24 -d 192.168.2.2/32 -p tcp -m tcp --dport 11083 -m comment --comment "!fw3: odroid freshrss (reflection)" -j DNAT --to-destination 192.168.1.20:1083
[0:0] -A zone_lan_prerouting -s 192.168.1.0/24 -d 192.168.2.2/32 -p udp -m udp --dport 11083 -m comment --comment "!fw3: odroid freshrss (reflection)" -j DNAT --to-destination 192.168.1.20:1083
[131915:14367076] -A zone_wan_postrouting -m comment --comment "!fw3: Custom wan postrouting rule chain" -j postrouting_wan_rule
[131915:14367076] -A zone_wan_postrouting -m comment --comment "!fw3" -j MASQUERADE
[61719:6529223] -A zone_wan_prerouting -m comment --comment "!fw3: Custom wan prerouting rule chain" -j prerouting_wan_rule
[6:648] -A zone_wan_prerouting -p tcp -m tcp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent" -j DNAT --to-destination 192.168.1.20:1800-1802
[41503:5038813] -A zone_wan_prerouting -p udp -m udp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent" -j DNAT --to-destination 192.168.1.20:1800-1802
[0:0] -A zone_wan_prerouting -p tcp -m tcp --dport 1822 -m comment --comment "!fw3: wan-ssh" -j DNAT --to-destination 192.168.1.1:22
[0:0] -A zone_wan_prerouting -p tcp -m tcp --dport 14662 -m comment --comment "!fw3: odroid-amule-tcp-udp" -j DNAT --to-destination 192.168.1.20:14662
[11206:845662] -A zone_wan_prerouting -p udp -m udp --dport 14662 -m comment --comment "!fw3: odroid-amule-tcp-udp" -j DNAT --to-destination 192.168.1.20:14662
[0:0] -A zone_wan_prerouting -p tcp -m tcp --dport 11083 -m comment --comment "!fw3: odroid freshrss" -j DNAT --to-destination 192.168.1.20:1083
[0:0] -A zone_wan_prerouting -p udp -m udp --dport 11083 -m comment --comment "!fw3: odroid freshrss" -j DNAT --to-destination 192.168.1.20:1083
COMMIT
# Completed on Thu Apr 29 14:16:56 2021
# Generated by iptables-save v1.8.3 on Thu Apr 29 14:16:56 2021
*raw
:PREROUTING ACCEPT [5656639:3283093132]
:OUTPUT ACCEPT [55581:18219987]
:zone_lan_helper - [0:0]
[2575970:342390888] -A PREROUTING -i br-lan -m comment --comment "!fw3: lan CT helper assignment" -j zone_lan_helper
COMMIT
# Completed on Thu Apr 29 14:16:56 2021
# Generated by iptables-save v1.8.3 on Thu Apr 29 14:16:56 2021
*mangle
:PREROUTING ACCEPT [5656639:3283093132]
:INPUT ACCEPT [59499:15677969]
:FORWARD ACCEPT [5594774:3266646118]
:OUTPUT ACCEPT [55581:18219987]
:POSTROUTING ACCEPT [5649581:3284799934]
[177800:10668000] -A FORWARD -o eth0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "!fw3: Zone wan MTU fixing" -j TCPMSS --clamp-mss-to-pmtu
[63703:3627172] -A FORWARD -i eth0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "!fw3: Zone wan MTU fixing" -j TCPMSS --clamp-mss-to-pmtu
COMMIT
# Completed on Thu Apr 29 14:16:56 2021
# Generated by iptables-save v1.8.3 on Thu Apr 29 14:16:56 2021
*filter
:INPUT ACCEPT [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
:forwarding_lan_rule - [0:0]
:forwarding_rule - [0:0]
:forwarding_wan_rule - [0:0]
:input_lan_rule - [0:0]
:input_rule - [0:0]
:input_wan_rule - [0:0]
:output_lan_rule - [0:0]
:output_rule - [0:0]
:output_wan_rule - [0:0]
:reject - [0:0]
:syn_flood - [0:0]
:zone_lan_dest_ACCEPT - [0:0]
:zone_lan_dest_DROP - [0:0]
:zone_lan_forward - [0:0]
:zone_lan_input - [0:0]
:zone_lan_output - [0:0]
:zone_lan_src_ACCEPT - [0:0]
:zone_test_forward - [0:0]
:zone_test_input - [0:0]
:zone_test_output - [0:0]
:zone_wan_dest_ACCEPT - [0:0]
:zone_wan_dest_DROP - [0:0]
:zone_wan_dest_REJECT - [0:0]
:zone_wan_forward - [0:0]
:zone_wan_input - [0:0]
:zone_wan_output - [0:0]
:zone_wan_src_REJECT - [0:0]
[8200:1167417] -A INPUT -i lo -m comment --comment "!fw3" -j ACCEPT
[51299:14510552] -A INPUT -m comment --comment "!fw3: Custom input rule chain" -j input_rule
[30190:12880557] -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -m comment --comment "!fw3" -j ACCEPT
[104:6240] -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m comment --comment "!fw3" -j syn_flood
[10134:904342] -A INPUT -i br-lan -m comment --comment "!fw3" -j zone_lan_input
[10975:725653] -A INPUT -i eth0 -m comment --comment "!fw3" -j zone_wan_input
[5594774:3266646118] -A FORWARD -m comment --comment "!fw3: Custom forwarding rule chain" -j forwarding_rule
[5298468:3238380546] -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -m comment --comment "!fw3" -j ACCEPT
[226683:21135854] -A FORWARD -i br-lan -m comment --comment "!fw3" -j zone_lan_forward
[69623:7129718] -A FORWARD -i eth0 -m comment --comment "!fw3" -j zone_wan_forward
[0:0] -A FORWARD -m comment --comment "!fw3" -j reject
[8166:1164697] -A OUTPUT -o lo -m comment --comment "!fw3" -j ACCEPT
[47415:17055290] -A OUTPUT -m comment --comment "!fw3: Custom output rule chain" -j output_rule
[38093:15028554] -A OUTPUT -m conntrack --ctstate RELATED,ESTABLISHED -m comment --comment "!fw3" -j ACCEPT
[8:2634] -A OUTPUT -o br-lan -m comment --comment "!fw3" -j zone_lan_output
[9314:2024102] -A OUTPUT -o eth0 -m comment --comment "!fw3" -j zone_wan_output
[1976:81893] -A reject -p tcp -m comment --comment "!fw3" -j REJECT --reject-with tcp-reset
[8999:643760] -A reject -m comment --comment "!fw3" -j REJECT --reject-with icmp-port-unreachable
[104:6240] -A syn_flood -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m limit --limit 25/sec --limit-burst 50 -m comment --comment "!fw3" -j RETURN
[0:0] -A syn_flood -m comment --comment "!fw3" -j DROP
[8:2634] -A zone_lan_dest_ACCEPT -o br-lan -m comment --comment "!fw3" -j ACCEPT
[0:0] -A zone_lan_dest_DROP -o br-lan -m comment --comment "!fw3" -j DROP
[226683:21135854] -A zone_lan_forward -m comment --comment "!fw3: Custom lan forwarding rule chain" -j forwarding_lan_rule
[0:0] -A zone_lan_forward -d 10.10.34.0/24 -p tcp -m comment --comment "!fw3: to 10.10.34.0/24" -j zone_wan_dest_DROP
[0:0] -A zone_lan_forward -d 10.10.34.0/24 -p udp -m comment --comment "!fw3: to 10.10.34.0/24" -j zone_wan_dest_DROP
[226683:21135854] -A zone_lan_forward -m comment --comment "!fw3: Zone lan to wan forwarding policy" -j zone_wan_dest_ACCEPT
[0:0] -A zone_lan_forward -m conntrack --ctstate DNAT -m comment --comment "!fw3: Accept port forwards" -j ACCEPT
[0:0] -A zone_lan_forward -m comment --comment "!fw3" -j zone_lan_dest_ACCEPT
[10134:904342] -A zone_lan_input -m comment --comment "!fw3: Custom lan input rule chain" -j input_lan_rule
[77:4620] -A zone_lan_input -m conntrack --ctstate DNAT -m comment --comment "!fw3: Accept port redirections" -j ACCEPT
[10057:899722] -A zone_lan_input -m comment --comment "!fw3" -j zone_lan_src_ACCEPT
[8:2634] -A zone_lan_output -m comment --comment "!fw3: Custom lan output rule chain" -j output_lan_rule
[8:2634] -A zone_lan_output -m comment --comment "!fw3" -j zone_lan_dest_ACCEPT
[10057:899722] -A zone_lan_src_ACCEPT -i br-lan -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "!fw3" -j ACCEPT
[774:66171] -A zone_wan_dest_ACCEPT -o eth0 -m conntrack --ctstate INVALID -m comment --comment "!fw3: Prevent NAT leakage" -j DROP
[235223:23093785] -A zone_wan_dest_ACCEPT -o eth0 -m comment --comment "!fw3" -j ACCEPT
[0:0] -A zone_wan_dest_DROP -o eth0 -m comment --comment "!fw3" -j DROP
[0:0] -A zone_wan_dest_REJECT -o eth0 -m comment --comment "!fw3" -j reject
[69623:7129718] -A zone_wan_forward -m comment --comment "!fw3: Custom wan forwarding rule chain" -j forwarding_wan_rule
[0:0] -A zone_wan_forward -s 10.10.34.0/24 -m comment --comment "!fw3: from 10.10.34.0/24" -j zone_lan_dest_DROP
[69623:7129718] -A zone_wan_forward -m conntrack --ctstate DNAT -m comment --comment "!fw3: Accept port forwards" -j ACCEPT
[0:0] -A zone_wan_forward -m comment --comment "!fw3" -j zone_wan_dest_REJECT
[10975:725653] -A zone_wan_input -m comment --comment "!fw3: Custom wan input rule chain" -j input_wan_rule
[0:0] -A zone_wan_input -m conntrack --ctstate DNAT -m comment --comment "!fw3: Accept port redirections" -j ACCEPT
[10975:725653] -A zone_wan_input -m comment --comment "!fw3" -j zone_wan_src_REJECT
[9314:2024102] -A zone_wan_output -m comment --comment "!fw3: Custom wan output rule chain" -j output_wan_rule
[9314:2024102] -A zone_wan_output -m comment --comment "!fw3" -j zone_wan_dest_ACCEPT
[10975:725653] -A zone_wan_src_REJECT -i eth0 -m comment --comment "!fw3" -j reject
COMMIT
# Completed on Thu Apr 29 14:16:56 2021
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 532
    inet 192.168.2.2/24 brd 192.168.2.255 scope global eth0
       valid_lft forever preferred_lft forever
7: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    inet 192.168.1.1/24 brd 192.168.1.255 scope global br-lan
       valid_lft forever preferred_lft forever
default via 192.168.2.1 dev eth0 proto static src 192.168.2.2 
192.168.1.0/24 dev br-lan proto kernel scope link src 192.168.1.1 
192.168.2.0/24 dev eth0 proto kernel scope link src 192.168.2.2 
broadcast 127.0.0.0 dev lo table local proto kernel scope link src 127.0.0.1 
local 127.0.0.0/8 dev lo table local proto kernel scope host src 127.0.0.1 
local 127.0.0.1 dev lo table local proto kernel scope host src 127.0.0.1 
broadcast 127.255.255.255 dev lo table local proto kernel scope link src 127.0.0.1 
broadcast 192.168.1.0 dev br-lan table local proto kernel scope link src 192.168.1.1 
local 192.168.1.1 dev br-lan table local proto kernel scope host src 192.168.1.1 
broadcast 192.168.1.255 dev br-lan table local proto kernel scope link src 192.168.1.1 
broadcast 192.168.2.0 dev eth0 table local proto kernel scope link src 192.168.2.2 
local 192.168.2.2 dev eth0 table local proto kernel scope host src 192.168.2.2 
broadcast 192.168.2.255 dev eth0 table local proto kernel scope link src 192.168.2.2 
0:      from all lookup local 
32766:  from all lookup main 
32767:  from all lookup default 

right now it is not in bridge mode but as I said I tested with bridge too.
maybe bridge is better.
if the issue is found even better.

First you have disabled the rule to allow ping from wan. If you need it, you'd better enable it rather than changing wan input to accept.
The rule 'from 10.10.34.0/24' is not needed.
Redirect wan-ssh should be a rule, not a redirect.
Other than that you have hits on some DNAT rules:

[6:648] -A zone_wan_prerouting -p tcp -m tcp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent" -j DNAT --to-destination 192.168.1.20:1800-1802
[41503:5038813] -A zone_wan_prerouting -p udp -m udp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent" -j DNAT --to-destination 192.168.1.20:1800-1802
[0:0] -A zone_wan_prerouting -p tcp -m tcp --dport 1822 -m comment --comment "!fw3: wan-ssh" -j DNAT --to-destination 192.168.1.1:22
[0:0] -A zone_wan_prerouting -p tcp -m tcp --dport 14662 -m comment --comment "!fw3: odroid-amule-tcp-udp" -j DNAT --to-destination 192.168.1.20:14662
[11206:845662] -A zone_wan_prerouting -p udp -m udp --dport 14662 -m comment --comment "!fw3: odroid-amule-tcp-udp" -j DNAT --to-destination 192.168.1.20:14662
[0:0] -A zone_wan_prerouting -p tcp -m tcp --dport 11083 -m comment --comment "!fw3: odroid freshrss" -j DNAT --to-destination 192.168.1.20:1083
[0:0] -A zone_wan_prerouting -p udp -m udp --dport 11083 -m comment --comment "!fw3: odroid freshrss" -j DNAT --to-destination 192.168.1.20:1083

So it seems that the DMZ you have on the modem is working, at least partially.

1 Like

1
the hits may be because I incorrectly tested first from my mobile by using the public ip but with my mobile phone still connected to home wifi?
I mean I also pinged my openwrt wan ip from my mobile phone I saw 2ms pings which only third world internet and speccialy on my adsl shocked me and showed my error that I was still connected to my home wifi with my phone.

can I restart my openwrt and then test again to be sure? with the same commands you put here?

2
also the 10.10.34... thing is the internal ip the censures use on iranian network for redirecting http ( which can be redirected unlike https) to a custom page that says the website is blocked.
I now use my own dns config so maybe that is not needed anymore.

3
the rule for disallowing ping from wan is where?
this openwrt config is result of some updates that I didnt use clean install (from after lede I think)
and I am not a network pro but use linux daily (just like it more that windows' trash) so if you says where the file is I can edit it my self.

4
is there a way to see iptables hits logs in realtime?
I suppose it is but I dont know where to set it to test for my rules.
what you told me to use is not real-time right?
this way I can debug more of my problems myself.

5
I dont understand this part:
"Redirect wan-ssh should be a rule, not a redirect."

6
the iptable-save -c command just saves rules right?
it doesnt show the hits correct?
so I dont know from where you see the hits.
those shows are rules not hits
UPDATE:
those numbers in the brackets are hits?
so my ssh redirect doesnt work but the torrent part does?
because when I use the rutorrent interface to check for open port at 1800 or use this website
https://www.yougetsignal.com/tools/open-ports/ both show closed.
can the package path get messed with internally after that rule resulting in not reaching my torrent client?

does this have anything to do with connecting to modem via lan that my openwrt get two ips one for 192.168.1.1 and one from that lan for 192.168.2.2 (via that modem dhcp)
even when I connect via bridge to internet I can still add an interface to openwrt that goes through the same lan and connects via dhcp.
though I enabled and disabled this and the result didn't change.

in you opinion my best way to manage my internet connection is to bridge from my openwrt to modem and then manage ports because you said that firewall and dmz of modem don't interfere then right? because I read somewhere that many home modem/router don't really respect that.

The rule is Allow-Ping which is in the default config and enabled, so the router will answer pings on the WAN though other input is rejected.

Similarly allowing SSH login from the wan is a rule to allow TCP port 22 in to the router OS, not forward it to the LAN.

1 Like

I dont understand.
as I said I usually just copy paste command in linux with respect to ip and iptable commands.
when you say default one is that you mean I removed it right?
UPDATE: I enabled it and it works for ping.ty.

the second part I dont understand.
when I port forward from 1822 on openwrt to a lan client on port 22 what that has to do with port 22 on router os (which you mean openwrt right?)

I am not trying to connect to port 22 on router I am trying to connect to port 22 on a lan ip (which can be 192.168.1.1 for openwrt/router or a lan client like 192.168.1.20) so I forward from 1822 wan to 22 on lan. I have changed the dest ip from .1 to .20 and still I can ssh to it from wan on my mobile.

though now that I changed it from 1 to 20 my error massage is not the "destination port unreachable." but connection time out.

also all my redirects(port forwards) are to a lan client other than openwrt itself now.

btw if it is not clear all of these rules worked with my last modem (tdlte) without any change.
thats why I want to be sure that it is not my isp or my modem.
thats why I asked to see if I can see iptable events in realtime.

I see this getting bigger and bigger
[649:79322] -A zone_wan_prerouting -p udp -m udp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent" -j DNAT --to-destination 192.168.1.20:1800-1802

but other one from

openwrt# iptables-save -c |grep 1800
[0:0] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.20/32 -p tcp -m tcp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent (reflection)" -j SNAT --to-source 192.168.1.1
[0:0] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.20/32 -p udp -m udp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent (reflection)" -j SNAT --to-source 192.168.1.1
[0:0] -A zone_lan_prerouting -s 192.168.1.0/24 -d 192.168.2.2/32 -p tcp -m tcp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent (reflection)" -j DNAT --to-destination 192.168.1.20:1800-1802
[0:0] -A zone_lan_prerouting -s 192.168.1.0/24 -d 192.168.2.2/32 -p udp -m udp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent (reflection)" -j DNAT --to-destination 192.168.1.20:1800-1802
[0:0] -A zone_wan_prerouting -p tcp -m tcp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent" -j DNAT --to-destination 192.168.1.20:1800-1802
[649:79322] -A zone_wan_prerouting -p udp -m udp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent" -j DNAT --to-destination 192.168.1.20:1800-1802

are all zero.
is this the issue?

I now try to go back to bridge mode and restart openwrt to see if this changes anything in iptable hits.

update:
in bridge mode i get this

openwrt# iptables-save -c |grep 1800
[101:6060] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.20/32 -p tcp -m tcp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent (reflection)" -j SNAT --to-source 192.168.1.1
[1:58] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.20/32 -p udp -m udp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent (reflection)" -j SNAT --to-source 192.168.1.1
[101:6060] -A zone_lan_prerouting -s 192.168.1.0/24 -d 46.224.82.33/32 -p tcp -m tcp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent (reflection)" -j DNAT --to-destination 192.168.1.20:1800-1802
[1:58] -A zone_lan_prerouting -s 192.168.1.0/24 -d 46.224.82.33/32 -p udp -m udp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent (reflection)" -j DNAT --to-destination 192.168.1.20:1800-1802
[0:0] -A zone_wan_prerouting -p tcp -m tcp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent" -j DNAT --to-destination 192.168.1.20:1800-1802
[186:14936] -A zone_wan_prerouting -p udp -m udp --dport 1800:1802 -m comment --comment "!fw3: odroid-torrent" -j DNAT --to-destination 192.168.1.20:1800-1802

but still the port is closed from website and from rutorrent interface .

also when the rule get hit does it mean that my isp is NOT messing with my connection right?
can I be sure of that at least?

because I dont get any hit for ssh redirect when I try to ssh from mobile internet to openwrt public ip.

Yes, could be. But still, it demonstrates that port forwarding on OpenWrt works fine. :slight_smile:

You can of course.

You'd have to add a lot of LOG lines in iptables before the actions you want to log.

I still don't think the problem is on the OpenWrt.

A redirect is to forward a port to a host in the lan. A rule is to allow a port on the router. You want to open ssh on the OpenWrt from the wan, then you need a rule.

No, will show them.

You answered yourself.

Yes, bridge the modem and manage everything on the OpenWrt.

Could you be clear if it is working or not?

I don't see any evidence that OpenWrt is not working, other than the unreliable online open port tools.

Definitely yes.

That's a sign of port blocked by ISP.

\

why?
it is not on a standard ssh 22 port
it is on port 1822

can this be from my side , as in torrent client that is configured to listen to that port tries to check and use it and openwrt logs that?

these two contradict eachother?

sorry meant to type cant and dropped the t.

so the redirect from 1822 wan to 22 lan client also opens a port on 1822 too right?
I dont have to add that too? cause these rules worked for my last modem-to-openwrt layout.

also could this possibaly be a openwrt config bug
like this?

maybe I should wait for 21.02 and use a clean one.
because I got other wired issues too.
for example when I tried to bridge the modem when it didnt get pppoe connection (my modem/isp issue maybe. not important) and I would restart that interface then my wifi connection to router would be fine but my network would be gone. as in I couldnt even ping 192.168.1.1 and only way to fix it was to restart the router.(because my router is in a high place and I dont have easy ethernet access to it from my laptop, but I can push its power button.

What difference does it make? It should be open regardless of standard and non standard.

No, the hits on wan prerouting lines show what is incoming from the wan.

Not necessarily. You tested with your mobile phone connected to the wifi of the ISP modem and you mentioned that it worked and there were hits on the firewall. That is evidence that OpenWrt is working as configured.
If you try from the internet and there are no hits on the firewall, then I would assume that your ISP is blocking them.

No, it is not a bug, you are overcomplicating a simple function. You want to allow a port on the firewall, yet you are redirecting to another IP on the same device.

I meant that to as an answer to your answer that you said my isp blocked it.
if you meant my isp blocked port 22.
as I said I used port 1822 on was side so my isp doesnt see port 22.
if you mean my isp closed port 1822 then my answer was that why would my isp close that.
I dont think my isp closed that port. maybe their firewall closes all the incoming ports but not just one and one that I use that is random.

the hits where for my torrent client not ssh.
and again are you sure my isp closes the 1822 port? if I change that to 18202 and still no hits does that mean my isp closes that port too?
it is possible my isp closes all incoming ports (I have not heard something like this before) but not one randomly.

this was for the next part not the

and I dont want to just open a port.
I want to redirect a port from wan to a lan client.
maybe the language got confusing.
the port opening on internet is not the same as openwrt rules.
they usually use it for torrent so it usually is done with redirect too.

but my question was that if I want to redirect to a lan client (not the ssh on openwrt router but ssh on a device connected to it by lan cable) then a redirect rule is enough and I dont have to add a open rule too. is that correct?
again I dont want to open port 22 on openwrt. nor do I want to open port 1822 for openwrt only. I want to be able to ssh from my phone connected to my cellular network to my home, and I used to be able to do that on port 1822 with the rules I created.

This is not getting us anywhere.
Do something simple: opkg update; opkg install tcpdump
Then run: tcpdump -i eth0 port 22 or port 1822 or port ... add as many more ports you want to test.
If you see some output on the screen it means a packet arrived on the OpenWrt, therefore it is not blocked by the ISP (if it came from the internet) and there will be a hit on the firewall.

if I want to test that how do I open port 22 on openwrt?
the rule part in luci is a bit complicated.
can you put a text for editing firewall that I could put and be sure it mean my port 22 is open on my router. this way I can test the simple ssh on router and forgo the lan redirect and torrent and be sure that my isp or my modem does/doesnt block this.

update:
I added this


config rule
    option name 'Allow-SSH'
    option target ACCEPT
    option src 'wan'
    option dest_port '22'
    option proto 'tcp'
    option family 'ipv4'

and test from my mobile. it doesnt work.
does dropbear need any setting for it to listed to wan?
also changed to openssh to be sure and still nothing.

tcpdump captures the packets before they hit the firewall, so for testing whether the ISP is blocking or not it doesn't matter.
The rule you added is correct. You need to make sure that dropbear (or openssh) is listening to the wan interface too.
netstat -lnp | grep 22

I understand the first part, which you mean that tcpdump sees all the traffic (even internal ones?) and it doesnt matter if openwrt drops port 22 or not, if it arrives on the interface the tcmpdump sees it. right?

the second part, what you mean is that isp blocking checking is before my openwrt (on modem maybe ) so this doesnt help with that right?

I called my isp again and the help line (which is staffed with .... well the polite way would be to say just copy-paste readers) didnt help at all and would say to check the port I need to buy a static ip for them to even check me and "we gave you internet ,do you have speed issues, port is not internet" .
I still have my tdlte connection and by just swapping adsl with td-lte I got all my things back,even my ssh remote.
so I know that wasnt openwrt bug/config or my noobness messing it up.

btw I check two output of this:
iptables-save -c |grep 1800

on the tdlte one I get hits on this line
[0:0] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.20/32 -p tcp -m tcp --dport 1800 -m comment --comment "!fw3: odroid-torrent (reflection
)" -j SNAT --to-source 192.168.1.1
[0:0] -A zone_lan_postrouting -s 192.168.1.0/24 -d 192.168.1.20/32 -p udp -m udp --dport 1800 -m comment --comment "!fw3: odroid-torrent (reflection
)" -j SNAT --to-source 192.168.1.1
[0:0] -A zone_lan_prerouting -s 192.168.1.0/24 -d 192.168.0.192/32 -p tcp -m tcp --dport 1800 -m comment --comment "!fw3: odroid-torrent (reflection
)" -j DNAT --to-destination 192.168.1.20:1800
[0:0] -A zone_lan_prerouting -s 192.168.1.0/24 -d 192.168.0.192/32 -p udp -m udp --dport 1800 -m comment --comment "!fw3: odroid-torrent (reflection
)" -j DNAT --to-destination 192.168.1.20:1800
[633:34192] -A zone_wan_prerouting -p tcp -m tcp --dport 1800 -m comment --comment "!fw3: odroid-torrent" -j DNAT --to-destination 192.168.1.20:1800
[215:17151] -A zone_wan_prerouting -p udp -m udp --dport 1800 -m comment --comment "!fw3: odroid-torrent" -j DNAT --to-destination 192.168.1.20:1800

but on my adsl one I would not get hit on that.
also on adsl one the upper oneswould get hits but on the working tdlte one that one as you see doesnt get hits ( well all the lan ones really) .

maybe I need to cancel my adsl and just accept td-lte one speed.

also thank you for all the answers.
english is not my first language and in writing it (typing it) I make mistakes.
I need to proof read my answers more.
use to have a firefox extension that would allow to open text field area in firefox inside the a text editor, but that is long gone with firefox new architecture.

What do you mean internal? It is capturing traffic on interfaces, it can be wan interface or lan interface.

Correct.

Well, that was more or less evident from the beginning of the troubleshooting.

You should be looking at the zone_wan_prerouting lines for traffic incoming from the wan. The other lines are not connected to your issue.

That's up to you to decide.
You're welcome and if your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

as you can see in my

from the 8th post

the wan tcp line got zero hits before.

so the port forward didnt work on my adsl one.

I will close this as solved.

thank you for all the answers.

1 Like

The udp got hits however, so it is more possible that the tcp packets never reached the OpenWrt, rather than the OpenWrt dropped them.