OPNsense Forum

Archive => 23.7 Legacy Series => Topic started by: shade_ch on September 20, 2023, 10:58:42 PM

Title: No internet if I turn off SNAT on router connected to opnsense LAN port
Post by: shade_ch on September 20, 2023, 10:58:42 PM
Hi,

I have the following topology (simplified view):


Internet --- ISP router ---(WAN interface)--- opnSense Firewall ---(LAN interface)--- Router --- ...
                                                      |
                                                     DMZ


The "Router" is in charge of inter-vlan routing and filtering while the opnsense firewall is among other things, in charge of IDS/IPS.

On opnsense side: the IP of "LAN interface" is configured statically to 10.100.100.1/29. A rule (let's name it "rule_pass") is configured on "LAN interface" to "pass" all traffic having WAN as destination. And NAT is configured to "Automatic outbound NAT rule generation".

On the router's side: IP is configured to 10.100.100.2/29 and traffic allowed to reach the WAN (or DMZ) reaches "LAN interface"

Until now, the "Router" was configured to do SNAT. Everything was working fine except that in opnsense logs the src of all traffic coming from from "LAN interface" is logged with the IP 10.100.100.2, which is not readable nor useful when trying to find culprits. Therefore I wanted to remove SNAT on router side.

The problem is that when I disable SNAT on the router, I cannot access the firewall, nor the internet anymore. Opnsense webui is unreachable, ssh server is unreachable, I cannot ping the firewall anymore, everything seems to be blocked. There is no message in opnsense logs, nor in the logs of "router".

However if I turn on logging on "rule_pass", I see that the traffic coming from the router reaches correctly the firewall as I see now the IPs of all devices which trigger the "rule_pass" rule, including icmp pings, and not "10.100.100.2" anymore.

What am I missing / doing wrong ? Is it a NAT issue ? How can I debug this situation ?

Thank you in advance!
Title: Re: No internet if I turn off SNAT on router connected to opnsense LAN port
Post by: Maurice on September 21, 2023, 12:19:11 AM
OPNsense needs static routes and outbound NAT rules for the subnets behind "Router", which you have to create manually.

Cheers
Maurice
Title: Re: No internet if I turn off SNAT on router connected to opnsense LAN port
Post by: shade_ch on September 21, 2023, 01:34:39 AM
@Maurice : thank you.

I understand that I have to do the following, is it correct ?

Edit: it works, but is it the most optimal way to do it ?
Edit 2: it does not work...  :'(
Edit: looks lke it works... erratically... will check tomorrow.
Title: Re: No internet if I turn off SNAT on router connected to opnsense LAN port
Post by: Maurice on September 21, 2023, 02:17:16 AM
Translation target for the outbound NAT rule is "Interface address", static port shouldn't be required. Other than that, sounds good. 👍
Title: Re: No internet if I turn off SNAT on router connected to opnsense LAN port
Post by: shade_ch on September 21, 2023, 01:51:06 PM
Quote from: Maurice on September 21, 2023, 02:17:16 AM
Translation target for the outbound NAT rule is "Interface address", static port shouldn't be required. Other than that, sounds good. 👍

Ok it works thank you, I only have strange issues when adding routes/subnets I have to enable/disable the route to make it work.

Have a nice day!
Title: Re: No internet if I turn off SNAT on router connected to opnsense LAN port
Post by: Maurice on September 21, 2023, 02:25:38 PM
Adding a static route only saves it to the persistent config. You then have to click "Apply" to update the active routing table.

And yes, this is pretty much the textbook way to do this.

Cheers
Maurice