Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have read "How to configure an Ubuntu server so that all traffic goes through a VPN?" and found it doesn't apply to my case. I am only interested in the client-side of the VPN connection as I am a customer of a commercial VPN service provider.

I wish to route all network traffic through my VPN connection so that when it drops for whatever reason, all internet access is immediately terminated.

How do I go about configuring Ubuntu 12.10?

share|improve this question
Addition: Would it be better for me to do a very minimal (bare-bones) install of Ubuntu instead of the full suite? My reasons are: (a) a full suite will have more ports to deal with when I set up firewall rules; (b) I only use Ubuntu to surf the internet – n00b Mar 19 '13 at 11:08

first of all you need to check your firewall status:

ufw status

than before you turn it on, probably you want to block all ports, all connections, just, everithing, and then to unblock what you need.

ufw default deny

then you add your rules, example:

ufw allow from to 80

but if you have more than one computer, you need for every same line of code for any ip address, or even if it is specific ip range, it should be and 111.222.111.* or even 111.222..

than last: is example ip address, you just type yours instead, and port 80 is also example, change it, know better what port you need.

share|improve this answer
@ Dimitris Theodoridis: What is Is it my IP address or the IP address as stated in the config file? My VPN service provider gives me a set of config files in which there are IP addresses with ports like 1194 for UDP transport and 443 for TCP transport. Could you giv me more examples please? – n00b Mar 19 '13 at 11:13
@ Dimitris Theodoridis: What is 80 in "ufw allow from to 80"? Is 80 the port or the range? – n00b Mar 19 '13 at 11:14
yes you can work with configuration file for it, but it will not work 100% it depends only on kind of your provider or modem that you have, and i can not give you info about that beacause, i dont have any info about your device, so could be different than my mobile broadband. try to find other solution. you can even try to work with dhpc and command dhclient, but be sure first to make backup of original conf file of network configuration. when you type dhclient that comand renews your ip address try to find more about that on google and how to use it. – Dimitris Theodoridis Mar 19 '13 at 23:26
i can explain how it looks in my case but may not be same. i have ppp0 conn. and configurations are in /etc/ppp folder and in lot of others, forexample i have /etc/ppp/peers/provider file, than chap-secrets in /etc/ppp and there is lot of conf files, you should look it if you using mobile broadband as i do, but, DONT CHANGE THAT FILES IF YOU ARE NOT 100% SURE!!!!! and always create first backup of original conf file – Dimitris Theodoridis Mar 23 '13 at 15:18
this is my /etc/ppp/ppp.conf file: default: set log Phase Chat LCP IPCP CCP tun command ident user-ppp VERSION (built COMPILATIONDATE) set device /dev/cuau0 set speed 115200 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \ \"\" AT OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT" set timeout 180 enable dns provider: set phone "(123) 456 7890" set authname foo set authkey bar set login "TIMEOUT 10 \"\" \"\" gin:--gin: \\U word: \\P col: ppp" set timeout 300 set ifaddr x.x.x.x y.y.y.y add default HISADDR sory maybe not look clear but was so long – Dimitris Theodoridis Mar 23 '13 at 16:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.