# Two Internet Gateways



## balanga (Dec 3, 2021)

Can anyone explain how I can use two Internet Gateways on a LAN. This is in a home environment.

I currently have a number of systems accessing the Internet via a pfSense router, but I want to test/configure a 4G router (Telkonika RUT955) which I'm setting up. Do I need to use separate networks to be able to have two gateways?


----------



## SirDice (Dec 3, 2021)

There's only one _default_ gateway. How are you going to use that extra uplink? As a fall-back?

And note that we do not support pfSense here. Configuring pfSense is quite different compared to a standard FreeBSD install.


----------



## Jose (Dec 3, 2021)

You'll need to implement a routing protocol like RIP or OSPF to use two or more gateways simultaneously. The Freebsd routed(8) daemon appears to provide support for RIP.

However if you want just a quick and dirty test, you can set your gateway to the test router and then set it back. For example on this system the default gateway is 192.168.1.1:

```
$ netstat -nr
Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
default            192.168.1.1         UGS        igb0
127.0.0.1          link#2             UH          lo0
192.168.1.0/24      link#1             U          igb0
192.168.1.157       link#1             UHS         lo0
```

I can delete that default using `route delete default`:

```
$ doas route delete default
delete net default
$ netstat -nr                                                  
Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
127.0.0.1          link#2             UH          lo0
192.168.1.0/24      link#1             U          igb0
192.168.1.157       link#1             UHS         lo0
```

Now I have no Internet access. Let's add the new gateway for testing:

```
$ doas route add default 192.168.1.2                            
add net default: gateway 192.168.1.2
$ netstat -nr                                                  
Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
default            192.168.1.2         UGS        igb0
127.0.0.1          link#2             UH          lo0
192.168.1.0/24      link#1             U          igb0
192.168.1.157       link#1             UHS         lo0
```

You would do the commands in reverse to restore your original default gateway:

```
doas route delete default
doas route add default 192.168.1.1
```


----------



## SirDice (Dec 3, 2021)

Jose said:


> The Freebsd routed(8) daemon appears to provide support for RIP.


Don't use RIP. It's old and only supports classed IP ranges. Which means that 10.0.0.0 will _always_ have a /8 netmask and 192.168.0.0 _always_ a /16.


----------



## Jose (Dec 3, 2021)

The Freebsd routed(8) daemon supports RIPv2 which does support Classless Inter-Domain Routing. You'll have troubles if you're supernetting, but you really should be using a more modern and robust routing protocol if you are managing an internetwork large enough to need supernets.


----------



## Alain De Vos (Dec 3, 2021)

My routing knowledge is far gone, maybe bgp or is-is ?


----------



## Jose (Dec 3, 2021)

BGP is way overkill for a home network with two routers. Not sure what "is-is" means.


----------



## SirDice (Dec 3, 2021)

If you need to route over two or more different gateways on the internet you really need to use BGP. But most ISP's aren't going to support that on a 'consumer' grade internet connection.


----------



## Alain De Vos (Dec 3, 2021)

Some info on IS-IS ,





						IP Routing: ISIS Configuration Guide, Cisco IOS Release 15M&T  - IS-IS Overview and Basic Configuration [Cisco IOS 15.4M&T]
					

IP Routing: ISIS Configuration Guide, Cisco IOS Release 15M&T 	 -IS-IS Overview and Basic Configuration



					www.cisco.com


----------



## Jose (Dec 3, 2021)

Alain De Vos said:


> Some info on IS-IS ,
> 
> 
> 
> ...


Seems to be roughly equivalent to OSPF. Are there any open-source implementations of it?


----------



## Max212 (Dec 3, 2021)

@OP, what would you like to achieve?

For testing 4G, you can set default route on pfsense to 4G router, so you don't touch network setting on your client. Make sure that you set static routes of your internal network on 4G router to point to pfsense.


----------



## balanga (Dec 3, 2021)

Max212 said:


> @OP, what would you like to achieve?
> 
> For testing 4G, you can set default route on pfsense to 4G router, so you don't touch network setting on your client. Make sure that you set static routes of your internal network on 4G router to point to pfsense.
> 
> ...


I think I will initially set up the 4G router on a separate physical network until I know it functions properly and then connect it to my pfSense box, which is currently accessing the Internet via tethering from a phone.


----------

