22

When I start a VPN connection, a new default route is added on the utun0 interface:

Destination        Gateway            Flags        Refs      Use   Netif Expire
default            utun0              UCS            21        0   utun0
default            192.168.43.1       UGScI          14        0     en1

I'd like to get rid of the default/utun0 route. When using route with the -ifscope modifier, I get the following error:

$ sudo route delete -ifscope utun0 -net 0.0.0.0
route: writing to routing socket: not in table
delete net 0.0.0.0: not in table

What am I doing wrong? What's the correct syntax of the route command in order to delete the default route?

mgryszko
  • 321

5 Answers5

9

I know it's late, but I'd like to know what kind of VPN you're using.

I've had this problem with Cisco Anyconnect VPN.

Not seeing the same error as you, but the command would appear to execute, but the routing table would still look the same.

I believe Cisco AnyConnect locks the routing table in some way so that it cannot be modified.

If this isn't Cisco AnyConnect, it may do something similar. I haven't found any documentation on it, but that's the conclusion I've come to from my testing.

I've found this also appears to apply on Windows.

Cheers, Aaron

Azz
  • 330
8
$ sudo route delete -net 0.0.0.0 -ifp ppp0
delete net 0.0.0.0

This is documented in route(8)

sigjuice
  • 197
3

You can try this:

sudo route delete -net default utun0
1

Not in front of a Mac right now, off the top of my head try;

sudo route del default dev utun0
Baldrick
  • 4,322
1

Try route del default wlp2s0. Where wlp2s0 is the interface name. This command deletes the first default gateway on the specific interface you provide to the command.

3bdalla
  • 139