之前介绍过Centos(Linode)上安装pptpd VPN,如今换了Ubuntu 9.10,之前的方法不是很好用了。幸好在网站找到了同样是Linode Ubuntu 9.10的用户所写的VPN介绍,转来之前已经测试过,完全可以。
首先,你要确保自己的vps已经按照Getting Started With Linode这篇文章做好了初步的准备工作。对安装VPN而言,需要注意的就是设置好更新源。编辑你的/etc/apt/sources.list文件,去掉"##universe repositories"之后所有行的注释,让文件变成和下面的一样。当然,这一步需要用sudo或者在root下来完成,后面所有的命令都是如此。
## main & restricted repositories deb http://us.archive.ubuntu.com/ubuntu/ karmic main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ karmic main restricted deb http://security.ubuntu.com/ubuntu karmic-security main restricted deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted ## universe repositories deb http://us.archive.ubuntu.com/ubuntu/ karmic universe deb-src http://us.archive.ubuntu.com/ubuntu/ karmic universe deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe deb http://security.ubuntu.com/ubuntu karmic-security universe deb-src http://security.ubuntu.com/ubuntu karmic-security universe
接着用下面的命令更新你的软件包数据库
apt-get update
现在我们可以正式安装VPN server了。这里我们选择pptp(vpn 协议的一种),因为简单,一条命令搞定。剩下的无非是一些配置。
apt-get install pptpd
pptpd安装完成后,编辑/etc/pptpd.conf文件,去掉下面两行的注释或者直接添加这两行(在文件的最后)。这一步是配置ip地址的范围。
localip 192.168.0.1 remoteip 192.168.0.234-238,192.168.0.245
然后在/etc/ppp/chap-secrets文件中添加vpn用户,按照下面的格式,每个用户一行。
username pptpd password *
为了让你的用户连上VPN后能够正常地解析域名,我们需要手动设置DNS. 编辑/etc/ppp/options,找到ms-dns这一项,设置你的DNS.这里我推荐的是Google 最近发布的Public DNS,原因是因为好记。
ms-dns 8.8.8.8 ms-dns 8.8.4.4
编辑/etc/sysctl.conf文件,找到”net.ipv4.ip_forward=1″这一行,去掉前面的注释。
net.ipv4.ip_forward=1
运行下面的命令让配置生效。
sysctl -p
重启pptpd服务
/etc/init.d/pptpd restart
最后开启iptables转发
/sbin/iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
好了,安装完毕,赶快适用VPN连接吧~VPN在手~万事不愁~~~
本文转自:错落有致
Related posts:
- linode上设置pptpd vpn
- Ubuntu 9.04 编译安装Apache 2.2.12+MySQL 5.1.37+PHP 5.2.10
- Portable Ubuntu - 在 Windows 里运行 Ubuntu
- Linux(Ubuntu)内核升级步骤
- Ubuntu/Debian Apache2.2 控制并发数及下载速度
- Linux QQ for Ubuntu
- Portuble Ubuntu 8.1 Update
- Linux 修改主机名
- Apache2 安装与配置(Debian)
- Linode Debian 设置 VPN
Tags: Debian, Linode, pptpd, Ubuntu, VPN, VPS, XEN
发表评论之余,您还可以到寂静街论坛与我们一起讨论您的观点哦。
This entry was posted
on 星期四, 一月 7th, 2010 at 9:39 下午 and is filed under Web Server.
You can follow any responses to this entry through the RSS 2.0 feed.You can leave a response, or trackback from your own site.
[...] 原文地址:http://www.silentstreet.net/archives/xen-vps-linux-ubuntu-debian-install-pptp-vpn/comment-page-1/#co... [...]