Introduction
Freelancers often find themselves in a catch-22 situation when using platforms like Fiverr, Upwork, and Freelancer.com. These platforms require users to maintain their real location for trust and verification purposes. However, freelancers also need to use VPNs for various reasons, including security and privacy. This guide provides a solution to this dilemma by using a simple Bash script that routes specific domain traffic through your local network, bypassing the VPN.
Why This Script is Necessary
- Trust and Verification: Freelancing platforms require users to maintain their real location for trust and verification.
- Security Concerns: Freelancers often use public Wi-Fi, making VPNs essential for secure communication.
- Geo-Restrictions: Some freelancers need to bypass geo-restrictions for accessing client resources, making VPNs necessary.
The Script Explained
The script uses the route
command to add a new route for the specified domain’s IP addresses, directing them to go through your local network router. This ensures that when you access these domains, the traffic bypasses the VPN and goes through your local network, thus showing your real location.
#!/bin/bash
# Check if OpenVPN interface is active
if ifconfig | grep -q ‘tun0’; then
echo “OpenVPN is active. Please disconnect from OpenVPN before running this script.”
exit 1
fi
read -p ‘Enter the domain you want to route (e.g., fiverr.com): ‘ domain
# Remove existing routes for the specified domain
for host in “$domain” “www.$domain”; do
for ip in $(dig +short $host); do
sudo route delete -host $ip
done
done
# Get the currently assigned router IP address from DHCP
router_ip=$(ip route | awk ‘/default/ {print $3}’)
# Add routes for the specified domain using the DHCP-assigned router IP
for host in “$domain” “www.$domain”; do
for ip in $(dig +short $host); do
sudo route add -host $ip $router_ip
done
done
How to Use the Script
Step 1: Open Terminal
- Linux/Mac: You can open the terminal from the Applications menu or use the keyboard shortcut
Ctrl+Alt+T
(Linux) orCmd+Space
and then type “Terminal” (Mac). - Windows: If you’re using a Bash-compatible terminal like Git Bash or WSL, you can open it from the Start menu.
Step 2: Check for Active OpenVPN Connection
Before running the script, it’s crucial to ensure that OpenVPN is not active, as the script will exit if it detects an active OpenVPN connection. You can manually disconnect from OpenVPN or the script will prompt you to do so.
Step 3: Navigate to the Script’s Directory
Use the cd
command to navigate to the directory where you’ve saved the script. For example, if you’ve saved the script in a folder named “Scripts” on your desktop, you’d type:
cd ~/Desktop/Scripts
Step 4: Run the Script
Run the script by typing the following command:
bash script_name.sh
Replace script_name.sh
with the actual name of your script.
Step 5: Enter Domain and IP
- Enter Domain: When prompted, type the domain you want to route, such as
fiverr.com
or freelancer.com. - If You Move Networks/Change WiFi Networks: If you move networks this script must be run again on the new network since your Router’s IP can and often will change.
Conclusion
This script offers a simple yet effective solution for freelancers who need to use a VPN while maintaining their real location on freelancing platforms. By routing specific domain traffic through your local network, you can meet the platform’s location requirements without compromising on security.