L'angolo di Ansuel: ricerca e sviluppo su DGA4130 (AGTEF) & DGA4132 (AGTHP)

  • 2281 Risposte
  • 1126713 Visite

0 Utenti e 5 Visitatori stanno visualizzando questo topic.

Offline LuKePicci

  • Global Moderator
  • VIP
  • *****
  • 2789
Per capire il ruolo dell'helper su questi firmware si dovrebbe capire come funziona il socket wrapper di mwan per traffico sull'host e controllare se siano state o meno apportate modifiche al codice di netfilter per gli helper. A guardare la wiki di mwan3 mi viene da pensare che il wrapper implementi una cosa analoga a quella che nella wiki chiamano "routable loopback". A quel punto se il socket wrapper interviene sui socket aperti da un'app epr cui esiste una definizione mwan  di tipo host (la nostra hostvoip) allora il traffico uscente dall'app (nel nostro caso mmpbx) passa da netfilter (il "firewall"), è soggetto al tracking e alle rule di mwan e passa attraverso l'helper. Il che è necessario perchè quando mmpbx apre un socket su loopback si presenta con ip locale, e quindi il traffico sip necessita di aggiustamenti forniti dall'helper. Il tutto ha perfettamente senso: quando mmpbx è soggetto a definizione host in mwan l'helper sip di netfilter va attivato per loopback. Tutto ciò trova riscontro nel mio caso e in quello di @nclmrc, ma va in pappa in scenari come quello di @Marvel, lì come gli avevo spiegato l'intervento dell'helper (necessario attivando hostvoip) sembra far danni, come se sostituisse i campi con valori di ip inerenti l'interfaccia pubblica sbagliata (errore no roaming agreement), il che si verifica solo in casi come il suo dove il proxy da raggiungere è effettivamente routabile su due interfacce diverse. Mi resta invece poco chiaro il perchè escludendo mmpbx dal controllo di mwan lui non sia capace di funzionare quando l'ordine di avvio delle interfacce cambia.

Offline Marvel

  • Membro Anziano
  • ***
  • 200
    • Macoers
... ma va in pappa in scenari come quello di @Marvel, lì come gli avevo spiegato l'intervento dell'helper (necessario attivando hostvoip) sembra far danni, come se sostituisse i campi con valori di ip inerenti l'interfaccia pubblica sbagliata (errore no roaming agreement), il che si verifica solo in casi come il suo dove il proxy da raggiungere è effettivamente routabile su due interfacce diverse. Mi resta invece poco chiaro il perchè escludendo mmpbx dal controllo di mwan lui non sia capace di funzionare quando l'ordine di avvio delle interfacce cambia.
Infatti è assurdo, anche perché se configuro tutto per far funzionare mmpbxd su wan2 e poi questa è l'ultima ad attivarsi funziona. Quindi il problema non l'una o l'altra interfaccia ma proprio mmpbxd. Settimana prossima conto di fare la prova con Asterisk per vedere che succede.

@LuKePicci , domanda veloce.
Ho un server in lan esposto su internet tramite wan ed ovviamente è possibile accedervi grazie al port forwarding delle porte 80 e 443.
Ora ho appena preparato un serverino che è collegato in lan2 e che si collega correttamente ad internet tramite wan2, ora sto tentando di aprire le porte 80 e 443 su wan2 per permetterne l'accesso ma non va. Questa è una delle due regole che ho inserito in firewall:
Codice: [Seleziona]
config userredirect 'userredirectA756'
        option family 'ipv4'
        option dest_ip '192.168.0.3'
        option target 'DNAT'
        option dest_port '80'
        option enabled '1'
        list proto 'tcp'
        option name 'HTTP-wan2'
        option src 'wan2'
        option src_dport '80'
        option dest 'lan2'
Devo fare anche altro o dovrebbe bastare questo?
« Ultima modifica: 15 Febbraio 2020, 16:27 da Marvel »

Offline nclmrc

  • Membro Anziano
  • ***
  • 246
@LuKePicci secondo te perchè l'helper SIP è riportato nel file qos? ho notato che in tale file c'è pure il dscp mark per quanto riguatda il voip.

Offline nclmrc

  • Membro Anziano
  • ***
  • 246
@Marvel hai creato le relative zone per lan2 e wan2 nel firewall?

Offline LuKePicci

  • Global Moderator
  • VIP
  • *****
  • 2789
