Unable to set up a static host route - "SIOCADDRT: No such process"

Solution 1:

Is the desktop on 192.168.16.0/24?

You cannot add a route (to any target) via a gateway which you are not directly connected to, because your computer does not know how to find it's way to the router without going through the default route.

Solution 2:

You can get the "SIOCADDRT: No such process" error if "You attempted to set a route for a network before setting a host route for the gateway which handles traffic for that network."

e.g. for local -> 172.19.0.1 -> 172.19.0.xx

[root@local]# route add -net 172.19.0.0 gw 172.19.0.1 netmask 255.255.255.0 dev eth0
SIOCADDRT: No such process

ANSWER: First create a host route, then create a net route.

e.g. for network in question: local -> 192.168.1.254 -> 123.123.123.123

sudo route add -host 192.168.1.254 dev eth0

sudo route add -net 123.123.123.123 netmask 255.255.255.255 gw 192.168.1.254 dev eth0

A static route will still load the network, I guess it depends ;). The upload/download traffic has to cross the network. So it will affect other users of the network. You can bandwidth-limit the traffic or move that traffic to quieter hours if you wish to reduce affect on other network users. e.g. rsync has good bandwidth limiting options.

I had a similar issue with routing and SIOCADDRT. local -> dockerserver -> dockercontainer. Adding host route then net route made the routing work in one direction.

This helped me https://support.symantec.com/en_US/article.TECH142841.html

Full routing example, routing working both ways:

dockerserver=172.19.0.1
dockerservernet=172.19.0.0
dockercontainer=172.19.0.25
local=192.168.111.23
localnet=192.168.111.0

### 0. create host route for gw and net route local->docker
[root@local]# route add -host $dockerservernet dev eth0
[root@local]# route add -net $dockerservernet gw $dockerserver netmask 255.255.255.0 dev eth0

### 1. route on dockerserver to local
[root@dockerserver ~]# route add -net $localnet netmask 255.255.255.0 dev eno1
[root@dockerserver ~]# ping $local

### 2. route FROM dockercontainer to local (via gateway dockerserver)
[root@dockercontainer /]# route add -net $localnet netmask 255.255.255.0 gw gateway dev eth1
[root@dockercontainer /]# ping $local