Page 1 of 1

host-only networking: vm and native squid HOW?

Posted: 4. Jun 2009, 19:19
by pete.dawgg
i have a box with two physical nics. i want to use an iis in a vm that connects to an internal database over one of the physical nics and a squid-proxy that runs in reverse mode on the other physical nic and communicates with the "outside world." both work (separately, till now. if i let the iis listen on the if that vbox assings to it it can be reached from the internal network.)
how do i configure virtualbox and the internal (tap???) interface on the host for squid so squid and iis can communicate? (i think the virtualbox documentation is deliberately sparse and unclear on all those points :( )

outside---|------------------------- ::BOX:: --------------------------|---inside
WWW - :[ eth0-SQUID-intif0==intif1-(-VBOX-IIS vbox0-)-br0-eth1]: - DATABASE

i want to use internal/hostonly (???) networking for the connection between squid and the virtual iis. there must be no connection between the "outside" and the vm and no connection between the "inside" and squid - just the perfect scenario for host-only networking according to the manual. i just don't know how to set it up.

this is the script i use to set up the network before starting virtualbox:

Code: Select all

modprobe -v vboxdrv
modprobe -v vboxnetflt
chmod -R 0666 /dev/net/tun
chown -R vbox:vboxusers /dev/net/tun
VBoxTunctl -u vbox -t vbox0
ifconfig eth1 promisc
ifconfig eth1 promisc 0.0.0.0
ifconfig vbox0 promisc 0.0.0.0
brctl addbr br0
brctl addif br0 vbox0
brctl addif br0 eth1 
brctl setfd br0 0
brctl stp br0 on
ifconfig br0 0.0.0.0 promisc 
(even though the manual claims otherwise i cannot use the host's pyhsical device directly, i have to use this bridge).
in version 2.2.2 the process on the host would freeze when turning of the vm, in 2.2.4 it works nicely.

this is the config of all ifs on the host (all statistics cut out):

Code: Select all

br0       Link encap:Ethernet  HWaddr 00:1e:68:9b:54:57  
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
        
eth0      Link encap:Ethernet  HWaddr 00:1e:68:9b:54:56  
          inet addr:172.0.62.62  Bcast:172.0.62.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        
eth1      Link encap:Ethernet  HWaddr 00:1e:68:9b:54:57  
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
        
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
        
vbox0     Link encap:Ethernet  HWaddr 1e:58:56:d1:a1:ac  
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
        
vboxnet0  Link encap:Ethernet  HWaddr 00:76:62:6e:65:74  
          BROADCAST MULTICAST  MTU:1500  Metric:1
i'll be glad for any help on this problem.
THX in advance!

Re: host-only networking: vm and native squid HOW?

Posted: 4. Jun 2009, 21:14
by Sasquatch
You have to tell us why you can't use the vboxnetflt option to access the physical NIC directly.

Did you also set the Host-Only settings? You can change it in the global preferences from VB.

Re: host-only networking: vm and native squid HOW?

Posted: 5. Jun 2009, 14:46
by pete.dawgg
thx for your quick answer!
You have to tell us why you can't use the vboxnetflt option to access the physical NIC directly.
when setting up the vm i just passed it the name of the physical interface, and the vm would start, but there was no network access, so i reverted to the "old" method which i knew would work; but i haven't tried to use it since. i'd like to use it, though. do i have to pass the name of the physical dev (ethX, vboxX?...) when setting up the vm? which preparations have to be done on the host before? i don't know how (i'm working on a headless box with VBoxManage all the time). the manual-224 only contains the term vboxnetflt once in the changelog, so i guess i have to look around more.
did you also set the Host-Only settings? You can change it in the global preferences from VB.
i haven't set any host-only settings so far as i'm just in the process of setting everything up, but i'm quite hesitant in setting the host-only-option globally since the vm needs to communicate with a db on another box in the internal network (and later i might add more vms running the same app).

since there will be no connection initiated from the db-box to the vm(s) it should also work with nat-networking on the inside-if - the catch is that for the database-connection i have to use the netbeui-protocol and i don't know if that will work with nat.

thx in advance for all help - i will be on vacation for the next two weeks and i don't think i'll work on this during that time (might check the forums a couple of times, though).

Re: host-only networking: vm and native squid HOW?

Posted: 5. Jun 2009, 16:40
by Sasquatch
pete.dawgg wrote:when setting up the vm i just passed it the name of the physical interface, and the vm would start, but there was no network access, so i reverted to the "old" method which i knew would work; but i haven't tried to use it since. i'd like to use it, though. do i have to pass the name of the physical dev (ethX, vboxX?...) when setting up the vm? which preparations have to be done on the host before? i don't know how (i'm working on a headless box with VBoxManage all the time). the manual-224 only contains the term vboxnetflt once in the changelog, so i guess i have to look around more.
Check the full output of the VBoxManage command. You have to give some additional parameters to it, so it will be attached properly. I posted the command before in a different topic, but you should be able to figure it out with the help output alone.
pete.dawgg wrote:i haven't set any host-only settings so far as i'm just in the process of setting everything up, but i'm quite hesitant in setting the host-only-option globally since the vm needs to communicate with a db on another box in the internal network (and later i might add more vms running the same app).
This is indeed a global setting, so it will work for all VMs. This adapter will allow the VMs and the Host to communicate with each other over the network address your specified. Other machines outside the Host can't access this network. I only know how to set it from the GUI, so you have to check the command line options for how to set it, as you run VB on a headless server.
pete.dawgg wrote:since there will be no connection initiated from the db-box to the vm(s) it should also work with nat-networking on the inside-if - the catch is that for the database-connection i have to use the netbeui-protocol and i don't know if that will work with nat.
NAT only supports TCP and UDP, and a limited ICMP, so you can't use it.

Re: host-only networking: vm and native squid HOW?

Posted: 5. Jun 2009, 17:11
by pete.dawgg
THX for your quick reply!
i did some more reading and will probably find out what i need to know; i had stupidly grabbed an old manual :oops:
now i'm off!nice weekend!