@Marvel fammi vedere l'altra regola di forwarding, quella verso il server in lan

Offline Marvel

  • Membro Anziano
  • ***
  • 200
    • Macoers
@Marvel hai creato le relative zone per lan2 e wan2 nel firewall?

Si, altrimenti non sarei riuscito a collegarmi a wan2 tramite lan2.
È stata una delle prime cose che abbiamo fatto.

@Marvel fammi vedere l'altra regola di forwarding, quella verso il server in lan

Ti copio tutto il mio file firewall:
Codice: [Seleziona]
config defaults
option syn_flood '1'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
option drop_invalid '1'

config zone 'lan'
option name 'lan'
list network 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option mtu_fix '1'
option wan '0'

config zone 'wan'
option name 'wan'
list network 'wan'
list network 'wan6'
list network 'wwan'
option input 'DROP'
option output 'ACCEPT'
option forward 'DROP'
option masq '1'
option conntrack '1'
option mtu_fix '1'
option wan '1'

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

config zone 'lan2'
option name 'lan2'
list network 'lan2'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option mtu_fix '1'
option wan '0'

config zone 'wan2'
option name 'wan2'
list network 'wan2'
option input 'DROP'
option output 'ACCEPT'
option forward 'DROP'
option masq '1'
option conntrack '1'
option mtu_fix '1'
option wan '1'

config forwarding 'lan2_wan2'
option src 'lan2'
option dest 'wan2'

config zone 'public_lan'
option name 'public_lan'
list network 'public_lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option wan '0'
option log '1'
option log_limit '5/minute'

config forwarding 'public_lan_wan'
option src 'public_lan'
option dest 'wan'
option name 'subnet_out'
option enabled '0'

config forwarding 'wan_public_lan'
option src 'wan'
option dest 'public_lan'
option name 'subnet_in'
option enabled '0'

config zone 'z_wlnetb24'
option name 'z_wlnetb24'
list network 'wlnet_b_24'
option input 'DROP'
option output 'ACCEPT'
option forward 'REJECT'
option mtu_fix '1'
option wan '0'

config forwarding 'for_wlnetb24'
option src 'z_wlnetb24'
option dest 'wan'

config rule 'Drop_non_TCP_SYN'
option name 'Drop_non_TCP_SYN'
option src 'wan'
option dest '*'
option proto 'tcp'
option target 'DROP'
option extra '! --tcp-flags ALL SYN'

config rule 'drop_lan_2_z_wlnetb24'
option name 'drop_lan_2_z_wlnetb24'
option src 'lan'
option dest 'z_wlnetb24'
option proto 'all'
option target 'DROP'

config rule
option src 'lan'
option name 'Deny_CWMP_Conn_Reqs_from_LAN'
option proto 'tcp'
option dest_port '7170'
option target 'DROP'

config rule 'drop_z_wlnetb24_2_lan'
option name 'drop_z_wlnetb24_2_lan'
option src 'z_wlnetb24'
option dest 'lan'
option proto 'all'
option target 'DROP'

config rule 'drop_lan_2_z_wlnetb24_GW'
option name 'drop-lan_2_z_wlnetb24_GW'
option src 'lan'
option proto 'all'
option target 'DROP'
option family 'ipv4'
option dest_ip '192.168.168.1'

config rule 'Allow_z_wlnetb24_ICMP'
option name 'Allow_z_wlnetb24_ICMP'
option src 'z_wlnetb24'
option proto 'igmp'
option target 'ACCEPT'
option family 'ipv4'
option dest_ip '192.168.168.1'

config rule 'Allow_z_wlnetb24_DHCP'
option name 'Allow_z_wlnetb24_DHCP'
option src 'z_wlnetb24'
option proto 'udp'
option dest_port '67'
option target 'ACCEPT'
option family 'ipv4'

config rule 'Allow_z_wlnetb24_DNS'
option name 'Allow_z_wlnetb24_DNS'
option src 'z_wlnetb24'
option proto 'udp'
option dest_port '53'
option target 'ACCEPT'
option family 'ipv4'

config rule 'Allow_z_wlnetb24_ICMPv6'
option name 'Allow-z_wlnetb24_ICMPv6'
option src 'z_wlnetb24'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
list icmp_type 'router-solicitation'
list icmp_type 'neighbour-solicitation'
list icmp_type 'router-advertisement'
list icmp_type 'neighbour-advertisement'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'

