5

How can I config multiple instances of browser to connect through different VPN servers?

I'm working in a Linux server and I need that every browser instance uses different VPN servers.


Edited

The goal is navigate simultaneously the same web page with 5 different Selenium instances, when every instance should have IP from different countries.

So, the solution that I thought was using different proxies when every proxy use a VPN.

Does that make sense?

I'm very newbie to these topics, so if the SSH is a good solution, I would like receive more information about how to get a right connection with the SSH solution. Please help me to understand what does it mean to use every param on the connection and how to config a proxy for that.

6
  • 1
    Why do you need this? There may be a simpler way to do whatever you're trying to do.
    – cpast
    May 21, 2015 at 3:54
  • I need different browser instances with different identities(ip from different places) navigating the same page. Do you think there is a simpler solution? May 21, 2015 at 3:59
  • I'm not too familiar with selenium. It sounds like you have a secondary question which is how to start multiple selenium instances with various parameters. That question would probably do better on stack overflow as there are certainly more selenium users there than here
    – amccormack
    May 21, 2015 at 16:10
  • @amccormack I know how to use selenium and config it with a specific proxy, I just need help with the infrastructure part. May 21, 2015 at 17:41
  • If you know how to configure selenium to use proxies, what part of the infrastructure are you confused about? Setting up proxies?
    – amccormack
    May 21, 2015 at 20:54

3 Answers 3

3

Per browser window proxy

It is unlikely that there is a solution for this on a per tab basis. However, you could use the profile feature (or incognito) to allow multiple instances of the browser. Each browser window then can manage its own extensions, thus, can manage its own proxy settings. Here is how I did it in Chrome.

  • In the upper right corner of the browser window, click the button for the current user. It may show that person's name, email, or an icon shaped like a person.
  • Click Switch Person.
  • At the bottom of the window, click Add Person. Create a new account.
  • Install Proxy SwitchOmega. There are many proxy management extensions in the chrome store, this is the one I tried and it worked for me. Configure it for this window. The settings will not be shared to other personas.

Per tab proxie (but not really)

I don't think I have a possible workaround without using separate browsing instances. You mentioned that you are doing this to one page. In that case, you could do this by using port redirection on your local host.

Set two SSH Port Redirects

For example, two set up two SSH port redirects through two different servers, you could use the following commands.

ssh -L 8888:example.com:80 [email protected]
ssh -L 9999:example.com:80 [email protected]

Each browser instance hits a different port.

Have one browser point to 127.0.0.1:8888 and another to 127.0.0.1:9999

Problems

  • This isn't a VPN. You can't guarantee all of the browser traffic will go through the SSH connection. For example, any resource fetching images or scripts on external domains will travel through your host connection. Only resources for the targeted 127.0.0.1:8888 or 127.0.0.1:9999 will be routed through the tunnel. If the webpage has absolute urls, you will have to manually edit the links to reflect the port.
  • The server may be picky about the Host: header. In this case, you could use a header editing extension to set the header statically.
2
  • I updated the question. May 21, 2015 at 15:46
  • the profile trick for chrome is very handy! Thanks for that \o May 13, 2018 at 19:23
0

I found a way to have multiple OpenVPN associated to different browser instances, configuring the VPN to work only for a specific user.

The solution was found here.

Thanks!

0

This solution is for macOS but the concept should obviously work on any other systems:

Use firefox because it has a built-in proxy settings which can be configured without affecting any other firefox installed the OS system and works perfectly compared to other browsers, do not use chrome for macOS.

Copy many instances of firefox.app into different folders. If you want to run lets say 5 instances of firefox browsers simultaneously with each having different IP of nordvpn, then you would need to have 5 copies of firefox.app in different folders. Just copy and paste the firefox.app into different locations.

Then launch each firefox.app and go to the network configuration and add different nordvpn server IP for each firefox browser... enjoy.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .