OPNsense Forum

English Forums => General Discussion => Topic started by: achocolada on January 03, 2024, 05:13:09 AM

Title: How to allow traffic from WAN to LAN networks?
Post by: achocolada on January 03, 2024, 05:13:09 AM
Hi everyone,

I need to allow traffic from WAN networks to LAN networks. I already add firewall to allow it, but it is still failed.
Is there anyone have a solution for this?
Thank you guys :)
Title: Re: How to allow traffic from WAN to LAN networks?
Post by: Patrick M. Hausen on January 03, 2024, 09:12:13 AM
Is this a standard NAT setup? Public IP on WAN, private network on LAN?

If yes you need to look at Firewall > NAT > Port Forwarding for inbound connections.
Title: Re: How to allow traffic from WAN to LAN networks?
Post by: achocolada on January 04, 2024, 05:53:34 AM
Quote from: Patrick M. Hausen on January 03, 2024, 09:12:13 AM
Is this a standard NAT setup? Public IP on WAN, private network on LAN?

If yes you need to look at Firewall > NAT > Port Forwarding for inbound connections.

Hi Patrick, thank you for your answer,

Actually I dont set NAT for this, I set WAN Firewall to allow all traffic fwom WAN net to LAN net instead.
I need to allow traffic from WAN to LAN network because I want the user from other office(connected by any WAN connection) able to connect to Head Office(where the OPNsense sits) specific LAN address.
Title: Re: How to allow traffic from WAN to LAN networks?
Post by: Patrick M. Hausen on January 04, 2024, 09:29:42 AM
Is the LAN a private network, i.e. one of 192.168.0.0/16, 172.16.0.0/12 or 10.0.0.0/8?

If yes, this does not work the way you think it does, because these networks are not routed across the Internet. To connect two locations you need to set up a VPN.
Title: Re: How to allow traffic from WAN to LAN networks?
Post by: ricksense on January 04, 2024, 09:53:54 AM
Quote from: Patrick M. Hausen on January 04, 2024, 09:29:42 AM
Is the LAN a private network, i.e. one of 192.168.0.0/16, 172.16.0.0/12 or 10.0.0.0/8?

If yes, this does not work the way you think it does, because these networks are not routed across the Internet. To connect two locations you need to set up a VPN.

First of all, is your WAN IP public or private?
Title: Re: How to allow traffic from WAN to LAN networks?
Post by: achocolada on January 04, 2024, 11:41:01 AM
Quote from: Patrick M. Hausen on January 04, 2024, 09:29:42 AM
Is the LAN a private network, i.e. one of 192.168.0.0/16, 172.16.0.0/12 or 10.0.0.0/8?

If yes, this does not work the way you think it does, because these networks are not routed across the Internet. To connect two locations you need to set up a VPN.

Yes, the LAN ip address is using privae network.
My objective is not to establish 2 location using VPN or another way, but I want to make the connection from outside OPNsense can reach the network behind the OPNsense which is the LAN network.
With the topology as follos:
Edge Router --> (WAN port)OPNSENSE(LAN port) --> Local Devices

I want to able to ping the Local Device from Edge Router.
Title: Re: How to allow traffic from WAN to LAN networks?
Post by: achocolada on January 04, 2024, 11:43:49 AM
Quote from: achocolada on January 04, 2024, 11:41:01 AM
Quote from: Patrick M. Hausen on January 04, 2024, 09:29:42 AM
Is the LAN a private network, i.e. one of 192.168.0.0/16, 172.16.0.0/12 or 10.0.0.0/8?

If yes, this does not work the way you think it does, because these networks are not routed across the Internet. To connect two locations you need to set up a VPN.

Yes, the LAN ip address is using privae network.
My objective is not to establish 2 location using VPN or another way, but I want to make the connection from outside OPNsense can reach the network behind the OPNsense which is the LAN network.
With the topology as follos:
Edge Router --> (WAN port)OPNSENSE(LAN port) --> Local Devices

I want to able to ping the Local Device from Edge Router.

Oh ya for additional information, from the OPNsense terminal console I can ping the local devices.

Thank you :)
Title: Re: How to allow traffic from WAN to LAN networks?
Post by: achocolada on January 04, 2024, 11:47:05 AM
Quote from: ricksense on January 04, 2024, 09:53:54 AM
Quote from: Patrick M. Hausen on January 04, 2024, 09:29:42 AM
Is the LAN a private network, i.e. one of 192.168.0.0/16, 172.16.0.0/12 or 10.0.0.0/8?

If yes, this does not work the way you think it does, because these networks are not routed across the Internet. To connect two locations you need to set up a VPN.

First of all, is your WAN IP public or private?

It is now public IP. Anyway I already use both public and private IP but it is same.
Title: Re: How to allow traffic from WAN to LAN networks?
Post by: meyergru on January 04, 2024, 12:01:42 PM
What Patrick suggested is that you cannot reach an RFC1918 private IP from the public internet, because these are not getting routed to you at all.

With IPv4, there are only two ways you can make a connection from the outside to your private LAN:

1. You create a rule that forwards a specific port from your (public & routable) WAN IP to an IP on your (private) LAN. That is NAT (network adress translation). This will open up specific ports on specific machines only.

2. You install a VPN that enables access to your whole private LAN. It tunnels private IPs through the public internet. You can have two variants: a. Client-to-Site VPN for a road warrior setup for one client machine only or b. Site-to-Site-VPN if you want to connect two separate private LANs over the internet.


With IPv6, that is a whole different story, because then your LAN can have public IPs.
Title: Re: How to allow traffic from WAN to LAN networks?
Post by: achocolada on January 08, 2024, 11:49:27 AM
Quote from: meyergru on January 04, 2024, 12:01:42 PM
What Patrick suggested is that you cannot reach an RFC1918 private IP from the public internet, because these are not getting routed to you at all.

With IPv4, there are only two ways you can make a connection from the outside to your private LAN:

1. You create a rule that forwards a specific port from your (public & routable) WAN IP to an IP on your (private) LAN. That is NAT (network adress translation). This will open up specific ports on specific machines only.

2. You install a VPN that enables access to your whole private LAN. It tunnels private IPs through the public internet. You can have two variants: a. Client-to-Site VPN for a road warrior setup for one client machine only or b. Site-to-Site-VPN if you want to connect two separate private LANs over the internet.


With IPv6, that is a whole different story, because then your LAN can have public IPs.

My need is to access the network at the main office from the branch office, not to access LAN address from public IP. The connection between the branch office and the Head office is already established using PPTP.
Title: Re: How to allow traffic from WAN to LAN networks?
Post by: Patrick M. Hausen on January 08, 2024, 02:02:24 PM
Then please provide a network diagram including IP addresses.