Tip & Tricks for Lab/Exams Connections

OpenVPN configuration files downloaded from the portal supports TCP/UDP at the same time. TCP is selected by default to avoid issues, but in some cases it could be better to switch the connection to UDP to perform aggressive scans or tasks. This can be done editing the OpenVPN configuration file and removing or commenting the following line.

<snip>
client
# remote <IP> <PORT> tcp <- Comment this line
remote <IP> <PORT> udp
<snip>

VPN connections can drop for several reasons. When this happens, we will be prompted for credentials for reconnecting. If we want to connect back automatically without providing credentials, we can use the --auth-user-pass feature from OpenVPN.

  1. Create a text file with just two lines containing username and password.
  2. Connect via sudo openvpn --config <OVPN_FILE> --auth-user-pass <CREDS_FILE>

DNS Servers must be configured in some labs, this can be done in Linux by adding the following line as the first entry in /etc/resolv.conf.

nameserver <LAB_DNS_IP>

This configuration file can be reverted back to its original state if we experience a connection drop. To avoid changing the file while we are working on the lab, we can set an immutable flag to the file via:

sudo chattr +i /etc/resolv.conf # Add flag
sudo chattr -i /etc/resolv.conf # Remove flag

In some cases it will be necessary to flush the DNS Cache from the browser via:

  • Firefox: Type “about:networking#dns” → Clear DNS Cache
  • Chrome: Type “chrome://net-internals/#dns” → Clear host cache.

Although it’s not the fastest method, remember that files/folders can be shared via RDP too, double check your client’s documentation (Microsoft Remote Desktop Client or xfreerdp recommended for the labs)

Hi,

I’ve been trying to make this work for me on my mac. I found out that I can access the labs only if I remove every other DNS server from the list, even if it’s not primary (meaning I won’t have any other internet connection to anything outside the lab).

For instance, this doesn’t work:

Screen Shot 2021-08-28 at 23.03.56

Whereas when I remove the 8.8.8.8 DNS, the lab connection will work up to a certain point. Eventually, the lab stops, as it seems no URLs outside the lab domain will get resolved → loses connection to my.ine.com → lab pauses

Any clue on how to solve this?

Hi lucas, i have the same problem with you, any solution for this ?

Not really. In my research back then, I found out to be more of a mac issue, but I can’t really remember the root cause. Sorry for not being able to give you a detailed explanation – It’s been a while.

I survived with a workaround, though: VMware fusion + Kali image and doing everything from there.

Hello, i have encountered an issue using MacOS, the chattr command is not found. Using chflags as stated here is not working either. But when I tried in VMware fusion + Kali image, it worked. Any workaround of chattr to be used in MacOS? Because I prefer using bare machine instead of VM. Thank you in advance!