OSMC PPTP Client Configuration

My parents are retired and have a house in France where they live for about three months of the year. Like most people in the UK, they watch a lot of TV and are big users of the BBC iPlayer. This is a problem when they’re in France as the BBC uses GeoLocation authentication. Simply put, this means they block all connections coming from a non-UK IP address.

One solution to this problem is to route there internet traffic through a Virtual Private Network (VPN). You could host your own VPN, or you could simply subscribe to one of many VPN providers out there. Here I am trying iPortal.

iPortal VPN Connection Details

iPortal supports two protocols for tunnelling – PPTP and L2TP. Unfortunately this means that they do not support OpenVPN.

Here you will need to get your VPN connection details to hand. iPortal only requires a username and password. Other providers may also require you to provide a domain.

Username Password
me@andrewpike.co.uk kw3VX5uigjgf

Here I will be following this as a guide and configuring the client to use PPTP. I am using a Raspberry Pi with the OSMC as the OS.

Install and Configure PPTP Client

First we will need to install the pptp-linux package.

sudo apt-get update
sudo apt-get install pptp-linux

The PPTP configuration file is /etc/ppp/options.pptp. Use a text editor (nano) to edit the file if necessary.

nano /etc/ppp/options.pptp

…and add the following lines if not already present.


You can use egrep to check, as I do below.

egrep "lock|noauth|nobsdcomp|nodeflate" /etc/ppp/options.pptp

You now need to add your username, password and domain (if your providers gave you one) to the chap-secrets file, located in /etc/ppp/. Some provides also require you to specify a domain here – but not iPortal.

sudo nano /etc/ppp/chap-secrets

The format for entering these details are as shown below.


My configuration file simply has the following entry. If you’re using iPortal, your username is normally your email address.

me@andrewpike.co.uk PPTP kw3VX5uigjgf *

Now create a file in /etc/ppp/peers. The name is not important.

sudo nano /etc/ppp/peers/iPortal

Now enter your connection details again like so. You may need to find out the host server name (connect2iportal.co.uk) from your provider. Name, is your your username. Remember to prepend the domain (\\somedomain.com) if required.

pty "pptp connect2iportal.co.uk --nolaunchpppd"
name me@andrewpike.co.uk
remotename PPTP
file /etc/ppp/options.pptp
ipparam iPortal

The ipparam is the name of your VPN connection. This should be the same name of the file you recreated earlier in /etc/ppp/peers. Some providers may require “require-mppe” in place of “require-mppe-128“.

Test Connection

To test, use the pon command followed by the name of your VPN connection. The other information is useful for debugging connection issues.

sudo pon iPortal debug dump logfd 2 nodetach

A successful connection should look something like:

osmc@osmc:~$ sudo pon iPortal debug dump logfd 2 nodetach
pppd options in effect:
debug           # (from command line)
nodetach                # (from command line)
logfd 2         # (from command line)
dump            # (from command line)
noauth          # (from /etc/ppp/options.pptp)
refuse-pap              # (from /etc/ppp/options.pptp)
refuse-chap             # (from /etc/ppp/options.pptp)
refuse-mschap           # (from /etc/ppp/options.pptp)
refuse-eap              # (from /etc/ppp/options.pptp)
name cypike@btconnect.com               # (from /etc/ppp/peers/iPortal)
remotename PPTP         # (from /etc/ppp/peers/iPortal)
                # (from /etc/ppp/options.pptp)
pty pptp connect2iportal.co.uk --nolaunchpppd           # (from /etc/ppp/peers/iPortal)
crtscts         # (from /etc/ppp/options)
                # (from /etc/ppp/options)
asyncmap 0              # (from /etc/ppp/options)
lcp-echo-failure 4              # (from /etc/ppp/options)
lcp-echo-interval 30            # (from /etc/ppp/options)
hide-password           # (from /etc/ppp/options)
ipparam iPortal         # (from /etc/ppp/peers/iPortal)
nobsdcomp               # (from /etc/ppp/options.pptp)
nodeflate               # (from /etc/ppp/options.pptp)
require-mppe-128                # (from /etc/ppp/peers/iPortal)
noipx           # (from /etc/ppp/options)
using channel 1
Using interface ppp0
Connect: ppp0 <--> /dev/pts/1
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xfc34bc4b> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x0 <mru 1400> <auth eap> <magic 0x72c91c98> <pcomp> <accomp> <callback CBCP> <mrru 1614> <endpoint [local:cd.01.ad.7a.1e.78.47.8f.99.0d.63.36.2a.f3.e1.e5.]>]
sent [LCP ConfRej id=0x0 <callback CBCP> <mrru 1614>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xfc34bc4b> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <mru 1400> <auth eap> <magic 0x72c91c98> <pcomp> <accomp> <endpoint [local:cd.01.ad.7a.1e.78.47.8f.99.0d.63.36.2a.f3.e1.e5.]>]
sent [LCP ConfNak id=0x1 <auth chap MS-v2>]
rcvd [LCP ConfReq id=0x2 <mru 1400> <auth chap MS-v2> <magic 0x72c91c98> <pcomp> <accomp> <endpoint [local:cd.01.ad.7a.1e.78.47.8f.99.0d.63.36.2a.f3.e1.e5.]>]
sent [LCP ConfAck id=0x2 <mru 1400> <auth chap MS-v2> <magic 0x72c91c98> <pcomp> <accomp> <endpoint [local:cd.01.ad.7a.1e.78.47.8f.99.0d.63.36.2a.f3.e1.e5.]>]
sent [LCP EchoReq id=0x0 magic=0xfc34bc4b]
rcvd [CHAP Challenge id=0x0 <8adc771b8bafde36f1ef9dd9bc3253c1>, name = "SERVER5955"]
added response cache entry 0
sent [CHAP Response id=0x0 <aa362ea5ed92909ba0a813f6ba6b358f0000000000000000b0c4dc10e810cc54a48717df07a15846da629c63d8b9ce3d00>, name = "me@andrewpike.co.uk"]
rcvd [LCP EchoRep id=0x0 magic=0x72c91c98]
rcvd [CHAP Success id=0x0 "S=B4453B93CA28DC23F07704FE63A06DB0AE569B1E"]
response found in cache (entry 0)
CHAP authentication succeeded
sent [CCP ConfReq id=0x1 <mppe +H -M +S -L -D -C>]
rcvd [CCP ConfReq id=0x4 <mppe +H -M -S -L -D +C>]
sent [CCP ConfNak id=0x4 <mppe +H -M +S -L -D -C>]
rcvd [IPCP ConfReq id=0x5 <addr>]
sent [IPCP TermAck id=0x5]
rcvd [CCP ConfAck id=0x1 <mppe +H -M +S -L -D -C>]
rcvd [CCP ConfReq id=0x6 <mppe +H -M +S -L -D -C>]
sent [CCP ConfAck id=0x6 <mppe +H -M +S -L -D -C>]
MPPE 128-bit stateless compression enabled
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr>]
rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
sent [IPCP ConfReq id=0x2 <addr>]
rcvd [IPCP ConfNak id=0x2 <addr>]
sent [IPCP ConfReq id=0x3 <addr>]
rcvd [IPCP ConfAck id=0x3 <addr>]
rcvd [IPCP ConfReq id=0x7 <addr>]
sent [IPCP ConfAck id=0x7 <addr>]
local  IP address
remote IP address
Script /etc/ppp/ip-up started (pid 653)
Script /etc/ppp/ip-up finished (pid 653), status = 0x0

To stop it, use Ctrl + C or the below command from anther terminal.

sudo poff iPortal

Route Traffic Through VPN

Once you have successfully connected to your VPN provider, you now need to route your traffic through it. Before doing that, you might want to make a note of your public IP address first. You can do this from the command line with the curl command. This should return the IP address of your ISP.

osmc@osmc:~$ curl -4 icanhazip.com

Now reconnect to your VPN with the following command.

sudo pon iPortal

Wait a few seconds and then route your traffic through the VPN.

sudo route add default dev ppp0

Now check your public IP address again. If all when well – it should now be the IP address of your VPN provider!

osmc@osmc:~$ curl -4 icanhazip.com

Your VPN is now working!


Now we have to automate the process. I created two scripts with 755 permissions

osmc@osmc:/myscripts$ ls -l
total 8
-rwxrwxr-x 1 osmc osmc 134 Aug 12 21:01 iPortal_connect.sh
-rwxrwxr-x 1 osmc osmc 114 Aug 12 21:01 iPortal_disconnect.sh

