Tunnelling into your Chef Kitchen Vagrant instance

So you’ve just done this:

And now something has gone wrong on the box and you need to tunnel through to check something on your instance (say mysql database). Whatever the port may be, you need to change your current directory to where the vagrant file is. This can be achieved by running the following command relative to where your kitchen file is:

List the directory and you will be able to see a Vagrantfile in it. Once you are there, run:

Here I’m using mysql port 3306, you can replace it with whatever port you want to tunnel through.

If you want to tunnel multiple ports, run:

Repeating -L <BIND_ADDRESS> multiple times.