Category Archives: AsYouSeeIt
关于PPTP-VPN SERVER的配置
在自己的linode上配置的openvpn v4/v6都不好使了,鉴于联通封掉了TLS protocol。
于是,迫不得已配了一个PPTP VPN SERVER。(虽然有一个PHOTONVPS的PPTPVPN SERVER,但无奈美国VPS的latency还是太高,还是tokyo的latency比较科学)
虽然配过好多次了,但是这次依然坑了。T_T
多方搜寻终于解决,简单摘录过程如下:
1. 安装服务。我的vps用的是linode提供的debian 6 distribution。所以就按照这个步骤来了。
1 |
apt-get install pptpd iptables |
2. 配置文件。
以下是去掉注释之后的有效信息。
1 2 3 |
# /etc/pptpd.options localip 192.168.11.1 # can differ on your own vps or computer remoteip 192.168.11.10-30 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# /etc/ppp/pptpd-options name pptpd refuse-pap refuse-chap refuse-mschap require-mschap-v2 require-mppe-128 proxyarp nodefaultroute lock nobsdcomp ms-dns 106.187.36.20 # dns dependent on your server conf ms-dns 106.187.34.20 ms-dns 106.187.35.20 mtu 1000 # explained later mru 1000 |
3. ip转发和路由表,最好写入自启动项。我用的是rc.local。
iptables这里选择了一个最简单的设置方法,这样就避免了对于每个服务单独设置;大概不是最好的选择吧,不过我这个人懒,而且毕竟我这vps上面有好几个vpn server呢。
1 2 3 4 5 6 |
# /etc/rc.local /usr/local/sbin/openvpn --config /etc/openvpn/2.0/conf/server-4.conf & /usr/local/sbin/openvpn --config /etc/openvpn/2.0/conf/server-6.conf & sysctl -w net.ipv4.ip_forward=1 iptables --table nat --append POSTROUTING --jump MASQUERADE iptables-save |
4. vpn用户名密码。
1 2 3 4 5 |
/etc/ppp/chap-secrets # Secrets for authentication using CHAP # client server secret IP addresses username service-name password * (service-name can be l2tpd, pptpd and so on) |
5. 重启服务或者重启vps均可。
1 |
service pptpd restart |
然后就ok了,客户端如何配置就请自行google或者baidu或者bing吧。
mac上最简单,但记得要开启转发所有连接。
windows上记得选最弱的加密。
linux上就麻烦点了,有networkmanager稍微省事一点,但由于NM是个sb,所以你懂得,还不如自己配置。
讲一下我遇到的坑点:
1. 找不到network interface,所以我建立了一个虚拟网卡,但是我觉得很奇怪,这个找不到的原因我是没明白,因为ip的不一致性?一个网卡不能搭载两个IP?反正这个我不求甚解了,只是如下设置了一发。
1 2 3 4 5 6 |
# /etc/network/interfaces/ auto eth0:0 iface eth0:0 inet static address 192.168.11.1 # can differ netmask 255.255.255.0 broadcast 192.168.11.255 |
1 |
service networking restart |
2. client刚连上1 second就断线。
查/var/log/syslog发现如下:
1 |
GRE: read(fd=7,buffer=b7773440,len=8260) from network failed: status = -1 error = Message too long |
google了一下之后突然意识到似乎是MTU值太大,然后pptpd的某个module一次读不了那么长的str,于是跪了。所以我在配置文件中改了MTU和MRU的默认值。
以上。希望以后配置的时候可以顺利一些。
通过自定义widget添加weibo、twitter的timeline到wordpress的侧边栏
参考这个有关widget api的guide,在template(比如我这个twentyeleven)的目录中(wp-content/themes/template)的functions.php中将guide中的sample widget的代码添加进去,并添加guide中提到的注册代码,即add_action。这样,一个widget即被创建出来,从而可以在wordpress的管理后台的widgets页面中看到自己创建的小工具widget了。
接下来找weibo、twitter方面的接口:
weibo的接口在,新浪微博->设置->我的工具->微博小工具中。这里可以看到各种接口,我在“about me”页面中使用的是签名档的blog挂件,侧边栏中使用的是微博秀;博客挂件长得太丑,只能弃之了。
twitter的接口在,twitter->settings->widgets中。create new即可。
不过twitter的这个接口有一个问题,查看twitter的timeline对于本blog的visitor来说需要cross the wall。
于是乎上一篇blog介绍的rss订阅twitter的timeline就可以发挥它的“土鳖”作用了。毕竟RSS是blog负责抓取再显示给visitor的,与本篇的方法有本质上的不同。
但问题是,两个timeline同时显示就太土了吧?得研究一个最省事的方法让在墙内外的不同visitor看到不同版本的timeline。
TBC…