Proxy Validation and Configuration in Linux server

How to validate and configure Proxy in Linux server?

To Validate a Proxy in Linux, you can follow these steps:

  1. Check Proxy Settings:
    • First ensure that the proxy settings are configured correctly. Open a terminal and run the following command to specify the environment variable associated with the proxy system:
      • env | grep -i proxy
    • This will show the current Proxy Configuration
  1. Test Proxy Connectivity:
    • Use tools like curl or wget to test if the proxy is working as expected. For example:
      • curl -I http://google.com
    • If the proxy is functioning correctly, you should see a standard HTTP response. Otherwise, you may encounter a connection error
  2. Check Public IP Address:
    • Obtain your public IP address using the following command:
      • wget -q -O - checkip.dyndns.org | sed -e 's/.Current IP Address: //' -e 's/<.$//'
    • Compare this IP address with the one you expect from your proxy server.
  3. Additionally, check if the http_proxy and https_proxy environment variable is present:
  • env | grep https_proxy
    

    env |grep http_proxy

To configure the Proxy in Linux, follow these steps:

  1. Temporary Proxy Configuration
    • To set up a temporary proxy connection that resets after a system reboot, use the export command in the terminal. Replace the placeholders with your actual proxy details:
      • export HTTP_PROXY="http://[proxy-web-or-IP-address]:[port-number]"
        export HTTPS_PROXY="http://[proxy-web-or-IP-address]:[port-number]"
    • Make sure to provide the proxy address (web or IP) and the corresponding port number.
  2. Permanent Proxy Configuration (User-Specific)
    • Create and edit Configuration file ( If it doesn't exist) using this command
      • vi ~/.bashrc_proxy
    • Add the following lines, replacing “proxy_ip” and “proxy_port” with the appropriate values
      • export http_proxy="http://proxy_ip:proxy_port"
        export https_proxy="http://proxy_ip:proxy_port"
        
  3. Save and exit the file by pressing the keys , "esc" ":" "wq" "!" "enter"
    • Apply the proxy settings:
      • source ~/.bashrc_proxy

      • ​​​​​​​ ​​​​​​​