access localhost with pagekite

06 Apr 2013

I ♡ pagekite, it allows me to connect to my laptop from anywhere, literally, it doesn’t matter if my computer is behind a nat router or if my input traffic is blocked, as long as my computer can start connections to internet I’m covered. And I don’t need to redefine anything, it will work even if I’m changing constantly networks.

Why do I need to access my computer under every possible scenario?, personal portability, I prefer to travel lightly, just give me a book and some headphones and I’m ready to go to the end of the world. And even though I’ve most of my stuff in servers some things somehow end in my personal laptop.

So, right now I connect to home by typing:

$ ssh

It doesn’t matter where I’m, neither where my laptop is, it will just work 😂

If you’re interested in setting something similar up, go and create an account in, personal startup of Bjarni Einarsson, icelandic hacker.

Once done, you’ll be able to run:

$ curl -s |sudo bash #for installing pagekite in 1 line
$ 80

And now you’ll be running your own web server available to the world, isn’t great? Now let’s talk about more interesting stuff such us using your own domain and connecting to ssh or any other protocol.

This is what happens when someone uses pagekite:

$ ssh
       192.168.1.x   192.168.1.x
       :::::::::::        :::::::::::          ::::::::::::        :::::::::::::::
       | client  |   =>   |   dns   |    =>    | pagekite |     => |   laptop    |
       :::::::::::        :::::::::::          ::::::::::::        :::::::::::::::

The computer where the client is launched will connect to a dns, which in return will send it to a pagekite subdomain and from there to a reverse connection between pagekite and your server. Alloying to exchange data between client and server(laptop behind nat) through pagekite servers.


For this to work, must point to pagekite. This can be done with a CNAME entry, and it depends of your dns provider. In my case it looks like this (

Upon registration, pagekite will give you a subdomain for free where you can add other subdomains to get

You need to register the CNAME entry in pagekite as well:

Now your home page should look like this:


Now it’s time to configure pagekite in the target machine:

###[ Current settings for v0.5.6a. ]#########
# ~/.pagekite.rc
## NOTE: This file may be rewritten/reordered by

##[ Default kite and account details ]##
kitename =
kitesecret = KITESECRET_KEY

##[ Front-end settings: use defaults ]##

##[ Back-ends and local services ]##
service_on = http:@kitename : localhost:80 : @kitesecret
service_on = raw-22:@kitename : localhost:22 : @kitesecret

##[ Miscellaneous settings ]##
savefile = ~/.pagekite.rc

###[ End of configuration ]#########

And launch the service:

$ ./
>>> Hello! This is pagekite v0.5.6a.                            [CTRL+C = Stop]
    Connecting to front-end ...
     - Protocols: http http2 http3 https websocket irc finger httpfinger raw
     - Protocols: minecraft
     - Ports: 79 80 443 843 2222 3000 4545 5222 5223 5269 5670 6667 8000 8080
     - Ports: 8081 9292 25565
     - Raw ports: 22 virtual
    Quota: You have 2559.74 MB, 29 days and 4 connections left.
    Connecting to front-end ...
~<> Flying localhost:22 as ssh:// (HTTP proxied)
~<> Flying localhost:80 as
 << [flying]   Kites are flying and all is well.


To connect to your laptop you can use any web browser or complete an extra step to be able to use ssh. The $HOME/.ssh/config file should be edited as follows:

    CheckHostIP no
    ProxyCommand /bin/nc -X connect -x %h:443 %h %p

WARNING: the nc command must be the openbsd version, in Ubuntu it’s called netcat-openbsd

If everything is correct, you should now be able to login:

$ ssh's password:

Own Server

Pagekite is free software, both backend(client) and frontend(server). The same can play both roles. This is a quick summary in case you prefer going your own.

(vps) $ pagekite --clean --isfrontend --ports=8080 --domain=*
>>> Hello! This is pagekite v0.5.6a.                            [CTRL+C = Stop]
    This is a PageKite front-end server.
     - Listening on *:8080
(target) $ pagekite --clean --service_on=http/
Connecting to front-end ...
     - Protocols: http http2 http3 https websocket irc finger httpfinger raw
     - Protocols: minecraft
     - Ports: 8080
~<> Flying localhost:8080 as

And with that, your local machine will be available on Internet through your own public machine.

That’s it, happy flying 😋