My router seems to be working, but not exactly as intended, and I don’t understand how it is working at all! Can anyone explain please?
The WAN port is connected to the internet via a Draytek Vigor 167, and ether5 is connected to a switch that has a number of servers configured with IP addresses in my public IP subnet. Ether1 and ether5 are grouped in a bridge. Ether1 is WAN. Remaining ports are grouped in a bridge and also designated as LAN, and also specified for NAT. They are connected to the wired and wireless LAN.
The firewall rules are (IP addresses modified for security):
0 D ;;; special dummy rule to show fasttrack counters
chain=forward action=passthrough
1 ;;; defconf: accept established,related, untracked
chain=forward action=accept connection-state=established,related,untracked
2 ;;; Free access to our public subnet from the LAN
chain=forward action=accept dst-address=91.112.121.232/29 in-interface-list=LAN log=no log-prefix=""
3 ;;; No firewall for public subnet on seleected ports
chain=forward action=accept protocol=tcp dst-address=91.112.121.232/29 in-interface-list=WAN dst-port=22,80,443 log=no log-prefix=""
4 chain=forward action=accept protocol=tcp dst-address=91.112.121.232/29 in-interface-list=WAN dst-port=25,465,587,995,143,585,993 log=no log-prefix=""
5 chain=forward action=accept protocol=tcp dst-address=91.112.121.232/29 in-interface-list=WAN dst-port=4190,4949,60000-61000,53,10000,9090 log=no log-prefix=""
6 chain=forward action=accept protocol=udp dst-address=91.112.121.232/29 in-interface-list=WAN dst-port=53,60000-61000 log=no log-prefix=""
7 chain=forward action=accept protocol=icmp dst-address=91.112.121.232/29 in-interface-list=WAN log=no log-prefix=""
8 chain=forward action=drop dst-address=91.112.121.232/29 in-interface-list=WAN log=no log-prefix=""
9 ;;; defconf: accept in ipsec policy
chain=forward action=accept log=no log-prefix="" ipsec-policy=in,ipsec
10 ;;; defconf: accept out ipsec policy
chain=forward action=accept ipsec-policy=out,ipsec
11 ;;; defconf: fasttrack
chain=forward action=fasttrack-connection connection-state=established,related log=no log-prefix=""
12 ;;; Allow SMTP to Postmark
chain=forward action=accept protocol=tcp dst-address-list=Postmarkapp dst-port=587 log=no log-prefix=""
13 ;;; Allow SMTP submit for SMTP2go
chain=forward action=accept protocol=tcp dst-address-list=SMTP2go dst-port=587 log=no log-prefix=""
14 ;;; SMTP submit for Another Group
chain=forward action=accept protocol=tcp dst-address=123.321.28.68 dst-port=587 log=no log-prefix=""
15 ;;; SMTP submit for Public Body
chain=forward action=accept protocol=tcp dst-address=111.222.164.71 dst-port=587 log=no log-prefix=""
16 ;;; SMTP submit to our mail server at Digital Ocean
chain=forward action=accept protocol=tcp dst-address=133.144.104.71 dst-port=587 log=no log-prefix=""
17 ;;; Reject any SMPT submit not to our approved servers
chain=forward action=drop protocol=tcp in-interface-list=LAN dst-port=587 log=no log-prefix=""
18 ;;; defconf: drop invalid
chain=forward action=drop connection-state=invalid
19 ;;; defconf: drop all from WAN not DSTNATed
chain=forward action=drop connection-state=new connection-nat-state=!dstnat in-interface-list=WAN
Rule 2 is intended to allow access from the LAN to the servers with public IP addresses and seems to work. Rules 3 to 7 are intended to allow access from the internet to the servers with public IP addresses, but only on specified ports/protocols. Rule 8 is intended to drop external traffic attempting to access the public servers on any other ports/protocols.
Rules 12 to 16 allow mail submission on port 587 to specific services, rule 17 drops other access to port 587 (this is aimed at blocking malware that attempted to send mail from the LAN - there should be another rule dropping all access to other mail submission ports). Rule 19 is the standard rule for blocking WAN traffic that isn’t NAT.
Stats show that there are no hits for rules 3 to 8. This is puzzling me. I don’t know why there are no hits, and I don’t know why traffic gets to the servers with public IP addresses without matching rules 3 to 7 (although I am glad it does, or things would not work!).
Are there obvious mistakes here? Any suggestions please?