Score:0

How to make virtual machine and host use the same proxy?

ae flag

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.

user535733 avatar
cn flag
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.
Amirmohammad Divani avatar
ae flag
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.
Christian Ehrhardt avatar
sl flag
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?
Score:0
ae flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.