config zone 'z_wlnetb5'
option name 'z_wlnetb5'
list network 'wlnet_b_5'
option input 'DROP'
option output 'ACCEPT'
option forward 'REJECT'
option wan '0'

config forwarding 'for_wlnetb5'
option src 'z_wlnetb5'
option dest 'wan'

config rule 'drop_lan_2_z_wlnetb5'
option name 'drop_lan_2_z_wlnetb5'
option src 'lan'
option dest 'z_wlnetb5'
option proto 'all'
option target 'DROP'

config rule 'drop_z_wlnetb5_2_lan'
option name 'drop_z_wlnetb5_2_lan'
option src 'z_wlnetb5'
option dest 'lan'
option proto 'all'
option target 'DROP'

config rule 'drop_lan_2_z_wlnetb5_GW'
option name 'drop-lan_2_z_wlnetb5_GW'
option src 'lan'
option proto 'all'
option target 'DROP'
option family 'ipv4'
option dest_ip '192.168.168.129'

config rule 'Allow_z_wlnetb5_ICMP'
option name 'Allow_z_wlnetb5_ICMP'
option src 'z_wlnetb5'
option proto 'igmp'
option target 'ACCEPT'
option family 'ipv4'
option dest_ip '192.168.168.129'

config rule 'Allow_z_wlnetb5_DHCP'
option name 'Allow_z_wlnetb5_DHCP'
option src 'z_wlnetb5'
option proto 'udp'
option dest_port '67'
option target 'ACCEPT'
option family 'ipv4'

config rule 'Allow_z_wlnetb5_DNS'
option name 'Allow_z_wlnetb5_DNS'
option src 'z_wlnetb5'
option proto 'udp'
option dest_port '53'
option target 'ACCEPT'
option family 'ipv4'

config rule 'Allow_z_wlnetb5_ICMPv6'
option name 'Allow-z_wlnetb5_ICMPv6'
option src 'z_wlnetb5'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
list icmp_type 'router-solicitation'
list icmp_type 'neighbour-solicitation'
list icmp_type 'router-advertisement'
list icmp_type 'neighbour-advertisement'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'

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

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

config rule 'rule3'
option name 'Allow-Ping6'
option src 'wan'
option proto 'icmp'
list icmp_type 'echo-request'
option family 'ipv6'
option target 'ACCEPT'

config rule 'rule4'
option name 'Allow-DHCPv6'
option src 'wan'
option proto 'udp'
option src_ip 'fc00::/6'
option dest_ip 'fc00::/6'
option dest_port '546'
option family 'ipv6'
option target 'ACCEPT'

config rule 'rule5'
option name 'Allow-ICMPv6-Input'
option src 'wan'
option proto 'icmp'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
list icmp_type 'router-solicitation'
list icmp_type 'neighbour-solicitation'
list icmp_type 'router-advertisement'
list icmp_type 'neighbour-advertisement'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'

config rule 'rule6'
option name 'Allow-ICMPv6-Forward'
option src 'wan'
option dest '*'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'

config rule 'rule7'
option name 'access_2_LAN_IP'
option src 'lan'
option proto 'tcp'
option family 'ipv4'
option extra '-m multiport --dports 80,22,8080,443,8443 -m addrtype --limit-iface-in ! --dst-type LOCAL'
option target 'REJECT'

config rule 'rule8'
option name 'close_port_139'
option src 'wan'
option proto 'tcp'
option dest_port '139'
option family 'ipv4'
option target 'DROP'

config rule 'rule9'
option name 'close_port_445'
option src 'wan'
option proto 'tcp'
option dest_port '445'
option family 'ipv4'
option target 'DROP'

config rule 'rule11'
option name 'Deny-CUPS-wan'
option src 'wan'
option proto 'tcp'
option dest_port '631'
option family 'ipv4'
option target 'DROP'

config rule 'rule13'
option name 'Deny-CUPS-wan-v6'
option src 'wan'
option proto 'tcp'
option dest_port '631'
option family 'ipv6'
option target 'DROP'

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

config rule
option name 'Restrict-TCP-LAN-Input'
option src 'lan'
option dest_ip '!lan'
option proto 'tcp'
option family 'ipv4'
option extra '-m mark --mark 0/0x9000000'
option target 'REJECT'

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

config include 'tchext_restart'
option type 'script'
option path '/lib/functions/firewall-restart-ext-tch.sh'

