Logo
rss
twitter
  • about
  • twitter
  • e-mail
  • sitemap

ubuntu下架设VPN服务器

no comments
Posted on Jan 31 2010 by eleven

我觉得没有必要用openvpn这种专业的程序。使用pptpd架设就可以了。

$apt-get install pptpd #安装pptpd软件包
$gedit /etc/pptpd.conf #编辑pptpd配置文件
在编辑器里面找到70行左右的下列内容:
#(Recommended)
localip 172.16.10.1 #主机IP
remoteip 172.16.10.100-238 #分配给客户端IP地址范围
# or
#localip 192.168.0.234-238,192.168.0.245
#remoteip 192.168.1.234-238,192.168.1.245
$gedit /etc/ppp/pptpd-options
name eleven-vpn #修改此处更改服务器名称
# Network and Routing
ms-dns 8.8.8.8
ms-dns 8.8.4.4 #DNS,这里用的是Google Public DNS
配置账户,这里以test为例:
$gedit /etc/ppp/chap-secrets
#Secrets for authentication using CHAP
#client      server         secret            IP addresses
  test        eleven-vpn     test                    *\
格式为: 帐号 pptp服务器名 密码 允许连入IP(*为全部)

设置完毕后重启pptpd生效

$gedit /etc/init.d/pptpd restart
自此VPN服务器配置完成,接着配置路由/NAT设置
$gedit /etc/sysctl.conf #开启IP转发,找到net.ipv4.ip_forward=1,去掉前面的井号。
$sysctl -p #使配置生效
添加iptables规则:
$iptables -A FORWARD -s 172.16.10.0/24 -j ACCEPT
$iptables -t nat -A POSTROUTING -s 172.16.10.0/24 -o eth0 -j MASQUERADE
$iptables-save > /etc/iptables-rules #保存转发规则,可能是我的系统配置问题,到这里会提示没有权限,可以先输出到任意文件,然后cp即可.
$gedit /etc/network/interfaces #添加下行
$iptables-restore > /etc/iptables-rules
VPN server建立完成,局域网内测试连接成功,广域网内可能要在路由器中添加端口映射.

PS:wordpress的高亮真是太不友好了.


  Tags: Google, linux, note Category: share


相关文章

  • data2nand (0)
  • vim配置文件 (1)
  • 导入QIM词库到sunpinyin (0)
  • 朝鲜&世界杯 (3)
  • 雪 (2)
  • 26个预言 (1)
  • 星空 (0)

发表评论

Click here to cancel reply.

登录 (没有帐号?单击注册) 以发表评论,或填写下列表单.

0 + 5 = (required)


(required)


(required)


(optional)

推特

  • iTune10 更新图标了。 17 hrs ago
  • 天亮了都没睡,可是还要去钓鱼。 3 days ago
  • 求一枚twitter的API. 3 days ago
  • http://yfrog.com/1a3zsj 霍巴特的迷你机场。 1 week ago
  • 啪啦啪啦啪啦下雨了。 1 week ago
  • More updates...

朋友们

  • {amoxicillin}
  • {fwolf's blog}
  • {Viscum}
  • {天高云淡}
  • {清杯浅酌}
  • {漓浮城堡}
  • {物以类聚}
  • {猫宅}
  • {远's Life in the Air}
  • {风在哪个方向}

文章存档

  • September 2010 (2)
  • August 2010 (8)
  • July 2010 (5)
  • June 2010 (5)
  • May 2010 (6)
  • April 2010 (17)
  • March 2010 (12)
  • February 2010 (10)
  • January 2010 (8)
  • December 2009 (14)
  • November 2009 (12)
  • October 2009 (15)
  • September 2009 (1)
  • August 2009 (14)
  • July 2009 (10)
  • June 2009 (4)
  • May 2009 (12)
  • April 2009 (14)
  • March 2009 (9)
  • February 2009 (5)
  • January 2009 (4)
  • December 2008 (10)
  • November 2008 (17)
  • October 2008 (18)
  • September 2008 (17)
  • August 2008 (17)
  • July 2008 (13)
  • June 2008 (12)
  • May 2008 (18)
  • April 2008 (10)
  • March 2008 (17)
  • February 2008 (13)
  • January 2008 (11)
  • December 2007 (16)
  • November 2007 (18)
  • October 2007 (20)
  • September 2007 (11)
  • August 2007 (4)
  • July 2007 (5)
  • June 2007 (15)
  • May 2007 (22)
  • April 2007 (13)
  • March 2007 (5)
  • February 2007 (11)
  • January 2007 (5)
  • December 2006 (2)
  • November 2006 (3)
  • October 2006 (7)
  • September 2006 (3)
  • August 2006 (34)
  • July 2006 (44)
  • June 2006 (22)

I Love Camino!

    Creative Commons License
Powered by Wordpress  |  Theme developed under WebTreats