Accessing Local Resources over the Internet with Packetriot

When I am doing any development, such as for PostRecycler, I do the coding on my laptop running Apache, PHP and MySQL locally via MAMP. This is fine until I need to share work with others which means I have to either upload the work onto a public server or do it via screen sharing. Neither are particularly ideal.

I was vaguely aware of the service ngrok which allows you to expose your local services on the web and then, via Reddit, saw the similar service Packetriot which does a similar thing so I thought I would give it a go.

Why did I go for Packetriot and not ngrok? Simply because the Packetriot free tier has a static domain meaning I only needed to update my Virtual Host file one but more on that later.

One-off Configuration

Installation is simple in that it is just a couple of files to download and put wherever you like. You then need to complete a simple configuration by running the following:

./pktriot configure

The image below shows the steps but they are:

  1. select where to store the config file
  2. authenticate the client by clicking the given link
  3. choose the region for the edge server
  4. give the tunnel a name.

Connection Configuration

Once the setup has been completed you can configure you connections. There are a few things you can do such as setup a link that delivers static content but I was more interested in being able to access Apache running on my laptop.

To do this you need to first allocate a tcp port by running:

./pktriot route tcp allocate

This will return a post number such as “Allocated port 21524” which you can then use to map as follows. Here I am giving the local IP address of my laptop and the post that Apache is listening on (8888):

./pktriot route tcp forward --port 22568 --destination 192.168.0.68 --dstport 8888

Now Packetriot setup is complete and to start you simply issue the following:

./pktriot start

You will then see the following and from a browser go to the URL that you have been allocated along with the port number.

Other Configuration

On first try I found that the page wasn’t loading. After a bit of head scratching I realised that I needed to add the domain to Apache’s virtual hosts file. This is where Packetriot scores over ngrok as the domain you are allocated but the former is persistent unlike that allocated by ngrok. This meant that once I had made the virtual host changes it was done and that was a winner for me.

Once I had done that it worked seamlessly and the speed wasn’t too shabby either.

Conclusion

Packetriot provides an online page where you can keep tabs on your account and check your usage. Pricing is based on the number of tunnels and bandwidth usage but for the occasional light usage I will be making of it the free tier should be fine.

Once I had got my head around the creation of the tunnel it was really easy to setup and use and I’ve been really impressed. I definitely recommend it if you are looking to access your local machine on the net and want a good alternative to ngrok.

Leave a Reply

Your email address will not be published. Required fields are marked *