config include 'tchext'
option type 'script'
option path '/lib/functions/firewall-ext-tch.sh'
option reload '1'

config cone 'cone1'
option name 'PS and XBox Live 1'
option src 'wan'
option dest_port '88'

config cone 'cone2'
option name 'PS and XBox Live 2'
option src 'wan'
option dest_port '3074:3658'

config cone 'cone3'
option name 'PS and XBox Live 3'
option src 'wan'
option dest_port '10070'

config cone 'cone4'
option name 'PS and XBox Live 4'
option src 'wan'
option dest_port '4500'

config include 'tod'
option type 'script'
option path '/lib/functions/tod.sh'
option reload '1'

config include 'intercept'
option type 'script'
option path '/usr/lib/intercept/firewall.sh'

config fwconfig 'fwconfig'
option defaultoutgoing_lax 'ACCEPT'
option defaultoutgoing_normal 'ACCEPT'
option defaultoutgoing_high 'DROP'
option defaultoutgoing_user 'ACCEPT'
option defaultincoming_lax 'REJECT'
option defaultincoming_normal 'DROP'
option defaultincoming_high 'DROP'
option defaultincoming_user 'DROP'
option level 'normal'

config rulesgroup 'pinholerules'
option enabled '1'
option name 'FW rules for opening pinholes'
option type 'pinholerule'

config redirectsgroup 'userredirects'
option enabled '1'
option name 'FW redirects defined by the user'
option type 'userredirect'

config redirectsgroup 'dmzredirects'
option enabled '0'
option name 'FW redirects for the DMZ functionality'
option type 'dmzredirect'

config dmzredirect 'dmzredirect'
option name 'DMZ rule'
option src 'wan'
option dest 'lan'
option family 'ipv4'
option target 'DNAT'
option proto 'tcpudp'

config rulesgroup 'normalrules'
option enabled '1'
option name 'FW rules for normal level'
option type 'normalrule'

config rulesgroup 'laxrules'
option enabled '0'
option name 'FW rules for lax level'
option type 'laxrule'

config rulesgroup 'highrules'
option enabled '0'
option name 'FW rules for high level'
option type 'highrule'

config rulesgroup 'userrules'
option enabled '0'
option name 'FW rules for user level'
option type 'userrule'

config rulesgroup 'userrules_v6'
option enabled '0'
option name 'FW rules for user level IPv6'
option type 'userrule_v6'

config rulesgroup 'defaultrules'
option enabled '1'
option name 'FW rules for default behavior'
option type 'defaultrule'

config highrule 'highrule1'
option name 'HTTP'
option src 'lan'
option dest 'wan'
option proto 'tcp'
option dest_port '80'
option target 'ACCEPT'

config highrule 'highrule2'
option name 'HTTPS'
option src 'lan'
option dest 'wan'
option proto 'tcp'
option dest_port '443'
option target 'ACCEPT'

config highrule 'highrule3'
option name 'SMTP'
option src 'lan'
option dest 'wan'
option proto 'tcp'
option dest_port '25'
option target 'ACCEPT'

config highrule 'highrule4'
option name 'POP3'
option src 'lan'
option dest 'wan'
option proto 'tcp'
option dest_port '110'
option target 'ACCEPT'

config highrule 'highrule5'
option name 'IMAP'
option src 'lan'
option dest 'wan'
option proto 'tcp'
option dest_port '445'
option target 'ACCEPT'

config highrule 'highrule6'
option name 'SSH'
option src 'lan'
option dest 'wan'
option proto 'tcp'
option dest_port '22'
option target 'ACCEPT'

config highrule 'highrule1_guest24'
option name 'HTTP'
option src 'z_wlnetb24'
option dest 'wan'
option proto 'tcp'
option dest_port '80'
option target 'ACCEPT'

config highrule 'highrule2_guest24'
option name 'HTTPS'
option src 'z_wlnetb24'
option dest 'wan'
option proto 'tcp'
option dest_port '443'
option target 'ACCEPT'

config highrule 'highrule3_guest24'
option name 'SMTP'
option src 'z_wlnetb24'
option dest 'wan'
option proto 'tcp'
option dest_port '25'
option target 'ACCEPT'

config highrule 'highrule4_guest24'
option name 'POP3'
option src 'z_wlnetb24'
option dest 'wan'
option proto 'tcp'
option dest_port '110'
option target 'ACCEPT'

