6

I have an Ubuntu machine connected to a VPN, with the IP address 172.16.1.250. I want to tunnel all the requests for 172.16.1.* through the VPN, but nothing else. If I try to use sudo route -net add 172.16.1.0/24 dev ppp0, I get the error message:

netmask 00000fff doesn't make sense with host route

However, simply adding a route for one address on that subnet works. What is the correct way of doing this?

1
  • Why wouldn't a route to the remote network already exist in the routing table when the VPN is connected? Have you looked at the routing table while the VPN is connected?
    – joeqwerty
    Commented Apr 23, 2014 at 22:17

2 Answers 2

3

You have the arguments swapped around, the correct syntax is: sudo route add -net 172.16.1.0/24 dev ppp0

1
  • 1
    Did this answer solve the problem for you?
    – mtak
    Commented Jun 12, 2014 at 9:27
0

I was having this issues because I was misusing -n instead -net.

This works:

sudo route add -net 172.19.0.0/16 dev ppp0

This do NOT work:

$ sudo route add -n 172.19.0.0/16 dev ppp0
route: netmask 0000ffff doesn't make sense with host route
Usage: inet_route [-vF] del {-host|-net} Target[/prefix] [gw Gw] [metric M] [[dev] If]
       inet_route [-vF] add {-host|-net} Target[/prefix] [gw Gw] [metric M]
                              [netmask N] [mss Mss] [window W] [irtt I]
                              [mod] [dyn] [reinstate] [[dev] If]
       inet_route [-vF] add {-host|-net} Target[/prefix] [metric M] reject
       inet_route [-FC] flush      NOT supported

man route states:

   -n     show  numerical  addresses instead of trying to determine symbolic host names. This is useful if you are trying to determine why the route to
          your nameserver has vanished.
...
   -net   the target is a network.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .