Different gateways for different computers

Started by NFKhalaychidi, December 08, 2021, 11:54:18 AM

Previous topic - Next topic
I have a device with OPNSense with 3 ports, one is for LAN, other two are for WAN1 and WAN2 from different providers
I have to do the following:
(1) All clients are using WAN1 to go to the Internet
(2) Some IP's have to use WAN2 instead
By default all clients are using WAN1 and (1) is working
How can I configure OPNsense to make (2) working?
I tried to configure the following firewall rule:

Interface: LAN
Direction: in
Protocol: any
Source: Single host 10.0.0.7/16
Destination: any
Gateway: WAN2_Gateway


When I enable this rule ALL computers are using WAN2, and nobody uses WAN1.
Any suggestions to fix it?

10.0.0.7/32

maybe?
kind regards
chemlud
____
"The price of reliability is the pursuit of the utmost simplicity."
C.A.R. Hoare

felix eichhorns premium katzenfutter mit der extraportion energie

A router is not a switch - A router is not a switch - A router is not a switch - A rou....

Create a firewall ALIAS. Put those IPs for WAN2 in the ALIAS and use a firewall rule to forward that ALIAS to WAN2.

Quote from: chemlud on December 08, 2021, 01:19:40 PM
10.0.0.7/32

maybe?

Yes. So simple. I thought "10.0.0.0/16" is subnet, and "10.0.0.7/16" is single host, but OPNsense doesn't think so

Quote from: autone on December 09, 2021, 04:41:54 AM
Create a firewall ALIAS. Put those IPs for WAN2 in the ALIAS and use a firewall rule to forward that ALIAS to WAN2.
It works too! Thanks for this way

Quote from: NFKhalaychidi on December 09, 2021, 08:46:41 AM
Quote from: chemlud on December 08, 2021, 01:19:40 PM
10.0.0.7/32

maybe?

Yes. So simple. I thought "10.0.0.0/16" is subnet, and "10.0.0.7/16" is single host, but OPNsense doesn't think so

That has nothing to do with opnsense, but with network subnet masks in general ;-)

https://en.wikipedia.org/wiki/Subnet_mask
kind regards
chemlud
____
"The price of reliability is the pursuit of the utmost simplicity."
C.A.R. Hoare

felix eichhorns premium katzenfutter mit der extraportion energie

A router is not a switch - A router is not a switch - A router is not a switch - A rou....