红联Linux门户
Linux帮助

linux pptpd vpn 完成

发布时间:2007-06-22 00:47:25来源:红联作者:seais
单网卡的实现PPTPD VPN 建立


环境:cnetos 4.5 kernel 2.6.21.5 单网卡

所需软件:kernel_ppp_mppe-1.0.2-3dkms 支持WINDOWS 客户端补丁

pptpd-1.3.4-1.rhel4

ppp

如果你使用 yum 命令直接可以完成PPP和PPTPD的安装

其它可以下载RPM包安装。

重要的内核的安编译:3个目的


1、 使用内核支持Windows client

先打好mppe 补丁,然后编译到内核

首先:下载kernel 2.6.21.5 tar.gz包到 /usr/src 下

Tar -vxzf xxx..tar.gz 包

# make meunconfig


#Device Drivers ---> Networking support --->
PPP (point-to-point protocol) support
PPP support for async serial ports
Microsoft PPP compression/encryption (MPPC/MPPE)



2、 支持iptables nat 和filer

步骤

Device Drivers ---> Networking support --->

找到。关于IP nat 和filer

# Make modules ; make modules_install ; make install


Pptpd 配置和iptables

配置pptpd及ppp
1. /etc/pptpd.conf
localip 192.168.0.1
remoteip 192.168.0.2-254
2. /etc/ppp/options
name your_server
lock
auth
+chap
+chapms
+chapms-v2
mppe-40
mppe-128
mppe-stateless
require-chap
proxyarp
3. /etc/ppp/chap-secrets
vpn_user_name your_server vpn_user_pass vpn_client_ip(or *)
4. /etc/modules.conf
alias /dev/ppp ppp_generic
alias char-major-108 ppp_generic
alias tty-ldisc-3 ppp_async
alias tty-ldisc-14 ppp_synctty
alias ppp-compress-18 ppp_mppe
alias ppp-compress-21 bsd_comp
alias ppp-compress-24 ppp_deflate
alias ppp-compress-26 ppp_deflate
4. add ip alias
ifconfig eth0:0 192.168.0.1 netmask 255.255.255.0
5. enable ipforward
echo 1 > /proc/sys/net/ipv4/ip_forward
6. set iptables rule
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
7. start pptpd
pptpd
8. insmod (the simplest implementation need at least these modules)
modprobe /dev/ppp
modprobe ppp_mppe
modprobe ppp_async
modprobe ip_tables
modprobe iptables_nat
modprobe ipt_MASQUERADE
modprobe ip_nat_ftp
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe iptable_filter
9. if you want to debug the whole connection process, edit /etc/syslog.conf
daemon.debug /var/log/pptpd.log
10. restart syslogd: kill -HUP pid_of_syslogd
文章评论

共有 19 条评论

  1. 124.60.52.* 于 2007-07-18 15:28:31发表:

    http://5e73eed502e77e20264b70eb5a23ae07-t.xkktxb.org 5e73eed502e77e20264b70eb5a23ae07 http://5e73eed502e77e20264b70eb5a23ae07-b1.xkktxb.org 5e73eed502e77e20264b70eb5a23ae07 http://5e73eed502e77e20264b70eb5a23ae07-b3.xkktxb.org 8d1f2bfe3cbc5359328d95464cab8b7c

  2. 190.46.45.* 于 2007-07-06 00:41:29发表:

    http://fc463fd03b8d779ebfee22ef23beabf2-t.lwgmrw.org fc463fd03b8d779ebfee22ef23beabf2 http://fc463fd03b8d779ebfee22ef23beabf2-b1.lwgmrw.org fc463fd03b8d779ebfee22ef23beabf2 http://fc463fd03b8d779ebfee22ef23beabf2-b3.lwgmrw.org 7323937625928ec2c2b389a5c949efe8