config highrule 'highrule5_guest24'
option name 'IMAP'
option src 'z_wlnetb24'
option dest 'wan'
option proto 'tcp'
option dest_port '445'
option target 'ACCEPT'

config highrule 'highrule6_guest24'
option name 'SSH'
option src 'z_wlnetb24'
option dest 'wan'
option proto 'tcp'
option dest_port '22'
option target 'ACCEPT'

config highrule 'highrule1_guest5'
option name 'HTTP'
option src 'z_wlnetb5'
option dest 'wan'
option proto 'tcp'
option dest_port '80'
option target 'ACCEPT'

config highrule 'highrule2_guest5'
option name 'HTTPS'
option src 'z_wlnetb5'
option dest 'wan'
option proto 'tcp'
option dest_port '443'
option target 'ACCEPT'

config highrule 'highrule3_guest5'
option name 'SMTP'
option src 'z_wlnetb5'
option dest 'wan'
option proto 'tcp'
option dest_port '25'
option target 'ACCEPT'

config highrule 'highrule4_guest5'
option name 'POP3'
option src 'z_wlnetb5'
option dest 'wan'
option proto 'tcp'
option dest_port '110'
option target 'ACCEPT'

config highrule 'highrule5_guest5'
option name 'IMAP'
option src 'z_wlnetb5'
option dest 'wan'
option proto 'tcp'
option dest_port '445'
option target 'ACCEPT'

config highrule 'highrule6_guest5'
option name 'SSH'
option src 'z_wlnetb5'
option dest 'wan'
option proto 'tcp'
option dest_port '22'
option target 'ACCEPT'

config defaultrule 'defaultipv6incoming'
option name 'Default action for incoming IPv6 traffic'
option src 'wan'
option dest 'lan'
option proto 'all'
option family 'ipv6'
option target 'ACCEPT'
option enabled '0'

config defaultrule 'defaultipv6outgoing'
option name 'Default action for outgoing IPv6 traffic'
option src 'lan'
option dest 'wan'
option proto 'all'
option family 'ipv6'
option target 'ACCEPT'
option enabled '0'

config defaultrule 'defaultoutgoing'
option name 'Default action for outgoing NAT'
option src 'lan'
option dest 'wan'
option proto 'all'
option target 'ACCEPT'

config defaultrule 'defaultoutgoing_guest24'
option name 'Default action for outgoing NAT'
option src 'z_wlnetb24'
option dest 'wan'
option proto 'all'
option target 'ACCEPT'

config defaultrule 'defaultoutgoing_guest5'
option name 'Default action for outgoing NAT'
option src 'z_wlnetb5'
option dest 'wan'
option proto 'all'
option target 'ACCEPT'

config helper 'ftphelper'
option helper 'ftp'
option dest_port '21'
option proto 'tcp'

config helper 'tftphelper'
option helper 'tftp'
option dest_port '69'
option proto 'udp'

config helper 'snmphelper'
option helper 'snmp'
option family 'ipv4'
option dest_port '161'
option proto 'udp'

config helper 'pptphelper'
option helper 'pptp'
option family 'ipv4'
option dest_port '1723'
option proto 'tcp'

config helper 'siphelper'
option enable '0'
option helper 'sip'
option dest_port '5060'
option proto 'tcpudp'

config helper 'siploopback'
option helper 'sip'
option dest_port '5060'
option proto 'tcpudp'
option intf 'loopback'

config helper 'irchelper'
option helper 'irc'
option family 'ipv4'
option dest_port '6667'
option proto 'tcp'

config helper 'amandahelper'
option helper 'amanda'
option dest_port '10080'
option proto 'udp'

config helper 'rtsphelper'
option helper 'rtsp'
option dest_port '554'
option family 'ipv4'
option proto 'tcp'

config include 'dhcpsnooper'
option type 'script'
option path '/lib/functions/firewall-dhcpsnooper.sh'
option reload '0'

config include 'miniupnpd'
option type 'script'
option path '/usr/share/miniupnpd-tch/firewall.include'
option family 'IPv4'
option reload '1'

config include 'mmpbx'
option type 'script'
option path '/lib/functions/firewall-mmpbx.sh'
option reload '1'

config include 'dropbear'
option type 'script'
option path '/lib/functions/firewall-dropbear.sh'
option reload '1'

config zone 'z_if1'
option name 'zoneif1'
list network 'voip'
option input 'DROP'
option output 'ACCEPT'
option forward 'DROP'
option masq '1'
option mtu_fix '1'
option wan '1'

