FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
475 views 1 comments
by anonymous
Hi all,

Is it possible to control the routing metric on zerotier routes? Zerotier is a failsafe in this situation - in which my local VPN has a metric of 1 and therefore zerotier is taking precedence.
by anonymous

Hi, please find the following usage of route command:

Usage: route [-ne] [-A inet[6]] [{add|del} [-net|-host] TARGET [netmask MASK][gw GATEWAY] [metric N] [mss BYTES] [window BYTES] [reject] [IFACE]]                                                                                  

                                                                                                                                                             

Show or edit kernel routing tables                                                                                                                            

        -n      Don't resolve names                                                                                                                          

        -e      Display other/more information                                                                                                                

        -A inet[6]      Select address family

You can use "route -n" to print out the route table and capture the route thought Zerotier interface which you want to modify:

root@Teltonika-RUT950:~# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

0.0.0.0 192.168.0.1 0.0.0.0 UG 6 0 0 wlan0

10.147.17.0 0.0.0.0 255.255.255.0 U 0 0 0 zt3jnwum2t

192.168.0.0 0.0.0.0 255.255.255.0 U 6 0 0 wlan0

192.168.2.0 0.0.0.0 255.255.255.0 U 3 0 0 br-lan

Use "del" argument to delete the current route:

root@Teltonika-RUT950:~# route del -net 10.147.17.0 gw 0.0.0.0 netmask 255.255.255.0 dev zt3jnwum2t

root@Teltonika-RUT950:~# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

0.0.0.0 192.168.0.1 0.0.0.0 UG 6 0 0 wlan0

192.168.0.0 0.0.0.0 255.255.255.0 U 6 0 0 wlan0

192.168.2.0 0.0.0.0 255.255.255.0 U 3 0 0 br-lan

Use "add" argument to add the route back with desired metric value:

root@Teltonika-RUT950:~# route add -net 10.147.17.0 netmask 255.255.255.0 metric 100 zt3jnwum2t

root@Teltonika-RUT950:~# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

0.0.0.0 192.168.0.1 0.0.0.0 UG 6 0 0 wlan0

10.147.17.0 0.0.0.0 255.255.255.0 U 100 0 0 zt3jnwum2t

192.168.0.0 0.0.0.0 255.255.255.0 U 6 0 0 wlan0

192.168.2.0 0.0.0.0 255.255.255.0 U 3 0 0 br-lan

Regards,

Ledong

1 Answer

0 votes
by anonymous
Hello, ZeroTier monitors all available connections to the internet and uses the best one available, but you can try to set local VPN to metric of 0 and ZeroTier to higher with these commands and check if it helps:

ip route del <route>

ip route add <route> metric <metric value>