Problem to add a static route to particular network via particular gateway using GUI

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

kwk_kwk

New Around Here
I'm trying to add a custom route between 2 routers from Router1 to Router2:

Router1
WAN - 10.10.218.1/255.255.255.0
LAN - 192.168.121.0/255.255.255.0

Router2
WAN - 10.10.170.18/255.255.255.0
LAN - 192.168.145.0/255.255.255.0

Router1 route table:

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 10.10.218.1 0.0.0.0 UG 0 0 0 eth0
10.10.218.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.10.218.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
192.168.121.0 0.0.0.0 255.255.255.0 U 0 0 0 br0

I need to add a static route on Router1 to the LAN on Router2.
If I add the route manually all works perfetly:

route add -host 10.10.170.18 dev eth0
route add -net 192.168.145.0 netmask 255.255.255.0 gw 10.10.170.18 eth0

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 10.10.218.1 0.0.0.0 UG 0 0 0 eth0
10.10.170.18 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
10.10.218.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.10.218.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
192.168.121.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
192.168.145.0 10.10.170.18 255.255.255.0 UG 0 0 0 eth0

But if I add the route using router GUI:
IP-address Network mask Gateway Metric Interface
10.10.170.18 255.255.255.255 0.0.0.0 - WAN
192.168.145.0 255.255.255.0 10.10.170.18 - WAN

The first line is transforming to command (adding particular gateway)
route add -host 10.10.170.18 gw 10.10.218.1 dev eth0

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 10.10.218.1 0.0.0.0 UG 0 0 0 eth0
10.10.170.18 10.10.218.1 255.255.255.255 UGH 0 0 0 eth0
10.10.218.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.10.218.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
192.168.121.0 0.0.0.0 255.255.255.0 U 0 0 0 br0

and after issuing the second command:
route add -net 192.168.145.0 netmask 255.255.255.0 gw 10.10.170.18 eth0

I get the error:
route: SIOCADDRT: Network is unreachable

How can I add a static route to particular network via particular gateway using GUI?
 

Jeffrey Young

Very Senior Member
To be honest, I don't know if the GUI route function was ever meant to function this complex. It is a home router after all.

Since you got the routes established the old fashioned way (and, in my opinion the most reliable way), why not put it all in a script and call the script from the services-start user script (or just put the routing statements in services-start).

Firewall-start may be a better spot (wait until the firewall is up).
 

ColinTaylor

Part of the Furniture
Your routes don't seem to make much sense. Can you explain how routers 1 and 2 to are connected to each other (LAN to LAN, WAN to LAN, or LAN to WAN), or is there another router in between?
 

kwk_kwk

New Around Here
Your routes don't seem to make much sense. Can you explain how routers 1 and 2 to are connected to each other (LAN to LAN, WAN to LAN, or LAN to WAN), or is there another router in between?
Both routers are located in isolated ISP WAN 10.10.*.* and can access each other by WAN1 - WAN2.
Enery router serves its location and has its private LAN 192.168.x.*.
I need configure access from LAN1 to LAN2 and vice versa.
 

kwk_kwk

New Around Here
To be honest, I don't know if the GUI route function was ever meant to function this complex. It is a home router after all.

Since you got the routes established the old fashioned way (and, in my opinion the most reliable way), why not put it all in a script and call the script from the services-start user script (or just put the routing statements in services-start).

Firewall-start may be a better spot (wait until the firewall is up).
I understand this way but it requires a flash drive to collocate the script, but I'd like not to use it.
 

Jeffrey Young

Very Senior Member
I understand this way but it requires a flash drive to collocate the script, but I'd like not to use it.

Put your script in the /jffs/scripts directory with the services-start, no USB drive required.
 

Jeffrey Young

Very Senior Member
Nope, just ensure you have "enable user scripts" enabled in Administration - system.
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top