Estou executando o macOS High Sierra (10.13.4) e tentando fazer com que o tráfego destinado à sub-rede 255.255.255.255/32 passe pela minha interface VPN (utun1).
O comando que tentei usar é:
route change 255.255.255.255/32 -interface utun1
No entanto, isso me dá um erro de route: bad address: 255.255.255.255/32
.
Não consigo entender por que isso acontece.
A documentação de route
diz isto:
route [-n] command [-net | -host] [-ifscope boundif] destination gateway [netmask]
...
where destination is the destination host or network, gateway is the next-hop intermediary via which packets should be routed. Routes to a particular host may be distinguished from those to a network by interpreting the Internet address specified as the destination argument. The optional modifiers -net and -host force the destination to be interpreted as a network or a host, respectively. Otherwise, if the destination has a ''local address part'' of INADDR_ANY (0.0.0.0), or if the destination is the symbolic name of a network, then the route is assumed to be to a network; otherwise, it is presumed to be a route to a host. Optionally, the destination could also be specified in the net/bits format.
For example, 128.32 is interpreted as -host 128.0.0.32; 128.32.130 is interpreted as -host 128.32.0.130; -net 128.32 is interpreted as 128.32.0.0; -net 128.32.130 is interpreted as 128.32.130.0; and 192.168.64/20 is interpreted as -net 192.168.64 -netmask 255.255.240.0.
Saída de netstat -nr
:
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
0/1 10.8.0.1 UGSc 73 0 utun1
default 10.160.16.1 UGSc 1 0 en0
10.8/24 10.8.0.2 UGSc 17 0 utun1
10.8.0.2 10.8.0.2 UH 1 0 utun1
10.160.16/23 link#5 UCS 0 0 en0
10.160.16.1/32 link#5 UCS 1 0 en0
10.160.16.1 b0:aa:77:a2:8e:bf UHLWIir 5 86 en0 298
10.160.16.10/32 link#5 UCS 0 0 en0
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 7 6945381 lo0
127.0.0.1/32 10.160.16.1 UGSc 0 0 en0
128.0/1 10.8.0.1 UGSc 5 0 utun1
159.89.172.205/32 10.160.16.1 UGSc 1 0 en0
169.254 link#5 UCS 0 0 en0
224.0.0/4 link#5 UmCS 1 0 en0
224.0.0.251 1:0:5e:0:0:fb UHmLWI 0 0 en0
255.255.255.255 utun1 UHSb 0 0 utun1
255.255.255.255/32 link#5 UCS 0 0 en0
Observe a rota para 255.255.255.255 que eu criei com sucesso usando sudo route add 255.255.255.255 -interface utun1
.
Link para encaminhar a documentação: link
Tags networking vpn routing macos