The iPortal_connect.sh file looks like the following.


sudo pon iPortal
sleep 10
sudo route add default dev ppp0
echo "VPN Connected: $(curl --silent -4 http://icanhazip.com)"

And the iPortal_disconnect.sh looks like.


sudo poff iPortal
sleep 2
IP="$(curl --silent -4 http://icanhazip.com)"
echo "VPN Disconnected: $IP"

Here’s the output from executing these scripts.

osmc@osmc:/myscripts$ ./iPortal_connect.sh
VPN Connected:
osmc@osmc:/myscripts$ ./iPortal_disconnect.sh
VPN Disconnected:

Launch Scripts from within OSMC

The guide I’m following uses the Advanced Launcher plugin for OSMC. Sadly it was at this point that I realised that Advanced Launcher seems to have died a horrible death and is not available any more! I will need to do a bit more research on this one it looks like – I don’t think my folks will be SSH’ing into the Pi to execute a script each time they want to watch the news lol!!!

Related Documents


iPortal VPN Review




Installing Xorg on Gentoo with the nouveau Driver

I configured my kernel as shown here. That was based on the information found here and here. Check out the resources section at the bottom.

Because my kernel is good-to-go, I should just need to make the following changes to my make.conf file before installing xorg-server.

nano /etc/portage/make.conf

These are the changes I made.


Make sure you have the following USE flag.

echo "x11-base/xorg-server" >> /etc/portage/package.use

Before installing xorg-server.

emerge --ask xorg-server

Now refresh your environment.

source /etc/profile

I choose to reboot here.

Starting X

Xorg “should” work out-of-the-box so there “should” be no need to manually create and edit configuration file in the /etc/X11/xorg.conf.d/ directory. Here goes…


The Necessary Troubleshooting

Obviously that didn’t work because that would be too easy!! The output showed xauth complaining about a few things, namely stuff like.

hostname Unknown host
xauth: file /root/.serverauth.4170 does not exist

Then Xorg tries to start but fails with this.

/etc/X11/xinit/xinitrc: line 59: twm: command not found
/etc/X11/xinit/xinitrc: line 60: xclock: command not found
/etc/X11/xinit/xinitrc: line 61: xterm: command not found
/etc/X11/xinit/xinitrc: line 63: exec: xterm: not found
/etc/X11/xinit/xinitrc: line 62: xterm: command not found
xinit: connection to X server lost

waiting for X server to shut down Server terminated successfully (0). Closing log file.

The Fix

Funnily enough, it was the hostname Unknown host message that bothered me the most as this indicates a general networking issue. Turned out I hadn’t associated my hostname with the localhost. This was easily solved by editing /etc/hosts and amending the below line. This removed that particular error but did not get Xorg working.            localhost storm

Now I have a fairly good idea what might be up here but if all this is new to you and your Xorg is failing with similar messages, there a few clues in errors.

One thing to bear in mind is that users of X must be part of the video group. I thought this might explain the xauth warnings. However this can be easily checked with.

storm ~ # groups andy
root bin daemon sys adm disk wheel floppy tape video

Lastly, as per the docs, I believe twm and xterm should be installed. This certainly fits with the last few errors.

emerge --ask twm xterm xclock

This will pull in a few extra packages but hopefully Xorg should work now. Although not strictly necessary, I install xclock here too.

xterm screen shot



Gentoo Wiki – Xorg/Configuration

Gentoo Wiki – X server

Gentoo Wiki – X without Display Manager

Linux Reviews – Screenshot grabbing


Gentoo Wiki Archives – Dell_2407WFP_LCD

Gentoo Wiki – xorg.conf

Gentoo – X.Org/xsession

Gentoo Wiki – Fontconfig

Gentoo Wiki Archives – HOWTO_Xorg_and_Fonts

Gentoo.org – rxvt-unicode

ArchLinux – Multihead

ArchLinux – Nouveau

ArchLinux – Xorg

ArchLinux – X resources

ArchLinux – rxvt-unicode


How-To Geek – How to Quickly Resize, Convert & Modify Images from the Linux Terminal

geom.uiuc.edu – Manipulating Images

Redhat.com – Doing more with…more: Dual-head display

Gentoo – X.Org/Dual Monitors

ArchLinux – Configuring keyboard layouts in X