先安裝 PPTP client
yum install -y ppp pptp pptp-setup
建立連接
pptpsetup --create your-vpn-name --server your-vpn-server-ip --username your-username --password your-password --encrypt --start
如果看到以下提示就是連線成功囉!~
Using interface ppp0 Connect: ppp0 <--> /dev/pts/2 CHAP authentication succeeded MPPE 128-bit stateless compression enabled local IP address 192.168.1.98 remote IP address 192.168.1.254
可以用 ip addr 確認一下
#ip addr 8: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1448 qdisc pfifo_fast state UNKNOWN group default qlen 3 link/ppp inet 192.168.1.98 peer 192.168.1.254/32 scope global ppp0 valid_lft forever preferred_lft forever
接下來就是把預設的路由改成 ppp0 了
route add default dev ppp0
最後如果要斷線,那就 kill 掉就行
pkill pptp
Prev
避免 shell 指令被重複執行