*Newby* How to Configure two Separate WAN and LAN connection ?

Started by Damnati, March 02, 2023, 04:24:34 PM

Previous topic - Next topic
Hello,

I want to set up WAN 1 on Port 0 with LAN 1 on Port 1, and keep them separate from WAN 2 on Port 2, which should supply LAN 2 on Port 3.

For example:

WAN_Office:
IP: 222.6.180.170
Sub: 255.255.255.254
Gateway: 222.6.180.180
DNS:222.6.180.179

LAN_Office:
IP: 172.16.134.1
Sub: 255.255.254.0

WAN_Production:
IP: 222.6.180.171
Sub: 255.255.255.254
Gateway: 222.6.180.181
DNS:222.6.180.178

LAN_Production:
IP: 172.17.134.1
Sub: 255.255.254.0

I need to statically set the IP, subnet, gateway, and DNS settings for the WAN adapter, and then assign it to a specific LAN adapter.

Is there any way to configure it in this manner? I'm new to hardware, so any help would be appreciated.

Thank you in advance.

Best regards,
Damnati

There is no "assigning" of LAN to WAN interfaces. But you can have multiple WAN interfaces - just configure them as necessary for the type of connection in question. Then each of those will also have some gateway, right?

Then you can set up two LAN interfaces, assign addresses, configure DHCP etc. and then ... change the "allow all" rule that comes as a default with OPNsense to use a single specific gateway.

That way traffic from LAN 1 will go out WAN 1 through the WAN 1 gateway and traffic from LAN 2 will go out WAN 2 through the WAN 2 gateway.

HTH
Patrick
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

QuoteI need to statically set the IP, subnet, gateway, and DNS settings for the WAN adapter,
you can set the static IP in the and the gateway in [Interfaces] (gateways can also be configured in [System: Gateways: Single]), DNS is under System: Settings: General.
Quoteand then assign it to a specific LAN adapter.

  • pmhausen's solution should work after setting the gateways, but you'll need to add a couple of rules at top (for example if you use unbound DNS you don't want DNS traffic to go through the gateway but your firewall first, I recommend you read about Gateway groups in the Docs)
  • An alternative solution is to add manual outbound NAT rules [Firewall: NAT: Outbound] so that you can translate a private subnet into one of your WAN public IPs, for example you can add a rule like so:

    • Interface: WAN_Office
    • Source address: LAN_Office NET
    • Translation / target: WAN_Office address
    Again consult docs on how to configure them properly.
PS:  You should have posted that in general discussion ;), make sure to post in the right forum to have a higher chance of people responding to you.
Disclaimer: All advice presented is "AS IS", no warranties.
I'm not part of the opnsense team, just trying to help.