suse linux下配置vpn服务器(pptp)

一、安装所需的软件包:
     pptpd-*.rpm
     ppp-*.rpm
     pptp-*.rpm
    一般情况下系统已经将pptp和ppp包安装好了,所以只需安装pptpd(pptpd server的守护进程)包就ok。利用suse linux 自带的yast工具安装非常方便,可以自动解决依赖关系。
二、配置文件。
    /etc/pptpd.conf
    /etc/ppp/chap-secrets
    /etc/ppp/options.ppp0(注:options.ppp0文件是由options.pptp文件复制而来)
   下面是各文件具体配置:
  1、 /etc/pptpd.conf

########################################
#
# Sample PoPToP configuration file
#
# for PoPToP version 1.0.0
#
#######################################

# TAG: speed
#
#       Specifies the speed for the PPP daemon to talk at.
#       Some PPP daemons will ignore this value.
#
speed 115200

# TAG: option
#
#       Specifies the location of the PPP options file.
#       By default PPP looks in '/etc/ppp/options'
#
#option /this/is/the/options/file
option /etc/ppp/options.ppp0

# TAG: debug
#
#       Turns on (more) debugging to syslog.
#
debug

# TAG: localip
# TAG: remoteip
#
#       Specifies the local and remote IP address ranges.
#
#       You can specify single IP addresses seperated by commas or you can
#       specify ranges, or both. For example:
#
#               192.168.0.234,192.168.0.245-249,192.168.0.254
#
#       IMPORTANT RESTRICTIONS:
#
#       1. No spaces are permitted between commas or within addresses.
#
#       2. If you give more IP addresses than MAX_CONNECTIONS, it will
#          start at the beginning of the list and go until it gets
#          MAX_CONNECTIONS IPs. Others will be ignored.
#
#       3. No shortcuts in ranges! ie. 234-8 does not mean 234 to 238,
#          you must type 234-238 if you mean this.
#
#       4. If you give a single localIP, that's ok - all local IPs will
#          be set to the given one. You MUST still give at least one remote
#          IP for each simultaneous client.
#
#localip 192.168.0.234-238,192.168.0.245
#remoteip 192.168.1.234-238,192.168.1.245

localip 10.10.10.10      //指定vpn服务器的地址,可以是虚拟的ip。
remoteip 192.168.137.128-200  //指定客户端连上后,分配的ip在此指定的范围
# TAG: ipxnets
#
#       This gives the range of IPX networks to allocate to clients.  By
#       default IPX network number allocation is not handled internally.
#       By putting a low and high network number here a pool of IPX networks
#       can be defined.  If this is done then there must be one IPX network
#       per client.
#
#       The format is a pair of hex numbers without any 0x prefix separated
#       by a hyphen.
#
#ipxnets 00001000-00001FFF

# TAG: listen
#
#       Defines the IP address of the local interface on which pptpd
#       should listen for connections.  The default is to listen on all
#       local interfaces (even ones brought up by pptp connections, thus
#       permitting pptp tunnels inside the pptp tunnels).
#
#listen 192.168.0.1
listen 10.10.10.10

# TAG: pidfile
#
#       This defines the file name in which pptpd should store its process
#       ID (or pid).  The default is /var/run/pptpd.pid.
#
pidfile /var/run/pptpd.pid


2、/etc/ppp/options.ppp0配置如下:
   
#
# Lock the port
#
lock

#
# We don't need the tunnel server to authenticate itself
#
noauth

#
# Turn off transmission protocols we know won't be used
#
nobsdcomp
nodeflate

#
# We want MPPE
#
mppe-40
mppe-128
mppe-stateless

#
# We want a sane mtu/mru
#
mtu 1000
mru 1000

#
# Time this thing out of it goes poof
#
lcp-echo-failure 10
lcp-echo-interval 10



3、/etc/ppp/chap-secrets配置如下:
  
# Secrets for authentication using CHAP
# client        server          secret          IP addresses

# OUTBOUND CONNECTIONS
# Here you should add your PPP Login and PPP password to connect to your
# provider via pap. The * means that the entry(login and passoword may be
# used for ANY host you connect to.
# Thus you do not have to worry about the foreign machine name. Just
# replace password with your password.
#hostname       *       password

# PREDIFINED CONNECTIONS
# These are user and password entries for publically accessible call-by-call
# Internet providers in Germany. If they confict with your config, remove them.
# READ_IN_CALLBYCALL_SECRETS

# INBOUND CONNECTIONS
#client         hostname              192.168.1.1
a               *               a               *   

//指定了vpn客户端连接时的用户名和密码为a/a,最后一个*意思是从/etc/pptpd.conf中指定的ip范围中随机分配一个IP。