0

I'm running macOS High Sierra (10.13.4) and trying to make traffic destined for 255.255.255.255/32 subnet go through my VPN interface (utun1).

The command I tried to use is:

route change 255.255.255.255/32  -interface utun1

However, it gives me an error of route: bad address: 255.255.255.255/32. I'm unable to understand why this is so.

The documentation of route says this:

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.

Output of 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

Note the route for 255.255.255.255 which I successfully created using sudo route add 255.255.255.255 -interface utun1.

Link to route documentation: https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/route.8.html

  • If you are trying to create a catch all route, then 0.0.0.0/0 (a default route) is what you want. The bigger the number after the slash, the more specific (narrower) the route is. /32 means it matches only one destination address, in your case 255.255.255.255, which does not make sense in a route. – Johan Myréen Apr 17 '18 at 18:48

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.