0

The host (Windows 11) is using v2ray protocol proxy, I want the virtual machine (Ubuntu 22.04) to use the same proxy so that they can both access free internet. Is there any way to connect the two together?

I have tried changing connection type from NAT to Bridged mode on the virtual machine (Ubuntu 22.04) and it didn't help.

Please note that I have severe limitations on updating and installing packages from the internet on the VM (Ubuntu 22.04) because of internet conditions. Thank You.

  • 2
    When using NAT, the network connection is provided by the host and uses host networking settings -- though those settings are invisible to the Ubuntu Guest. Restore NAT. – user535733 Jul 15 '23 at 20:26
  • Thank you @user535733 But how to make it use the proxy? NAT is just making use of host's network but not the actual proxy that the host is using to connect to the Internet. – Amirmohammad Divani Jul 16 '23 at 07:34
  • Might the question actually just a special form of "how to set the Ubuntu guest to know and use the proxy?" If so that would be a duplicate of https://askubuntu.com/questions/158557/setting-proxy-for-apt-from-terminal right? – Christian Ehrhardt Jul 17 '23 at 05:43

1 Answers1

0

So, I managed to solve the issue on my own. Here are the steps required:

  1. Enabled IP forwarding on all virtual network adapters. (not sure if necessary)
  2. Found the host's IP. In my case it was something like 192.1.1.127.
  3. Noted the exact port on which the proxy was running in the host.
  4. Went to the VM and set the default gateway to the host IP and set the port to exact number on which the proxy was running on the host.

I did all this a few weeks ago so I don't remember the exact commands for this but anyone reading this should be able to do it without the pain and struggles that I went through. BTW, only the first step required a few commands which enable forwarding on all virtual NICs and I'm not sure if it was necessary for this to work. The VMware network mode was on NAT also, which is the default. You can literally do the fourth step via the menu and going to network adapters and set the default gateway there.