Setting up macOS built-in VPN client

This guide explains how to configure the macOS built-in L2TP over IPSec VPN client to connect to your VPN gateway.

Creating the VPN connection

  1. Go to System Preferences → Network, then click the + (Create a new service) button in the bottom-left corner. Network preferences with Create a new service button
  2. In the Interface list choose VPN. In the VPN Type list select L2TP over IPSec. Enter a connection name and click Create. New VPN service dialog with L2TP over IPSec selected
  3. Enter the IP address of your VPN gateway into the Server Address field. The IP address is part of your user credentials. VPN connection settings with Server Address field
  4. Click Authentication Settings and enter the Password and Shared Secret — both are provided in your user credentials. Click OK. Authentication Settings with Password and Shared Secret fields You can now connect to the VPN from System Preferences → Network by selecting the connection and clicking Connect.

Checking routing

By default, macOS routes the 10/8 network via the VPN connection. Use the following commands to verify routing entries for the VPN connection:

ifconfig ppp0
netstat -rn | grep ppp0

Setting a default route for PPP connections

You can set the default netmask for PPP connections by creating the file /etc/ppp/ip-up with the following content:

#!/bin/sh
/sbin/route add 10.0.0.0/8 -interface $1

Then make the file executable:

sudo chmod 0755 /etc/ppp/ip-up

Note: If you are connecting from a network that already uses the 10.x.x.x range (for example 10.0.0.0/24), you cannot set a default netmask for PPP connections. Add a specific GPN network route instead:

#!/bin/sh
/sbin/route add 10.12.34.0/21 -interface $1

Use this method to connect to all your available roaming networks.

On this page