Multiple subnets on my wan interface?

Hello. I have a puzzling issue here. My wan interface is set up like the following.
vyos@vyos-bks# show interfaces ethernet eth0
address 1.140.68.210/29
address 1.140.68.211/29
address 1.140.68.212/29
address 1.140.68.213/29
address 1.140.68.214/29
description WAN
duplex auto
hw-id 00:25:90:27:47:be
smp-affinity auto
speed auto
The gateway is set up as a static route to 1.140.68.209
Now i’m getting another subnet from the carrier that is different than this one. How can i configure this new subnet on the same physical interface?
I could add the additional address but don’t think i could add the static route for the gateway because i can’t have more than one route on the routing table referencing 0.0.0.0/0, can i?

Anyone have any thoughts or doing something similar to this?

@nktech1135 it’s completely possible to add multiple addresses with different subnets on one interface.
VyOS doesn’t discriminate subnets, like Cisco does, for instance :slight_smile:

Also, you can have multiple routes to 0/0. VyOS, like all network routers, will just chose the one with best metric.

Thanks for that. So now i set up the second subnet and added another static route with a metric of 2 instead of one. I’m not sure how to force some traffic to take that route. I tried pinging with one of the new addresses as the source address, and didn’t get any response.
But because the second route has a higher priority than the first one the ping traffic might not have used that route like i wanted.

Does this make sense?
And if so, what do i do about it?

@nktech1135 Both gateways it different devices?
What you want exactly. Access to the router via different subnets?

No, both gateways come from the same device. I have a fiber connection coming into the building and my provider is giving me 2 /29 subnets, I’d like to set both of these up on the same interface of the router. Is this possible?
Each subnet has it’s own gateway.

In my test lab it work’s fine.

r1 configuration

set interfaces ethernet eth0 address '1.1.1.210/29'
set interfaces ethernet eth0 address '2.2.2.210/29'

set protocols static route 0.0.0.0/0 next-hop 1.1.1.209
set protocols static route 0.0.0.0/0 next-hop 2.2.2.209

Ping 5.5.5.5 from R1, from both ip addressess

vyos@r1:~$ ping 5.5.5.5 interface 1.1.1.210 count 1
PING 5.5.5.5 (5.5.5.5) from 1.1.1.210 : 56(84) bytes of data.
64 bytes from 5.5.5.5: icmp_seq=1 ttl=63 time=1.52 ms

vyos@r1:~$ ping 5.5.5.5 interface 2.2.2.210 count 1
PING 5.5.5.5 (5.5.5.5) from 2.2.2.210 : 56(84) bytes of data.
64 bytes from 5.5.5.5: icmp_seq=1 ttl=63 time=2.58 ms

Ping from remote host => R1

vyos@remote:~$ ping 1.1.1.210 count 1
PING 1.1.1.210 (1.1.1.210) 56(84) bytes of data.
64 bytes from 1.1.1.210: icmp_seq=1 ttl=63 time=3.36 ms

vyos@remote:~$ ping 2.2.2.210 count 1
PING 2.2.2.210 (2.2.2.210) 56(84) bytes of data.
64 bytes from 2.2.2.210: icmp_seq=1 ttl=63 time=2.61 ms
1 Like

Interesting, On your static routes you’re not specifying distance. Curious, does the router figure that out automatically? This morning i did this.
set protocols static route 0.0.0.0/0 next-hop 1.1.1.1
set protocols static route 0.0.0.0/0 next-hop 2.2.2.2 distance 1
As soon as i commited it dropped the connection. Any thoughts on why?

@nktech1135 the default distance for a static route is 1. So essentially you have two default routes with the same distance in your configuration. That configuration should load balance your packets. If you want to have a fail over situation, you have to set one of the routes to 2 or more in distance.
You can see which routes are active in show ip route 0.0.0.0/0.

But, what are you actually trying to solve here? You have two default routes to the same ISP on the same physical interface. This configuration looks like you’re trying to protect yourself from ISP missconfiguratiing one of their IP addresses on the WAN-network?

And also, if you load balance on your WAN address, packets initated from your router will have different source-address each time.

My ISP is giving me 2 /29 subnets on the same interface and i need to make them work. There is still a question on if the second subnet is live though, I’m waiting for confirmation from the ISP.
I’ll update this once the second subnet is live, but i do think i have my answer.

Thanks.