My CentOS guest has interfaces
- 192.168.100.102 - host-only adapter
- 192.168.0.105 - bridged adapter
If
I run ifconfig on my Mac (which is running the hypervisor) I see it has
the same subnet (192.168.0.0) as the guests bridged adapter. The host
only adapter appears to be represented by a new interface in the
listing called vboxnet0 with an ipaddress of 192.168.100.100. This
means the Mac is directly connected to both subnets and therefore
doesn't need to route.
The guest should be able to route to
internet (if available) via bridged adapter so therefore the default gateway should be the same as the one the Mac uses, i.e when I'm at home
this is the wireless router and when I'm mobile it's my phones hotspot
router. These are on different subnets and my guest interface is hard
coded for a class C 192.168.0.0 network, this is OK for my home but my
phones hotspot has a network address of 192.168.43.0. To work around this I've been changing the eth0 interface IP Address in /etc/sysconfig/network-scripts/ifcfg-eth0. I probably need to add another interface so that I'll have three in total (1 for host only and two bridged, 1 for the mobile subnet (192.168.43.0) and another for home wireless subnet 192.168.0.0). Not sure how to configure the routing table to contain both but I'll work that out. Alternatively I could just configure the home wireless router to be on subnet 192.168.43.0 but that wouldn't be as interesting.
To add a default router manually (not sure how to make this permanent as /etc/defaultgateway doesn't seem to be working) I run.
route add default gw 192.168.0.1 eth0
I
would normally use netstat -r to look at the routing table but it takes
ages to display the last entry (the one I'm interested in) for some
reason. I've found that ip route list is faster.
Setting the DNS Server is just a case if updating /etc/resolve.conf.
Showing posts with label virtualbox. Show all posts
Showing posts with label virtualbox. Show all posts
Monday, 19 January 2015
Sunday, 14 September 2014
Shared folders in VirtualBox
Example using MacOSX host and CentOS guest
Install Guest Additions on the guest...
https://www.virtualbox.org/manual/ch04.html
From the host command line run...
VBoxManage sharedfolder add <VM name> --name <share name> --hostpath <host directory>
For example...
VBoxManage sharedfolder add CentOS6.4 --name myshare --hostpath /Users/clarkeb/automation
Now you have the host mapped to a shared device on the guest. Now you need to mount that device within the guest OS to a point on the file system
mount -t vboxsf <share name> <empty directory>
For example
mount -t vboxsf myshare /home/clarkeb/automation
Monday, 4 August 2014
VBoxManage common commands
VBoxManage list vms
VBoxManage list runningvms
VBoxManage list hdds (gets size of vdi)
VBoxManage showvminfo <vm name>
VBoxManage clonevm <existing vmname> --name <new vm name> --basefolder <path> --register --mode all
VBoxManage modifyvm <vm name> --ostype Linux
VBoxManage modifyvm <vm name> --memory 8192
VBoxManage modifyhd "<path to .vdi file>" --resize 32768
VBoxManage registervm “path to .vbox file”
VBoxManage startvm <vm name> --type headless
VBoxManage guestproperty enumerate <vm name> | grep IP
VBoxManage snapshot list <vm name>
VBoxManage snapshot <vm name> take <new snapshot name>
VBoxManage snapshot <vm name> restore <snapshot name>
VBoxManage controlvm <vm name> poweroff
VBoxManage controlvm <vm name> savestate
Subscribe to:
Posts (Atom)