Need help with invert private range for internet access

Started by talespin, December 01, 2026, 11:56:52 AM

Previous topic - Next topic
December 01, 2026, 11:56:52 AM Last Edit: December 01, 2026, 12:12:03 PM by talespin
Hi Everyone,

I have top two rules.
Quick is enabled.

Interface WAN
WAN IN block
port any
source any
protocol any
destination any.

Interface VLAN
VLAN IN pass
source-VLAN
destination-not private range(alias 192.168.0.0/16)
port any
protocol any

I have other rules, but are after these two.

I have private ip on isp router which is connected to opnsense wan port. But is a different range from my LAN.

With destination as any, internet works.
I want to avoid using any for destination if possible, as vlan by default will block inter vlan access.

Any suggestion where to look, what is blocking internet access.

Use the inverse function (check box) for destination.

That second rule allows traffic only to that specific alias, with reverse matching it will allow traffic to anything but that alias.

Regards,
S.
Networking is love. You may hate it, but in the end, you always come back to it.

OPNSense
N355 - i226-V | AQC113C | 16G | 500G

PRXMX
N5105 - i226-V | 2x8G - #1
N100 - i226-V | 16G - #2
8400T - i219 | CX322A | 16G - #3

An alternative to using an inverted full RFC1918 subrange is to use the union of all (V)LAN interface networks, probably in a LOCAL_NETWORKS alias.
Intel N100, 4* I226-V, 2* 82559, 16 GByte, 500 GByte NVME, Leox LXT-010H-D

1100 down / 450 up, Bufferbloat A+

Quote from: talespin on December 01, 2026, 11:56:52 AMwhat is blocking internet access.
Well...
QuoteI have private ip on isp router which is connected to opnsense wan port.
What is that IP range exactly ?!
QuoteBut is a different range from my LAN.
If you are using 192.168.1.0/24 and the ISP Router has for example 192.168.254.0/24 and you define 192.168.0.0/16 you are still blocking the ISP Router's range !!

Can we also assume that these options are configured correctly : https://docs.opnsense.org/manual/interfaces.html#assignments
QuoteBlock private networks

Block traffic from RFC 1918, loopback, link-local and carrier-grade NAT source addresses. Normally only enable this on a WAN using public address space.
&
QuoteBlock bogon networks

Block traffic from reserved or unallocated source prefixes that should not occur in the public Internet routing table.
??
Weird guy who likes everything Linux and *BSD on PC/Laptop/Tablet/Mobile and funny little ARM based boards :)

Quote from: Seimus on December 01, 2026, 01:59:54 PMUse the inverse function (check box) for destination.

That second rule allows traffic only to that specific alias, with reverse matching it will allow traffic to anything but that alias.

Regards,
S.
Thank you

I am already using invert on destination.

destination-not private range(alias 192.168.0.0/16)



Quote from: meyergru on December 01, 2026, 02:27:05 PMAn alternative to using an inverted full RFC1918 subrange is to use the union of all (V)LAN interface networks, probably in a LOCAL_NETWORKS alias.

Thank you

Just tried, no success.


Quote from: nero355 on December 01, 2026, 04:16:11 PM
Quote from: talespin on December 01, 2026, 11:56:52 AMwhat is blocking internet access.
Well...
QuoteI have private ip on isp router which is connected to opnsense wan port.

What is that IP range exactly ?!
10.0.0.x


QuoteBut is a different range from my LAN.
If you are using 192.168.1.0/24 and the ISP Router has for example 192.168.254.0/24 and you define 192.168.0.0/16 you are still blocking the ISP Router's range !!

ISP is 10.0.0.1

Can we also assume that these options are configured correctly : https://docs.opnsense.org/manual/interfaces.html#assignments
QuoteBlock private networks

Block traffic from RFC 1918, loopback, link-local and carrier-grade NAT source addresses. Normally only enable this on a WAN using public address space.
&
QuoteBlock bogon networks


Block traffic from reserved or unallocated source prefixes that should not occur in the public Internet routing table.
??
Thank you

Both options are unchecked under interface settings.

Quote from: talespin on December 01, 2026, 11:56:52 AMWith destination as any, internet works.
You can also consider to add a separate block rule instead of allowing any but your alias.

Quote from: talespin on December 01, 2026, 11:56:52 AMdestination-not private range(alias 192.168.0.0/16)
Note that this rule may not allow DNS access if your DNS (on OPNsnese) is part of this alias.

So investigate, what's not working in fact. Can you resolve host names? Use dig or nslookup on the client to check.
Also try if
ping 1.1.1.1works.

Sorry, Alias was blank. Issue still exists. Will keep checking.

Thank you everyone.

Quote from: viragomann on December 01, 2026, 06:08:27 PM
Quote from: talespin on December 01, 2026, 11:56:52 AMWith destination as any, internet works.
You can also consider to add a separate block rule instead of allowing any but your alias.

Quote from: talespin on December 01, 2026, 11:56:52 AMdestination-not private range(alias 192.168.0.0/16)
Note that this rule may not allow DNS access if your DNS (on OPNsnese) is part of this alias.

So investigate, what's not working in fact. Can you resolve host names? Use dig or nslookup on the client to check.
Also try if
ping 1.1.1.1works.

I think this is most likely the issue. I need to understand dns first. Will get back.

Quote from: viragomann on December 01, 2026, 06:08:27 PM
Quote from: talespin on December 01, 2026, 11:56:52 AMWith destination as any, internet works.
You can also consider to add a separate block rule instead of allowing any but your alias.

Quote from: talespin on December 01, 2026, 11:56:52 AMdestination-not private range(alias 192.168.0.0/16)
Note that this rule may not allow DNS access if your DNS (on OPNsnese) is part of this alias.

So investigate, what's not working in fact. Can you resolve host names? Use dig or nslookup on the client to check.
Also try if
ping 1.1.1.1works.

Thanks a lot. Finally it worked when I created allow rule to dns.

https://youtu.be/TjXkWSjYqlM?si=R05lCWLbtRuR-lv3

One question on dns. I am trying to configure vpn. Does openvpn interface also need access to internal DNS for resolving addresses.

Any link/source on network vs address in opnsense. What network refers to and what does address refers to.

The client can basically use any DNS server for resolving host names.
However, the normal use case is that you run DHCP and DNS servers on OPNsense. Then if the client pulls the network settings from the DHCP, it gets also the DNS server to use. The DHCP provides the local interface IP as DNS.

So if you restrict traffic on your internal interfaces, best practice is to add a floating or an interface group quick pass rule to allow DNS and also NTP access to "This firewall". This rule fits to any interface IP then.

Quote from: talespin on <strong>Today</strong> at 03:36:41 PMDoes openvpn interface also need access to internal DNS for resolving addresses.
Yes.

OPNsense automatically add an allow-any rule to the OpenVPN interface group. But if you intend to restrict access you have to add a rule to permit DNS.

Quote from: viragomann on <strong>Today</strong> at 03:39:42 PMSo if you restrict traffic on your internal interfaces, best practice is to add a floating or an interface group quick pass rule to allow DNS and also NTP access to "This firewall".

This rule fits to any interface IP then.
I would stick to Interface Firewall Rules and only use Floating Firewall Rules for very special cases to avoid exposing parts of OPNsense to the Internet that should not be exposed...
Weird guy who likes everything Linux and *BSD on PC/Laptop/Tablet/Mobile and funny little ARM based boards :)

DNS and NTP are very special and selective cases in my opinion. ;-)