config forwarding 'for_if1'
option src 'lan'
option dest 'zoneif1'

config userredirect 'userredirectD95C'
option dest_port '80'
option dest 'lan'
option src_dport '80'
list proto 'tcp'
option enabled '1'
option name 'HTTP'
option src 'wan'
option family 'ipv4'
option target 'DNAT'
option dest_ip '192.168.1.3'

config userredirect 'userredirectF69E'
option enabled '1'
option family 'ipv4'
option dest 'lan'
option dest_ip '192.168.1.3'
list proto 'tcp'
option src 'wan'
option name 'HTTPS'
option src_dport '443'
option target 'DNAT'
option dest_port '443'

config userredirect 'userredirectA756'
option family 'ipv4'
option dest_ip '192.168.0.3'
option target 'DNAT'
option dest_port '80'
option enabled '1'
list proto 'tcp'
option name 'HTTP-wan2'
option src 'wan2'
option src_dport '80'
option dest 'lan2'

config userredirect 'userredirect6A1C'
        option family 'ipv4'
        option dest_port '443'
        option enabled '1'
        option target 'DNAT'
        list proto 'tcp'
        option name 'HTTPS-wan2'
        option dest_ip '192.168.0.3'
        option src_dport '443'
        option src 'wan2'
        option dest 'lan2'

Le regole per wan2 ho dovute crearle a mano nel file poiché la gui del router non me le faceva creare.

#POSTEDIT
@LuKePicci , ho verificato che le regole vengono effettivamente create:

iptables -t nat -L -nv
Codice: [Seleziona]
Chain zone_wan2_postrouting (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 4266  395K postrouting_wan2_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* !fw3: user chain for postrouting */
 4266  395K MASQUERADE  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* !fw3 */

Chain zone_wan2_prerouting (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 3860  426K prerouting_wan2_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* !fw3: user chain for prerouting */
   16   712 DNAT       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80 /* !fw3: HTTP-wan2 */ to:192.168.0.3:80
    4   160 DNAT       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:443 /* !fw3: HTTPS-wan2 */ to:192.168.0.3:443

Chain zone_wan_postrouting (1 references)
 pkts bytes target     prot opt in     out     source               destination         
20006 1481K postrouting_wan_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* !fw3: user chain for postrouting */
20005 1481K MASQUERADE  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* !fw3 */

Chain zone_wan_prerouting (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 7031  828K MMPBX      all  --  *      *       0.0.0.0/0            0.0.0.0/0           
 7008  819K prerouting_wan_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* !fw3: user chain for prerouting */
    0     0 REDIRECT   tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:7170 /* !fw3: ubus:cwmpd[cwmpd] redirect 0 */ redir ports 7170
   46  2260 DNAT       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80 /* !fw3: HTTP */ to:192.168.1.3:80
   23  1301 DNAT       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:443 /* !fw3: HTTPS */ to:192.168.1.3:443

fw3 print | grep 80
Codice: [Seleziona]
iptables -t nat -A zone_wan_prerouting -p tcp -m tcp --dport 80 -m comment --comment "!fw3: HTTP" -j DNAT --to-destination 192.168.1.3:80
iptables -t nat -D zone_lan_prerouting -p tcp -s 192.168.1.0/255.255.255.0 -d xx.xx.xx.xx/255.255.255.255 -m tcp --dport 80 -m comment --comment "!fw3: HTTP (reflection)" -j DNAT --to-destination 192.168.1.3:80
iptables -t nat -A zone_lan_prerouting -p tcp -s 192.168.1.0/255.255.255.0 -d xx.xx.xx.xx/255.255.255.255 -m tcp --dport 80 -m comment --comment "!fw3: HTTP (reflection)" -j DNAT --to-destination 192.168.1.3:80
iptables -t nat -D zone_lan_postrouting -p tcp -s 192.168.1.0/255.255.255.0 -d 192.168.1.3/255.255.255.255 -m tcp --dport 80 -m comment --comment "!fw3: HTTP (reflection)" -j SNAT --to-source 192.168.1.1
iptables -t nat -A zone_lan_postrouting -p tcp -s 192.168.1.0/255.255.255.0 -d 192.168.1.3/255.255.255.255 -m tcp --dport 80 -m comment --comment "!fw3: HTTP (reflection)" -j SNAT --to-source 192.168.1.1
iptables -t nat -A zone_wan2_prerouting -p tcp -m tcp --dport 80 -m comment --comment "!fw3: HTTP-wan2" -j DNAT --to-destination 192.168.0.3:80
iptables -t nat -D zone_lan2_prerouting -p tcp -s 192.168.0.0/255.255.255.0 -d yy.yy.yy.yy/255.255.255.255 -m tcp --dport 80 -m comment --comment "!fw3: HTTP-wan2 (reflection)" -j DNAT --to-destination 192.168.0.3:80
iptables -t nat -A zone_lan2_prerouting -p tcp -s 192.168.0.0/255.255.255.0 -d yy.yy.yy.yy/255.255.255.255 -m tcp --dport 80 -m comment --comment "!fw3: HTTP-wan2 (reflection)" -j DNAT --to-destination 192.168.0.3:80
iptables -t nat -D zone_lan2_postrouting -p tcp -s 192.168.0.0/255.255.255.0 -d 192.168.0.3/255.255.255.255 -m tcp --dport 80 -m comment --comment "!fw3: HTTP-wan2 (reflection)" -j SNAT --to-source 192.168.0.1
iptables -t nat -A zone_lan2_postrouting -p tcp -s 192.168.0.0/255.255.255.0 -d 192.168.0.3/255.255.255.255 -m tcp --dport 80 -m comment --comment "!fw3: HTTP-wan2 (reflection)" -j SNAT --to-source 192.168.0.1

Ma non ne vuole sapere di andare.

Ho anche provato ad aprire su wan2 porte non aperte su wan per assicurarmi che non ci siano problemi di conflitti sulle stesse porte ed anche in questo caso le porte non vengono effettivamente aperte.

Non è che per caso devo giocare con i mangle e le marcature?

#POSTEDIT2
Ho come l'impressione che non riesca ad indirizzare il traffico in ingresso verso il giusto dispositivo nella rete lan2.
« Ultima modifica: 16 Febbraio 2020, 16:46 da Marvel »

Offline LuKePicci

  • Global Moderator
  • VIP
  • *****
  • 2789
ce l'hai una regola del genere su entrambe le interfacce wan?
Codice: [Seleziona]
iptables -t nat -A PREROUTING -i pppoe-wan -d _ip_/255.255.255.255 -m comment --comment "!fw3" -j zone_wan_prerouting
e questa per entrambe le lan?
Codice: [Seleziona]
iptables -t nat -A POSTROUTING -o br-lan -m comment --comment "!fw3" -j zone_lan_postrouting
« Ultima modifica: 16 Febbraio 2020, 12:44 da LuKePicci »

Offline Marvel

  • Membro Anziano
  • ***
  • 200
    • Macoers
Si, su entrambe:

Codice: [Seleziona]
iptables -t nat -D PREROUTING -i pppoe-wan -d xx.xx.xx.xx/255.255.255.255 -m comment --comment "!fw3" -j zone_wan_prerouting
iptables -t nat -A PREROUTING -i pppoe-wan -d xx.xx.xx.xx/255.255.255.255 -m comment --comment "!fw3" -j zone_wan_prerouting

iptables -t nat -D PREROUTING -i pppoe-wan2 -d yy.yy.yy.yy/255.255.255.255 -m comment --comment "!fw3" -j zone_wan2_prerouting
iptables -t nat -A PREROUTING -i pppoe-wan2 -d yy.yy.yy.yy/255.255.255.255 -m comment --comment "!fw3" -j zone_wan2_prerouting

Codice: [Seleziona]
iptables -t nat -A zone_lan_postrouting -m comment --comment "!fw3: user chain for postrouting" -j postrouting_lan_rule
iptables -t nat -D POSTROUTING -o br-lan -m comment --comment "!fw3" -j zone_lan_postrouting
iptables -t nat -A POSTROUTING -o br-lan -m comment --comment "!fw3" -j zone_lan_postrouting

iptables -t nat -A zone_lan2_postrouting -m comment --comment "!fw3: user chain for postrouting" -j postrouting_lan2_rule
iptables -t nat -D POSTROUTING -o br-lan2 -m comment --comment "!fw3" -j zone_lan2_postrouting
iptables -t nat -A POSTROUTING -o br-lan2 -m comment --comment "!fw3" -j zone_lan2_postrouting
« Ultima modifica: 16 Febbraio 2020, 12:55 da Marvel »

Offline LuKePicci

  • Global Moderator
  • VIP
  • *****
  • 2789
E queste?
Codice: [Seleziona]
iptables -t filter -A zone_wan_input -m conntrack --ctstate DNAT -m comment --comment "!fw3: Accept port redirections" -j ACCEPT
iptables -t filter -A zone_wan_forward -m conntrack --ctstate DNAT -m comment --comment "!fw3: Accept port forwards" -j ACCEPT

Offline Marvel

  • Membro Anziano
  • ***
  • 200
    • Macoers
Si:
Codice: [Seleziona]
iptables -t filter -A zone_wan_input -m conntrack --ctstate DNAT -m comment --comment "!fw3: Accept port redirections" -j ACCEPT
iptables -t filter -A zone_wan_forward -m conntrack --ctstate DNAT -m comment --comment "!fw3: Accept port forwards" -j ACCEPT

iptables -t filter -A zone_wan2_input -m conntrack --ctstate DNAT -m comment --comment "!fw3: Accept port redirections" -j ACCEPT
iptables -t filter -A zone_wan2_forward -m conntrack --ctstate DNAT -m comment --comment "!fw3: Accept port forwards" -j ACCEPT
Se vuoi posso postarti tutto l'output.

Dici che non c'entra mwan?
Non sapendo cosa altro provare stanotte mi sono messo un po a cercare qualche info e mi sono imbattuto in questa pagina:
https://kb.kurgan.org/LinuxDebian/MultiWAN
Dove si parla di mangle e per il nat in ingresso usa un --set-mark differente per ogni wan.
« Ultima modifica: 16 Febbraio 2020, 13:21 da Marvel »

Offline LuKePicci

  • Global Moderator
  • VIP
  • *****
  • 2789
Certo è la base di mwan, marca le sessioni in mangle prima di nat e filter in modo da riconoscerle dopo le dovute trasformazioni e spedirla sulla giusta wan (perchè alla fine dell'elaborazione la marcatura è ancora quella e lui riesce a riconoscerla). In teoria mwan con le connessioni in ingresso c'entra ben poco.

Nel file /etc/config/firewall che hai postato ieri hai una cosa del genere, ma non ce l'hai per lan2/wan2, vedi se aggiungendola risolvi qualcosa, ricordati che l'ordine delle regole conta quindi mettila vicino a quella che già c'è:
Codice: [Seleziona]
config defaultrule 'defaultoutgoing'
 option name 'Default action for outgoing NAT'
 option src 'lan'
 option dest 'wan'
 option proto 'all'
 option target 'ACCEPT'

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 -vnLiptables -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.
« Ultima modifica: 16 Febbraio 2020, 14:04 da LuKePicci »

Offline Marvel

  • Membro Anziano
  • ***
  • 200
    • Macoers
Nel file /etc/config/firewall che hai postato ieri hai una cosa del genere, ma non ce l'hai per lan2/wan2, vedi se aggiungendola risolvi qualcosa

Si, l'avevo notato e c'ho già provato ieri notte ma senza risolvere nulla. A dire il vero ho anche creato le sezioni public_lan2 sia in network che in firewall partendo da public_lan, che a dire il vero non ho ben capito cosa faccia, ma comunque non ho risolto nulla.
« Ultima modifica: 16 Febbraio 2020, 15:01 da MisterFTTH »

Offline LuKePicci

  • Global Moderator
  • VIP
  • *****
  • 2789
Quella è per la zona lan indirizzata su ip pubblico, cioè non dietro NAT, nulla che ti possa interessare. 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.

Offline Marvel

  • Membro Anziano
  • ***
  • 200
    • Macoers
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 -vnLiptables -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:
Codice: [Seleziona]
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
Codice: [Seleziona]
    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
Codice: [Seleziona]
   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
Codice: [Seleziona]
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
Codice: [Seleziona]
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 :-)
« Ultima modifica: 16 Febbraio 2020, 16:51 da Marvel »

Offline LuKePicci

  • Global Moderator
  • VIP
  • *****
  • 2789
Nella regola sopra hai inserito "wanw" invece di "wan2"

Quando guardi l'output ti iptables non puoi fare grep in quel modo, cerca la riga "Chain >nome della chain>", quello che devi guardare è lì sotto. Se usi grep come hai fatto vedi solo le regole che puntano A quella chain e non quelle da cui la chain è composta.

Rifai i test facendo il tcpdump su br-lan2