cat /dev/life

by Chen Lei

Software Designer at Ericsson

Read this first

PAC File and Proxy Auto Switch for Firefox IE11 and Chrome

I’m using my working laptop after work at home currently before my PC DIY finished and new RMBP reveled. At work we need to access internet via internal proxy servers and after work just connect laptop directly to the wireless router to access web. It’s really boring to turn proxy off at home and enable it when I go to work. So I try to use PAC(Proxy Auto Config) file to choose proxy server or connect directly to the web according to my LAN IP address.

From wikipedia when can know that what PAC file is:

A PAC file contains a JavaScript function FindProxyForURL(url, host). This function returns a string with one or more access method specifications. These specifications cause the user agent to use a particular proxy server or to connect directly.

So I just need to customize my FindProxyForURL to check my local IP address. If my laptop’s local IP address is normal home used wireless

Continue reading →


Install L2TP/IPSEC and PPTP Server On Ubuntu(14.04) Server

I have a Linode VPS with 1TB monthly bandwidth limitation for daily Linux and other usage. This Guide will walk you through the process of installing a L2TP VPN Server on Ubuntu Server 14.04.

  1. Install xl2tpd, openswan and ppp:
sudo apt-get --no-install-recommends install xl2tpd openswan ppp pptpd
  1. After all apps installed we need to conifuguration the system and apps to make all services run well as we wish. First, we need to set the firewall and make the kernel forward the ip packet. For l2tp/ipsec:
iptables -t nat -A POSTROUTING -s 172.16.0.0/16 -o eth0 -j MASQUERADE

For pptp:

iptables -A FORWARD -p tcp --syn -s 172.16.0.0/16 -j TCPMSS --set-mss 1356

eth0 is the network interface with public ip.
172.16.0.0/16 is the ip range vpn we want the client to use when connected. You can use any private network ip address you want. Remember to make this different from your local

Continue reading →