Logo
rss
twitter
  • about
  • twitter client
  • e-mail login

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: linux, note Category: share

Leave a Reply

Click here to cancel reply.




*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tweets

  • 好像没有尽头。 1 day ago
  • Crazy thunder storm on MARCH 6. 1 day ago
  • 图书馆好热啊. 2 days ago
  • 一夜没睡太好了。 3 days ago
  • 科学关心真假,政治关心正义,而艺术关心美丑。 4 days ago
  • 充满了装逼犯。 5 days ago
  • More updates...

Random Posts

  • Firefox插件:TwitterFox
  • 信念?
  • who am I?
  • 对话
  • 叶子
  • 心
  • 戒烟
  • 转载:全国各地计划生育口号
  • See you @ Wordcamp Beijing
  • Ubuntu

Archives

  • March 2010 (5)
  • 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)

Blogroll

  • {amoxicillin}
  • {fwolf's blog}
  • {Viscum}
  • {天高云淡}
  • {清杯浅酌}
  • {物以类聚}
  • {猫宅}
  • {风在哪个方向}

    Creative Commons License
Powered by Wordpress  |  Designed by WebTreats