VPNs, or Virtual Private Networks, are a popular way to increase security and privacy while browsing the internet. One common question people have about VPNs is whether or not using a VPN will change their public IP address. The answer to this question depends on the type of VPN being used.
What is a Public IP Address?
A public IP address is a unique identifier assigned to a device when it connects to the internet. This address is visible to other devices and websites on the internet and can be used to locate the general geographical area of the device.
VPNs and Public IP Addresses
When you use a VPN, your internet traffic is routed through a remote server operated by the VPN provider. This server then assigns your device a new IP address, which is used to identify your device on the internet.
Changing Public IP Address with GlobalProtect VPN
GlobalProtect is an example of a VPN that changes a user's public IP address. When you connect to the internet using GlobalProtect, your device is assigned a new IP address by the VPN server. This new IP address is different from your original public IP address and can be used to mask your location and identity online.
here is an example of how to connect to GlobalProtect VPN:
# Import the necessary module
import pexpect
# Define the username and password
username = "your\_username"
password = "your\_password"
# Define the command to start the GlobalProtect VPN connection
command = "sudo /opt/pan/globalprotect/gateway/gp \\
-j -u {} -p {}".format(username, password)
# Start the connection
child = pexpect.spawn(command)
# Wait for the VPN connection to be established
child.expect("GlobalProtect Connect Successful")
Not Changing Public IP Address with OpenVPN
OpenVPN is an example of a VPN that does not change a user's public IP address. When you connect to the internet using OpenVPN, your device is assigned a new private IP address by the VPN server. However, your original public IP address remains visible to other devices on the internet.
Here is an example of how to connect to OpenVPN:
# Import the necessary module
import pexpect
# Define the username and password
username = "your\_username"
password = "your\_password"
# Define the command to start the OpenVPN connection
command = "sudo openvpn --config openvpn.ovpn"
# Start the connection
child = pexpect.spawn(command)
# Send the username and password
child.sendline(username)
child.sendline(password)
# Wait for the VPN connection to be established
child.expect("Initialization Sequence Completed")
- A public IP address is a unique identifier assigned to a device when it connects to the internet.
- When you use a VPN, your internet traffic is routed through a remote server operated by the VPN provider.
- Some VPNs, like GlobalProtect, change your public IP address when you connect to the internet.
- Other VPNs, like OpenVPN, do not change your public IP address when you connect to the internet.