Good day everyone.
I do want to implement a transparent proxy between two VMs.
One is CentOS, the other is Ubuntu. I am on a *NIX pc. I have enabled "Adapter 2" as Internal Network (intnet) - And enabled "Allow VMs" on both CentOS and Ubuntu. What should I do next? Should I use brctl to configure a bridge? Which steps are needed?
Any help would be appreciated.
Thank you everyone.
Setting up a transparent proxy in VirtualBox
-
llIlllIlllIllIl
- Posts: 6
- Joined: 20. Dec 2016, 18:38
-
scottgus1
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows, Linux
Re: Setting up a transparent proxy in VirtualBox
You should read up on the kinds of network connections Virtualbox has, in the manual, section 6.
There are several kinds:
between-guests-only ("internal")
guests and the host but not outside the host ("host-only")
guests get on the physical LAN like the host does and look to the LAN like more PCs ("bridged"),
putting a virtual router between the LAN and one guest ("NAT") or several guests ("NAT network")
Connect the guests together using the network types you need to get the job done, just like you'd do with real network equipment.
Is the proxy you are going to put between the two VMs also going to run in a VM? Or is it going to run on the host?
There are several kinds:
between-guests-only ("internal")
guests and the host but not outside the host ("host-only")
guests get on the physical LAN like the host does and look to the LAN like more PCs ("bridged"),
putting a virtual router between the LAN and one guest ("NAT") or several guests ("NAT network")
Connect the guests together using the network types you need to get the job done, just like you'd do with real network equipment.
Is the proxy you are going to put between the two VMs also going to run in a VM? Or is it going to run on the host?
-
llIlllIlllIllIl
- Posts: 6
- Joined: 20. Dec 2016, 18:38
Re: Setting up a transparent proxy in VirtualBox
I have to enable the Squid proxy server on CentOS and block a certain website in Ubuntu in a Transparent way. The Squid Proxy Server is hosted in CentOS, the website I have to block is on the Ubuntu VM.
Last edited by socratis on 20. Dec 2016, 20:28, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
Reason: Removed unnecessary verbatim quote of the whole previous message.
-
scottgus1
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows, Linux
Re: Setting up a transparent proxy in VirtualBox
One more thing. Will you be trying and failing to access the website on the CentOS guest's browser or on the host?
-
llIlllIlllIllIl
- Posts: 6
- Joined: 20. Dec 2016, 18:38
Re: Setting up a transparent proxy in VirtualBox
I will fail to access the website on Ubuntu. CentOS "just" hosts the squid proxy server.scottgus1 wrote:One more thing. Will you be trying and failing to access the website on the CentOS guest's browser or on the host?
-
scottgus1
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows, Linux
Re: Setting up a transparent proxy in VirtualBox
So you're going to type in the website on the Ubuntu, and the website is hosted on the Ubuntu, and the Ubuntu browser will look to the CentOS proxy which will interfere with the website lookup?
If this is accurate, then I'm not sure how it would work. I haven't done proxies before, but I surmise they control internet access from a client browser thrugh the proxy out to another computer on the internet;
OS with browser ---> proxy ---> server on internet
What you appear to be trying looks like:
OS with browser ---> proxy
and server <-------------|
Can that be done with one network? BillG would know.
If I had to use just two guests I would at least start with two internal networks - you make new ones just by typing in a new name. Set the first network cards in the guests to "intent" (the default internal network in Virtualbox) and the second cards in the guests to "proxynet" or some other name. Then try to keep the internet traffic routed right.
What I would choose to do is have three guests, to simulate the usual connections between PC, proxy & internet server. Then the connections may be easier. "Intnet" between browser & proxy, two network cards in the proxy guest, and "proxynet" between the proxy guest and a web server guest.
If this is accurate, then I'm not sure how it would work. I haven't done proxies before, but I surmise they control internet access from a client browser thrugh the proxy out to another computer on the internet;
OS with browser ---> proxy ---> server on internet
What you appear to be trying looks like:
OS with browser ---> proxy
and server <-------------|
Can that be done with one network? BillG would know.
If I had to use just two guests I would at least start with two internal networks - you make new ones just by typing in a new name. Set the first network cards in the guests to "intent" (the default internal network in Virtualbox) and the second cards in the guests to "proxynet" or some other name. Then try to keep the internet traffic routed right.
What I would choose to do is have three guests, to simulate the usual connections between PC, proxy & internet server. Then the connections may be easier. "Intnet" between browser & proxy, two network cards in the proxy guest, and "proxynet" between the proxy guest and a web server guest.
-
BillG
- Volunteer
- Posts: 5106
- Joined: 19. Sep 2009, 04:44
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows 10,7 and earlier
- Location: Sydney, Australia
Re: Setting up a transparent proxy in VirtualBox
Before you can emulate a network setup with virtual machines and networks, you need to know how to do it with physical ones. Then work out how to emulate that setup. With physical machines you would use a hub/switch to connect the devices and the server only would have a separate connection to the Internet.
A proxy server gives Internet access to a machine which otherwise cannot access the Internet, so using an internal network makes sense, but it makes no sense if the server does not have Internet access itself. The simplest way to do that would be to give the virtual server a second NIC set to bridged so that it has access to the physical network. To sum up, the server has two NICs, one bridged to the physical LAN and one in the internal virtual network. The Ubuntu client has only one NIC in the internal network.
This networking setup is pretty common for any method of connecting a virtual network to a physical one. You need some device with an interface in each network.
A proxy server gives Internet access to a machine which otherwise cannot access the Internet, so using an internal network makes sense, but it makes no sense if the server does not have Internet access itself. The simplest way to do that would be to give the virtual server a second NIC set to bridged so that it has access to the physical network. To sum up, the server has two NICs, one bridged to the physical LAN and one in the internal virtual network. The Ubuntu client has only one NIC in the internal network.
This networking setup is pretty common for any method of connecting a virtual network to a physical one. You need some device with an interface in each network.
Bill