Poi, dopo aver ricaricato il firewall, fai qualche tentativo a raggiungere la porta dall'esterno e usa il comando iptables -t nat -vnL dovresti vedere aumentare il numero di pacchetti tradotti, se lo fa allora al nat ci arriva.
Infine se usi continuamente iptables -t nat -vnL e iptables -t filter -vnL, anche quando il pacchetto non arriva al dispositivo locale, dovresti comunque vedere aumentare il counter di qualche regola nella chain di zone_wan2_forward e (se ha successo) in quella di forwarding_wan2_rule.
Appena riprovato ad inserire:
config defaultrule 'defaultoutgoing_wan2'
option name 'Default action for outgoing NAT WAN2'
option src 'lan2'
option dest 'wanw'
option proto 'all'
option target 'ACCEPT'
E non cambia nulla.
Ho inoltre verificato che i contatori aumentano sia per zone_wan2_forward che per forwarding_wan2_rule, ciò accade sia con che senza la regola precedente:
iptables -t filter -vnL | grep zone_wan2_forward
1 60 zone_wan2_forward all -- pppoe-wan2 * 0.0.0.0/0 0.0.0.0/0 /* !fw3 */
3 180 zone_wan2_forward all -- pppoe-wan2 * 0.0.0.0/0 0.0.0.0/0 /* !fw3 */
3 180 zone_wan2_forward all -- pppoe-wan2 * 0.0.0.0/0 0.0.0.0/0 /* !fw3 */
5 300 zone_wan2_forward all -- pppoe-wan2 * 0.0.0.0/0 0.0.0.0/0 /* !fw3 */
7 420 zone_wan2_forward all -- pppoe-wan2 * 0.0.0.0/0 0.0.0.0/0 /* !fw3 */
iptables -t filter -vnL | grep forwarding_wan2_rule
10 600 forwarding_wan2_rule all -- * * 0.0.0.0/0 0.0.0.0/0 /* !fw3: user chain for forwarding */
12 720 forwarding_wan2_rule all -- * * 0.0.0.0/0 0.0.0.0/0 /* !fw3: user chain for forwarding */
12 720 forwarding_wan2_rule all -- * * 0.0.0.0/0 0.0.0.0/0 /* !fw3: user chain for forwarding */
14 840 forwarding_wan2_rule all -- * * 0.0.0.0/0 0.0.0.0/0 /* !fw3: user chain for forwarding */
16 960 forwarding_wan2_rule all -- * * 0.0.0.0/0 0.0.0.0/0 /* !fw3: user chain for forwarding */
Guarda i counter e vedi a che punto si inceppa il forwarding.
Come faccio a vedere a che punto si inceppa dai counter?
Guarda i counter e vedi a che punto si inceppa il forwarding. Poi farei anche un tcpdump su wan2 e br-lan2 per capire se magari in realtà il forwarding sta già funzionando correttamente.
Questi i risultati di tcpdum usando il sito
https://www.yougetsignal.com/tools/open-ports/ per testare la porta 80 sugli ip di wan wan2:
tcpdump -pnvvi pppoe-wan port 80
tcpdump: listening on pppoe-wan, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
16:31:43.199625 IP (tos 0x0, ttl 54, id 20488, offset 0, flags [DF], proto TCP (6), length 60)
198.199.98.246.42793 > xx.xx.xx.xx.80: Flags [S], cksum 0x3c05 (correct), seq 2538660443, win 14600, options [mss 1460,sackOK,TS val 1995158099 ecr 0,nop,wscale 8], length 0
16:31:43.201678 IP (tos 0x0, ttl 63, id 0, offset 0, flags [DF], proto TCP (6), length 60)
xx.xx.xx.xx.80 > 198.199.98.246.42793: Flags [S.], cksum 0xc2d8 (correct), seq 1271775184, ack 2538660444, win 28960, options [mss 1452,sackOK,TS val 254551618 ecr 1995158099,nop,wscale 7], length 0
16:31:43.396143 IP (tos 0x0, ttl 54, id 20489, offset 0, flags [DF], proto TCP (6), length 52)
198.199.98.246.42793 > xx.xx.xx.xx.80: Flags [.], cksum 0x6251 (correct), seq 1, ack 1, win 58, options [nop,nop,TS val 1995158149 ecr 254551618], length 0
16:31:43.399216 IP (tos 0x0, ttl 54, id 20490, offset 0, flags [DF], proto TCP (6), length 52)
198.199.98.246.42793 > xx.xx.xx.xx.80: Flags [F.], cksum 0x6250 (correct), seq 1, ack 1, win 58, options [nop,nop,TS val 1995158149 ecr 254551618], length 0
16:31:43.404165 IP (tos 0x0, ttl 63, id 39333, offset 0, flags [DF], proto TCP (6), length 52)
xx.xx.xx.xx.80 > 198.199.98.246.42793: Flags [F.], cksum 0x6174 (correct), seq 1, ack 2, win 227, options [nop,nop,TS val 254551668 ecr 1995158149], length 0
16:31:43.599924 IP (tos 0x0, ttl 54, id 20491, offset 0, flags [DF], proto TCP (6), length 52)
198.199.98.246.42793 > xx.xx.xx.xx.80: Flags [.], cksum 0x61ea (correct), seq 2, ack 2, win 58, options [nop,nop,TS val 1995158200 ecr 254551668], length 0
^C
6 packets captured
6 packets received by filter
0 packets dropped by kernel
tcpdump -pnvvi pppoe-wan2 port 80
tcpdump: listening on pppoe-wan2, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
16:32:06.869232 IP (tos 0x0, ttl 53, id 25766, offset 0, flags [DF], proto TCP (6), length 60)
198.199.98.246.36036 > yy.yy.yy.yy.80: Flags [S], cksum 0x7970 (correct), seq 2444668372, win 14600, options [mss 1460,sackOK,TS val 1995164018 ecr 0,nop,wscale 8], length 0
16:32:07.868496 IP (tos 0x0, ttl 53, id 25767, offset 0, flags [DF], proto TCP (6), length 60)
198.199.98.246.36036 > yy.yy.yy.yy.80: Flags [S], cksum 0x7876 (correct), seq 2444668372, win 14600, options [mss 1460,sackOK,TS val 1995164268 ecr 0,nop,wscale 8], length 0
16:32:07.871370 IP (tos 0x0, ttl 53, id 34304, offset 0, flags [DF], proto TCP (6), length 60)
198.199.98.246.36038 > yy.yy.yy.yy.80: Flags [S], cksum 0x3b5a (correct), seq 809061484, win 14600, options [mss 1460,sackOK,TS val 1995164268 ecr 0,nop,wscale 8], length 0
16:32:08.869258 IP (tos 0x0, ttl 53, id 34305, offset 0, flags [DF], proto TCP (6), length 60)
198.199.98.246.36038 > yy.yy.yy.yy.80: Flags [S], cksum 0x3a60 (correct), seq 809061484, win 14600, options [mss 1460,sackOK,TS val 1995164518 ecr 0,nop,wscale 8], length 0
16:32:08.872402 IP (tos 0x0, ttl 54, id 35910, offset 0, flags [DF], proto TCP (6), length 60)
198.199.98.246.36041 > yy.yy.yy.yy.80: Flags [S], cksum 0xda72 (correct), seq 2507097888, win 14600, options [mss 1460,sackOK,TS val 1995164518 ecr 0,nop,wscale 8], length 0
16:32:09.867516 IP (tos 0x0, ttl 54, id 35911, offset 0, flags [DF], proto TCP (6), length 60)
198.199.98.246.36041 > yy.yy.yy.yy.80: Flags [S], cksum 0xd978 (correct), seq 2507097888, win 14600, options [mss 1460,sackOK,TS val 1995164768 ecr 0,nop,wscale 8], length 0
16:33:20.020583 IP (tos 0x4, ttl 54, id 0, offset 0, flags [DF], proto TCP (6), length 40)
167.114.68.123.80 > yy.yy.yy.yy.61625: Flags [S.], cksum 0x3f0c (correct), seq 2221866809, ack 1827274753, win 17520, length 0
^C
7 packets captured
7 packets received by filter
0 packets dropped by kernel
Continuo a guardare cosa può essere e cerco di imparare a debuggare questo problema, non son molto esperto a riguardo, non l'ho mai fatto prima.
Se hai qualche suggerimento sono tutto orecchie ma mi rendo anche conto di non poter abusare della tua pazienza :-) quindi sentiti libero di "mandarmi a quel paese" quando ti sarai stancato :-)