ZJU VPN - Linux
Connect to ZJU VPN under Linux manually.
1. Prerequisites
Install xl2tpd official package from your Linux distribution.
2. Configuration of xl2tpd
Edit /etc/xl2tpd/xl2tpd.conf
[lac zju]
lns = lns.zju.edu.cn
redial = no
refuse pap = yes
require chap=yes
require authentication=yes
name = your_zju_vpn_username
ppp debug = no
pppoptfile = /etc/ppp/options.xl2tpd.zju
Create a new file /etc/ppp/options.xl2tpd.zju
noauth
proxyarp
mtu 1428
name your_zju_vpn_username
password your_zju_vpn_password
Change permissions of this file to protect the account information.
# chmod 600 /etc/ppp/options.xl2tpd.zju
Make sure this directory is created.
# mkdir -p /var/run/xl2tpd
Restart the xl2tpd service
# systemctl restart xl2tpd.service
3. VPN Connection
3.1 Checking the Network
$ ping lns.zju.edu.cn
Write down this address, which is 10.0.2.3 here. Modify this below if changes.
3.2 Creating Static Route
# route add 10.0.2.3 gw 10.xx.xx.1
# route add -net 10.0.0.0/8 gw 10.xx.xx.1 metric 10
where 10.xx.xx.1 is the gateway.
Those two routes will disappear after reboot or plug out & in the network cable.
Use route -n to check the current route tables.
3.3 Connection to L2TP server
# xl2tpd-control connect zju
Wait 3 seconds then the connection should be established, showing texts like ppp0 with the ifconfig command.
3.4 Creating Default Route
# route add default metric 20 dev ppp0
This will make all default network traffic go through l2tp (ppp0).
Internet should be available now.
That default route will disappear after the connection is terminated.
4. Disconnection
# xl2tpd-control disconnect zju