Ngrok is one of the most popular tunnel service platform through which you can easily expose your local servers which is behind NATs/Firewalls to the public internet over secure tunnels.
It connects to the ngrok cloud service which accepts traffic on a public address and relays that traffic through to the ngrok process running on your machine and then on to the local address you specified.
Features of Ngrok –
- You can instantly create a public HTTP/HTTPS URL for a website running locally in your development machine.
- Their tunnels are very fast and works on HTTP/2 protocol which actually speeds up your loading.
- You can even protect your tunnel with the help of HTTP Basic Authentication.
- With the help of web based portal, you can easily inspect (Request/Response) all the incoming traffic to your tunnel.
- You don’t need to do any kind of port forwarding while using Ngrok.
- You can even expose your network service to the internet with the help of TCP tunneling.
- Multiple simulatenously tunnels can be worked.
- Websocket support is also there in free plans.
Related Articles on Ngrok –
In paid plans –
- You can choose any custom domain name.
- You can reserve your ngrok.io sub-domains and tcp addresses.
- IP White listing can be done in paid plans.
Step 1 – Create a Free Account on Ngrok.com, basically you can create an account on Ngrok by three ways.
- – With your personal Email
- – With Github
- – With Gmail
You can choose any way for signing up into Ngrok.
Step 2 – After confirming the account with your mail ID, just try to login with the same details which you’ve used while creating the account.
Step 3 – After successful signup, you’ll a Dashboard Page in front of you just like below:
Step 4 – Now you need to download the Ngrok package from the Download Page.
Based on your operating system, you can choose the file and ngrok supports all OS (Windows/Linux/MacOSX)
Step 5 – Next step is to install the package which you’ve downloaded from previous step.
- To extract the package in Linux/MacOSX – type “unzip /path/to/ngrok.zip” in your command terminal.
- And for Windows, just simply double click on the file and extract the .exe file with the help of Winrar/Winzip.
Step 6 – Now to use ngrok in windows, run command prompt from same directory where you’ve downloaded the package.
Step 7 – Furthermore, you also need to install an authtoken. By running below command will add your account’s authtoken to your ngrok.yml file.
Command: ngrok.exe authtoken <Your Token>
Command: ./ngrok authtoken <Your Token>
Step 7 – Starting your first tunnel
Once you have your local server running, you can open a tunnel to the port where your application is running.
For local web server to internet, type “ngrok.exe http 80” in your cmd terminal.
Here you can see that, we’ve created a dummy index.php file into our xampp server which can easily be accessed on Internet with the help of Ngrok tunnelling address.
You can also inspect your all incoming HTTP traffic by using their web based portal which you can easily access by opening http://localhost:4040 in your web browser.
And to disable this inspection, type “ngrok.exe http -inspect=false 80” in your same terminal
As we see, ngrok assigns random hexadecimal names to every HTTP tunnels which it opens for you but if you want to display a custom URL then you actually start the ngrok service with a custom name as shown in below command:
Command: ngrok.exe http -subdomain=yeahhub 80
Then your internet address will be http://yeahhub.ngrok.io/
To secure your tunnel you can use -auth switch which enables HTTP basic Auth security on all requests as shown in below command:
Command: ngrok.exe http -auth=”username:password” 8080
In Business/Pro/Basic plan, you can even use your custom domain with the help of CNAME Records.
Pricing Plans –
- For Basic plan, $5/month/user ($60/year)
- For Pro plan, $10/month/user ($99/year)
- For Business plan, $15/month/user. ($144/year)
More Tunneling Options –
1. Forward TLS traffic to a local HTTPS server on port 443
Command: ngrok.exe tls 443
2. Expose a TCP based service running on port 22
Command: ngrok.exe tcp 22
Default configuration file locations –
- For OS X – /Users/example/.ngrok2/ngrok.yml
- For Linux – /home/example/.ngrok2/ngrok.yml
- For Windows – C:\Users\example\.ngrok2\ngrok.yml
For more information about ngrok, read ngrok docs manual.
Step by step hacking tutorials about wireless cracking, kali linux, metasploit, ethical hacking, seo tips and tricks, malware analysis and scanning.