Want to connect two host using one vyos router

Hi, I am new in using Vyos using it first time . I have 2 host H1,H2 i have connect H1 and H2 to Router R1(vyos) . The connection is working as i am able to ping form each host to router , but i am not able to ping H1 from H2 and vice versa .

my structure is like this

H1( Router(R1) eth1( ---------H2(

show ip router result

C> * is directly connected, eth0, 00:42:38

C>* is directly connected, eth1, 00:35:38

I know that i need to use

set protocols static route Network) next-hop IP_OF_GATEWAY

i have tried IP_OF_GATEWAY with different values but i don’t know what value it should be
Can you please let me know the command I need to give for router configuration.
I want to connect the two host using the router.

Given that R1 has & directly, no additional static routes are required on R1.

What are the default gateways on H1 & H2? For this to work, they would need to be respectively &

They don’t necessarily need to be default gateways, a regular static route configured on each host would suffice.

I will be adding more router . so, i want to know how static routes will work with two host . after i am able to connect the host , i will add a router and then again try to connect the host. It will be like
My host are ubuntu server. I want to apply changes only on the router

Can you suggest what i need to do in router??

I hope I have understood the question correctly.

If R! & R2 are not the default gateway, then static routes will need either to go on the Ubuntu hosts or perhaps on the default gateway router as an alternative.

1 Like

What @matthewr is saying is that how do the hosts themselves know about the subnet on the other side of the VyOS router if VyOS is not the default gateway? The hosts only know to send to the default gateway by default, hence the name.

If you’re realistically only using specific services between the two hosts, you could create NAT rules for those services on VyOS.

So VyOS R1 is the default gateway for H1 and H2 ? If you set the H1 and H2 with the Gateway R1(vyos), then enable static routing or OSPF routing or RIP. The 2 networks can connect with each other.