Add HTB VPN to Kali 2020.1 and Fix VPN Routing Issue (No Internet)

Issue

After adding an the HTB OpenVPN profile to Kali Linux 2020.1, upon connecting to the VPN, an additional default route is added to Kali's routing table forcing all internet traffic to the HTB environment where there isn't actually an internet connection.

This blog post walks through setting up the VPN and removing the extra default route, plus scripting the connection to the VPN since it add the broken route every time the VPN connects.

Download OpenVPN creds from HTB

Get your OpenVPN file from here: https://www.hackthebox.eu/home/htb/access
It comes downloaded as .ovpn. I renamed my file to HackTheBox.ovpn. This will become the name of the VPN connection we see in the GUI.

Adding VPN connection to Kali

Verify network connections first:    
sudo nmcli connection
Now to add the the OpenVPN connection to your list of linux networks:   
 sudo nmcli connection import type openvpn file Downloads/HackTheBox.ovpn
Verify the new network connection was added:   
sudo nmcli connection
In the top right of the screen you can also verify the VPN was added. Toggling the checkbox will connect and disconnect from the VPN respectively.

Fixing Internet Routing issue:

This guide is assuming 1 wired connection and 1 VPN connection. After connecting to the HTB VPN, some users may find their Kali Linux machine no longer can reach the Internet, but is still able to reach the lab environment VMs. This issue is due to the VPN connection adding a more preferred default route out the VPN tunnel interface. 
The route marked 1 in the picture above is an unneeded default route to the HTB environment. The route marked 2 is the default route where internet bound traffic should be sent. This is because the gateway (router.asus.com) is my router, while 10.10.14.1 is the HTB environment on the other end of the VPN tunnel.

If we remove the first default route, our internet bound traffic will use route 2. HTB traffic will remain unaffected and be handled by these two routes which are already installed in the routing table:
Removing the extra default route:   
sudo route del -net default gw 10.10.14.1 netmask 0.0.0.0 dev tun0
After running that the routing table is fixed:

Bash script fix

Every time you disconnect and reconnect to HTB, you'll have to remove the default route. Here is a quick bash script to simply the connection process. Make a file called ConnectToHTB. To make it executable: chmod 755 ConnectToHTB
Added this to the file:
   # Turn on HTB VPN Connection
   nmcli connection up d7aa1e3e-f13f-47b1-8c4a-a99d73bf4dd3
   # Remove default route to HTB to allow Internet access in Linux
   sudo route del -net default gw 10.10.14.1 netmask 0.0.0.0 dev tun0
Replace d7aa1e3e-f13f-47b1-8c4a-a99d73bf4dd3 in the first command with the UUID of your VPN connection, which can be found using nmcli connection

Now to connect to HTB, ./ConnectToHTB from the terminal.

Thanks for reading 

-DJ

Comments

  1. Hopefully this doesn't end up as a double comment, but my last comment just didn't show up.

    In any case, for anyone stumbling across this from the internet, there is far simpler solution. You can just tell network manager not to add the default route.

    ```sh
    $ nmcli connection import type openvpn file [username].ovpn
    $ nmcli connection edit [username]
    # Change connection name to something useful
    > set connection.id htb
    # Disable default routes
    > set ipv4.never-default true
    > set ipv6.never-default true
    # Save the connection changes
    > save
    $ nmcli connection up htb
    ```

    ReplyDelete
  2. Asia Pacific is more likely to|prone to} achieve important traction in the course of the forecast interval owing to the availability of web infrastructure 봄비벳 and the rising adoption of smartphones. Japan and ASEAN countries are anticipated to guide the market in the course of the forecast interval. As per the Summit Barcelona Digital report, the demand for Bitcoin in gambling is accelerating in Japan. For occasion, in July 2021, Entain PLC launched “Gambling Responsibly America” a responsible gaming app for the United States. The app will provide prospects with a software to assist & assist and educational resources for anybody going through potential issues with gambling. The outbreak of the coronavirus has created a vast set of restrictions on land-based gambling arenas.

    ReplyDelete
  3. This on line casino additionally has a no-deposit bonus of $50 in the type of a free chip. The only video games you can use use|you must use} 라이브카지노 it on are slots, and the utmost cash-out is restricted to $100. The wagering necessities for the no-deposit bonus are 35x the bonus amount. As the leading producer of on line casino video games, we know precisely what gamers search and we’re always on prime of the latest taking part in} developments. By extension, we only offer one of the best phrases of|in relation to} bonus offers.

    ReplyDelete
  4. A commonplace flat top or straight slot machine has a set payout quantity that never adjustments. The jackpot payout in a progressive machine, the opposite hand|however|then again}, steadily will increase as gamers put more cash into it, until someone wins all of it and the jackpot is reset to a beginning value. In one frequent progressive setup, a number of} machines are linked together in a single computer system. The cash put into each machine contributes to the central jackpot. In some big progressive video games, machines are linked up from totally different casinos all throughout a metropolis or perhaps a} state. \r\nWhen deciding on the variety of coins 토토사이트 want to} play per spin, keep in mind that|remember that|understand that} more is usually better.

    ReplyDelete
  5. Mr Vegas doesn't serve players would possibly be} deemed underaged and will not't} pay out wins to such players. New players at Mr Vegas are greeted with a one hundred pc deposit bonus as much as} € 200 and 11 Free spins to boost the start of the journey! Make sure to verify the Terms and Conditions for these 1xbet bonuses to get more information.

    ReplyDelete
  6. As a end result, the 888 model will proceed to function over in Canada and has already launched in Ontario. As one of the better online sportsbooks over in Europe, Canadians bettors are in for an actual treat, ought to 888sport increase to different provinces or territories. During this year’s November election, 1xbet Californians will determine whether they need to increase gambling further and allow sports activities betting. A pitched battle between gaming companies, tribes, card rooms, and others has damaged campaign money information and has landed two separate initiatives to legalize sports activities betting on the ballot. Middle – To win both sides of a sport; wagering on the underdog at one pointspread and the favorite at a special pointspread and winning both sides.

    ReplyDelete
  7. With mechanical machines, there was a chance for successful symbols to pop up extra frequently, however now with computerised fashions, the chances are extra advanced and there are various types of slots by variance. The huge actual money prizes on tap make jackpot slots nearly appealing…at least on the surface. But if you care about your chances of successful you've got got} a restricted budget 메리트카지노 – picking a progressive slot machine won't be the best choice for you. Always choose a web-based slot machine recreation with an RTP of 96% or above. This is one of the best slots technique to comply with every time you play — since a high payback share signifies that you have got} a better likelihood to win a spin.

    ReplyDelete
  8. The listing is predicated on the games' 카지노 사이트 RTPs so - that is not simply me pondering these are good games. And I am not talking about gameplay, graphics, or features. I am talking concerning the probabilities you get to win if you spin the reels.

    ReplyDelete
  9. Therefore, totally different animations are used in place of the spinning reels in order to to} display each recreation end result. All modern machines are designed using pseudorandom quantity mills ("PRNGs"), that are constantly producing a sequence of simulated random numbers, at a price of tons of or maybe thousands per second. As soon because the "Play" button is pressed, the most recent random 1xbet korean quantity is used to find out} the end result. This implies that the end result varies depending on precisely when the game is performed. A fraction of a second earlier or later and the end result can be totally different. Tilt is a time period derived from electromechanical slot machines' "tilt switches", which would make or break a circuit once they were tilted or otherwise tampered with that triggered an alarm.

    ReplyDelete

Post a Comment