2 NIC with same GW

Started by 555|STi, September 05, 2019, 08:36:41 PM

Previous topic - Next topic
Hi there. I need some help from you, guys.

Currently I have a server with 4 NICs.


  • LAN
  • WAN DHCP
  • WAN STATIC IP: AAA.BBB.CCC.DDD
  • WAN STATIC IP: AAA.BBB.CCC.EEE

I need to assign the same GW to NIC 3 and 4. The IPs are different only on the last octet. The IP assigned to the 4th interface is enabled to access a remote server, but the 3rd is the interface of the incoming connections, none of these can be changed.

How can I achieve this?

Thanks in advance!
OPNsense 19.1.4-amd64
FreeBSD 11.2-RELEASE-p9-HBSD
OpenSSL 1.0.2r 26 Feb 2019
Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz (8 cores)
8GB RAM
500 GB HDD

when you say it is for remote access... is it really a WAN?

L
Quote from: tong2x on September 06, 2019, 02:07:20 AM
when you say it is for remote access... is it really a WAN?

Yes, it is a WAN.

LAN
WAN1 - INTERNET PROVIDER 1 - AAA.BBB.CCC.DDD
WAN2 - INTERNET PROVIDER 2 - XXX.YYY.ZZZ.123
WAN3 - INTERNET PROVIDER 2 - XXX.YYY.ZZZ.124

Thanks in advance.
OPNsense 19.1.4-amd64
FreeBSD 11.2-RELEASE-p9-HBSD
OpenSSL 1.0.2r 26 Feb 2019
Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz (8 cores)
8GB RAM
500 GB HDD

This cant work as gateways are bound to interfaces.

You can add the 2nd IP as an Alias IP to WAN2.
Then you can use outbound NAT to send the packets out the right IP.

Quote from: ruffy91 on September 06, 2019, 07:03:11 AM
You can add the 2nd IP as an Alias IP to WAN2.
Then you can use outbound NAT to send the packets out the right IP.
Interesting! I'll try this!
Thank you!

Quote from: mimugmail on September 06, 2019, 05:48:26 AM
This cant work as gateways are bound to interfaces.
Yeah, I was thinking the same, thank you!

I was in a hurry to make it work so finally I "cheated"... The solution I implemented was to use a router before the NIC.

ISP2 -> WAN2
ISP2 -> ROUTER -> WAN3


So, I assigned the needed IP to the router an then connected it to the WAN port in the firewall.

May not seem pretty, but it works.

Tanks to everyone!
OPNsense 19.1.4-amd64
FreeBSD 11.2-RELEASE-p9-HBSD
OpenSSL 1.0.2r 26 Feb 2019
Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz (8 cores)
8GB RAM
500 GB HDD