vpn client connect configure files

 

Set the pptp option file "/etc/ppp/options.pptp"

# Lock the port
lock

# Authentication
# We dont need the tunnel server to authenticate itself
noauth

# We wont do PAP, EAP, CHAP, or MSCHAP, but we will accept MSCHAP-V2
# (you may need to remove these refusals if the server is not using MPPE)
refuse-pap
refuse-eap
refuse-chap
refuse-mschap

# Compression
# Turn off compression protocols we know wont be used
nobsdcomp
nodeflate

# Encryption
# Require MPPE 128-bit encryption
require-mppe-128

 

 

Set a pptp server info file "/etc/ppp/peers/myXXX"

/ # cat /etc/ppp/peers/myXXX
pty "pptp myVPNserverIP --nolaunchpppd"
name myName
remotename PPTP
#require-mppe-128
file /etc/ppp/options.pptp
ipparam myXXX

 

 

Set a password file "/etc/ppp/chap-secrets"

/ # cat /etc/ppp/chap-secrets 
# File:
# /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
myName PPTP "myPasswd" *

 

connect with pppd call myXXX

# /usr/sbin/pppd call myXXX
# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:3E:26:0A:00  
          inet addr:192.168.1.240  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:208 errors:0 dropped:15 overruns:0 frame:0
          TX packets:79 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:19165 (18.7 KiB)  TX bytes:7930 (7.7 KiB)
          Interrupt:53 Base address:0x300 
ppp0      Link encap:Point-to-Point Protocol  
          inet addr:192.168.2.50  P-t-P:192.168.2.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1496  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:896 (896.0 B)  TX bytes:954 (954.0 B)

 

 

Should add a correct route table for ppp0, do this use "route add -net 192.168.2.0 netmask 255.255.255.0 dev ppp0",

then can ping local router‘s ip address (192.168.1.1)

/ # route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.1     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 ppp0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

 

 

If not set /etc/resov.conf correctly, cannot ping the nameserver such as baidu.com but can ping its ip address (220.181.57.217)

/ # vi /etc/resolv.conf 
# Generated by resolvconf
nameserver 192.168.1.1
/ # vi /etc/resolv.conf 
/ # ping baidu.com
PING baidu.com (220.181.57.217): 56 data bytes
64 bytes from 220.181.57.217: seq=0 ttl=49 time=82.454 ms
64 bytes from 220.181.57.217: seq=1 ttl=49 time=104.238 ms
64 bytes from 220.181.57.217: seq=2 ttl=49 time=242.270 ms
64 bytes from 220.181.57.217: seq=3 ttl=49 time=70.783 ms
64 bytes from 220.181.57.217: seq=4 ttl=49 time=114.551 ms

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。