Connecting to an L2TP/IPSec VPN provided by a Draytek router on a headless Ubuntu Linux AWS EC2 instance can be a bit tricky, but it's definitely possible. Here's a step-by-step guide to help you achieve this.
Prerequisites
Before we begin, ensure that you have the following prerequisites:
- An AWS EC2 instance running Ubuntu Linux.
- A Draytek router with L2TP/IPSec VPN settings configured.
- Access to the EC2 instance through SSH.
Install Network Manager
The Network Manager is a powerful tool for managing network connections in Linux. Install it using the following command:
sudo apt-get update
sudo apt-get install network-manager network-manager-l2tp
Configure L2TP/IPSec VPN Connection
-
Open the Network Connections window:
nm-connection-editor -
Click on the 'Add' button to create a new connection.
-
Select 'VPN' as the connection type, and then 'L2TP' as the VPN type.
-
Fill in the connection details as follows:
- Connection Name: Enter a name for your VPN connection.
- Gateway: Enter the IP address of your Draytek router.
- DNS servers: Enter the DNS server addresses provided by your VPN provider.
- User Name: Enter your VPN username.
- Password: Enter your VPN password.
- L2TP Settings: Tick the 'Use L2TP/IPSec with pre-shared key' box.
- IPSec Settings: Enter the IPSec pre-shared key provided by your VPN provider.
-
Click on the 'IPsec AuthenticationMethod' dropdown and select 'SHA1 with MD5' for compatibility with older Draytek routers.
-
Click on the 'SecurityMethod' dropdown and select '3DES' for compatibility with older Draytek routers.
-
Click on the 'AdvancedOptions' button, tick the 'Send PPP Echo Packets' box, and set the 'Idle time before terminating inactive connection (s)' to 0.
-
Click on the 'OK** button to save your settings.
Connect to the VPN
-
Click on the Network icon in your system tray, and select your VPN connection from the list.
-
Enter your VPN password when prompted.
-
Your system should now connect to the VPN.
Troubleshooting
If you encounter issues while connecting to the VPN, try the following troubleshooting steps:
- Check your VPN settings on the Draytek router to ensure they are correct.
- Make sure that the IPSec pre-shared key is entered correctly.
- Try using different IPSec authentication and security methods.
- Ensure that the 'Send PPP Echo Packets' option is enabled.
- Check the logs for any error messages.
References