Windows
在 CentOS 7 中建立 VPN 客戶端連接
我必須從客戶端遠端連接
CentOS
到VPN
伺服器,託管在Windows
.做了什麼:
- 已安裝的軟體包yum install ppp pptp
- /etc/ppp/peers/harkiv_vpn的內容
# pty "pptp xxx.xxx.xxx.xxx --nolaunchpppd" # using IP address pty "pptp vpn.campus.harkiv.ua --nolaunchpppd" lock noauth nobsdcomp nodeflate nodefaultroute usepeerdns name user_name remotename harkiv_vpn ipparam harkiv_vpn refuse-pap refuse-eap refuse-chap refuse-mschap require-mppe nomppe-stateful
- /etc/ppp/chap-secrets 的內容
# Secrets for authentication using CHAP # client server secret IP addresses user_name harkiv_vpn "user_password_in_dblquotes" *
- 創建腳本start_vpn1.sh
systemctl stop firewalld # stop the firewall pppd call harkiv_vpn # start VPN connection # pppd call megarvpn debug nodetach # for starting VPN manually
- 創建腳本stop_vpn.sh
pkill pptp # stop VPN connection systemctl start firewalld # start the firewall systemctl restart network # restarting service recreates the file resolv.conf
在所有
vpn
連接開始之後,但我仍然無法訪問遠端資源。我錯過了什麼?
執行腳本start_vpn1.sh後,VPN 連接啟動,但其中的網關來自目前網路連接,而不是來自遠端 VPN 伺服器。要糾正這一點:
- /etc/resolv.conf的內容
# Generated by NetworkManager search harkiv.local nameserver zzz.zzz.zzz.zzz # Remote VPN server gateway <- add this line nameserver xxx.xxx.xxx.xxx # DNS1 of network connection nameserver yyy.yyy.yyy.yyy # DNS2 of network connection
- 創建腳本start_vpn2.sh
cp resolv.conf /etc/ route add -net 10.0.0.0 netmask 255.0.0.0 gw zzz.zzz.zzz.zzz