HI all,
Hoping you can help with what I thought would be more straightforward ![]()
Context: Some networking experience. I have Comcast business (fixed IP) and am switching over to Xfinity (dynamic IP) consumer which is cheaper. I run my own mail server. My old linux firewall just died and I bought a RB5009 as replacement. I’m trying to get the basics set up with my mail server still working via comcast WAN and everything else going through the Xfinity side. I’ll post my current config down below but first what I’m trying to do will be described.
Interfaces:
- ether1 = WAN = XFinity DHCP
- ether7 = WANT = Comcast Fixed IP
- ether5 = Internal LAN (on bridge)
Goals:
- Internet connections to ether7 (comcast) ip port 25 go to my internal mail server 192.168.4.12
- Outgoing connections from my mail server that aren’t destined for my local LAN, go out the ether7 (comcast) via srcnat
- Outgoing connections from everything else srcnat out the ether1 (Xfinity) interface
Current state:
I reset the router without applying the default script, and then manually added stuff from the default script one line at a time so I could understand what was being done and customize it. In my config post below, you’ll see some defconf comments even though I didn’t run the script, due to my copy / pasting.
I’ve put logging on all the firewall drop rules so I can see any drops, and also for connection attempts coming in for my mail server.
Web browsing works fine and gets src-nat’d out the xfinity ether1 interface.
Plex dst-nat via the xfinity ether1 works fine, checked with Plex app on my phone.
External incoming connections to my mail server don’t work, even though I’ve set up basic dst-nat. Firewall logs even show the incoming connections.
Since dst-nat works via xfinity ether1 (default route), I suspect I’ve got some routing problem for the Comcast dst-nat config. I’ve read a zillion pages on routing marks, mangling, routing tables, etc. and have become so confused as to what to set, how to make sure it stays fasttrack etc. that I’m completely lost. I’ve review the diagram in the docs a couple of times but still haven’t figured this out.
If someone can help me get the above fixed, then I’m hoping that knowledge will also help me solve goal 2.
Firewall log snippet for external connections to my mail server show that traffic is incoming and hitting my public IP, but beyond that the dst-nat seems to go to never never land and I can’t figure out how to log/debug that part:
2024-06-07T13:29:46.566730+00:00 _gateway firewall,info MWP-SMTP input: in:ether7.comcast out:(unknown 0), connection-state:new src-mac 68:ee:96:e1:e0:29, proto TCP (SYN), 149.72.35.160:64254->x.x.x.29:25, len 60
2024-06-07T13:29:48.076695+00:00 _gateway firewall,info MWP-SMTP input: in:ether7.comcast out:(unknown 0), connection-state:new src-mac 68:ee:96:e1:e0:29, proto TCP (SYN), 216.147.165.49:29892->x.x.x.29:25, len 60
2024-06-07T13:29:49.036669+00:00 _gateway firewall,info MWP-SMTP input: in:ether7.comcast out:(unknown 0), connection-state:new src-mac 68:ee:96:e1:e0:29, proto TCP (SYN), 66.231.93.60:49017->x.x.x.29:25, len 60
Config:
Note that I’ve hidden the public IP and plex ports, but the internal net numbers are real because I’ll be changing all that very soon and using VLANs and such. Just the basics for now ![]()
/export terse
# jan/03/1970 19:35:52 by RouterOS 7.8
# software id = JW6F-K94A
#
# model = RB5009UG+S+
/interface bridge add name=mainbridge
/interface ethernet set [ find default-name=ether1 ] comment="New XFinity Modem" name=ether1.xfinity
/interface ethernet set [ find default-name=ether5 ] comment="Internal network" name=ether5.internal
/interface ethernet set [ find default-name=ether7 ] comment="Old Comcast Internet" name=ether7.comcast
/interface ethernet set [ find default-name=ether8 ] comment="Leave ether8 open for direct wire"
/interface ethernet set [ find default-name=sfp-sfpplus1 ] comment="New network trunk" name=sfp-sfpplus1.newnet
/interface list add name=WANlist
/interface list add name=LANlist
/interface wireless security-profiles set [ find default=yes ] supplicant-identity=MikroTik
/ip pool add name=dot4pool ranges=192.168.4.100-192.168.4.250
/ip dhcp-server add address-pool=dot4pool interface=mainbridge name=dot4dhcpsrvr
/interface bridge port add bridge=mainbridge interface=ether2
/interface bridge port add bridge=mainbridge interface=ether3
/interface bridge port add bridge=mainbridge interface=ether4
/interface bridge port add bridge=mainbridge interface=ether5.internal
/interface bridge port add bridge=mainbridge interface=ether6
/interface bridge port add bridge=mainbridge interface=sfp-sfpplus1.newnet
/ip neighbor discovery-settings set discover-interface-list=LANlist
/interface list member add comment="New XFinity" interface=ether1.xfinity list=WANlist
/interface list member add comment="Old Comcast" interface=ether7.comcast list=WANlist
/interface list member add interface=mainbridge list=LANlist
/interface list member add interface=ether8 list=LANlist
/ip address add address=192.168.4.254/24 interface=ether5.internal network=192.168.4.0
/ip address add address=x.x.x.x/30 interface=ether7.comcast network=x.x.x.28
/ip dhcp-client add comment="XFinity Finally!" interface=ether1.xfinity use-peer-dns=no use-peer-ntp=no
/ip dhcp-server network add address=192.168.4.0/24 dns-server=192.168.4.12,192.168.4.11 gateway=192.168.4.254 ntp-server=192.168.4.12,192.168.4.18,192.168.4.11
/ip firewall filter add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
/ip firewall filter add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid log=yes log-prefix=Drop2
/ip firewall filter add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
/ip firewall filter add action=accept chain=input comment="defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
/ip firewall filter add action=accept chain=input comment="External Plex Services" connection-state=new dst-port=31111 in-interface-list=WANlist log=yes log-prefix=MWPR
EFIX protocol=tcp
/ip firewall filter add action=accept chain=input comment="External SMTP Access" connection-state=new dst-port=25 in-interface=ether7.comcast log=yes log-prefix=MWP-SMT
P protocol=tcp
/ip firewall filter add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!LANlist log=yes log-prefix=Drop5
/ip firewall filter add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
/ip firewall filter add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
/ip firewall filter add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related hw-offload=yes
/ip firewall filter add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
/ip firewall filter add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid log=yes log-prefix=Drop10
/ip firewall filter add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=
WANlist log=yes log-prefix=Drop11
/ip firewall nat add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WANlist
/ip firewall nat add action=dst-nat chain=dst-nat comment="Plex DNAT" dst-port=31111 in-interface-list=WANlist log=yes log-prefix=MWPREFIX protocol=tcp to-addresses=192
.168.4.12 to-ports=32400
/ip firewall nat add action=dst-nat chain=dst-nat comment="SMTP DNat" dst-address=x.x.x.29 dst-port=25 in-interface=ether7.comcast protocol=tcp to-addresses=192.168.4.12
/ipv6 firewall address-list add address=::/128 comment="defconf: unspecified address" list=bad_ipv6
/ipv6 firewall address-list add address=::1/128 comment="defconf: lo" list=bad_ipv6
/ipv6 firewall address-list add address=fec0::/10 comment="defconf: site-local" list=bad_ipv6
/ipv6 firewall address-list add address=::ffff:0.0.0.0/96 comment="defconf: ipv4-mapped" list=bad_ipv6
/ipv6 firewall address-list add address=::/96 comment="defconf: ipv4 compat" list=bad_ipv6
/ipv6 firewall address-list add address=100::/64 comment="defconf: discard only " list=bad_ipv6
/ipv6 firewall address-list add address=2001:db8::/32 comment="defconf: documentation" list=bad_ipv6
/ipv6 firewall address-list add address=2001:10::/28 comment="defconf: ORCHID" list=bad_ipv6
/ipv6 firewall address-list add address=3ffe::/16 comment="defconf: 6bone" list=bad_ipv6
/ipv6 firewall filter add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
/ipv6 firewall filter add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
/ipv6 firewall filter add action=accept chain=input comment="defconf: accept ICMPv6" protocol=icmpv6
/ipv6 firewall filter add action=accept chain=input comment="defconf: accept UDP traceroute" port=33434-33534 protocol=udp
/ipv6 firewall filter add action=accept chain=input comment="defconf: accept DHCPv6-Client prefix delegation." dst-port=546 protocol=udp src-address=fe80::/10
/ipv6 firewall filter add action=accept chain=input comment="defconf: accept IKE" dst-port=500,4500 protocol=udp
/ipv6 firewall filter add action=accept chain=input comment="defconf: accept ipsec AH" protocol=ipsec-ah
/ipv6 firewall filter add action=accept chain=input comment="defconf: accept ipsec ESP" protocol=ipsec-esp
/ipv6 firewall filter add action=accept chain=input comment="defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
/ipv6 firewall filter add action=drop chain=input comment="defconf: drop everything else not coming from LAN" in-interface-list=!LANlist
/ipv6 firewall filter add action=accept chain=forward comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
/ipv6 firewall filter add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
/ipv6 firewall filter add action=drop chain=forward comment="defconf: drop packets with bad src ipv6" src-address-list=bad_ipv6
/ipv6 firewall filter add action=drop chain=forward comment="defconf: drop packets with bad dst ipv6" dst-address-list=bad_ipv6
/ipv6 firewall filter add action=drop chain=forward comment="defconf: rfc4890 drop hop-limit=1" hop-limit=equal:1 protocol=icmpv6
/ipv6 firewall filter add action=accept chain=forward comment="defconf: accept ICMPv6" protocol=icmpv6
/ipv6 firewall filter add action=accept chain=forward comment="defconf: accept HIP" protocol=139
/ipv6 firewall filter add action=accept chain=forward comment="defconf: accept IKE" dst-port=500,4500 protocol=udp
/ipv6 firewall filter add action=accept chain=forward comment="defconf: accept ipsec AH" protocol=ipsec-ah
/ipv6 firewall filter add action=accept chain=forward comment="defconf: accept ipsec ESP" protocol=ipsec-esp
/ipv6 firewall filter add action=accept chain=forward comment="defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
/ipv6 firewall filter add action=drop chain=forward comment="defconf: drop everything else not coming from LAN" in-interface-list=!LANlist
/system logging add action=remote topics=firewall
/system logging add action=remote topics=debug
/system logging add action=rsyslog topics=info
/tool mac-server set allowed-interface-list=LANlist
/tool mac-server mac-winbox set allowed-interface-list=LANlist
Any help will be GREATLY appreciated ![]()
Thanks,
David
