Setup a Host Only Network in Oracle Virtual Box:
Assumptions:
- User knows how to setup network interfaces for DHCP in linux
- User knows how to add services to a default run level
- User knows how to set up a ssh server
Add a Host-only Network
File --> Preferences --> Network
Click on add icon
New interface is vboxnet0
Machine --> Settings --> Network --> Adapter 2
- Attached To: Host Only Network
- Name: vboxnet0
File --> Preferences --> Network screwdriver icon
Note the ip address and the Lower Bound of the DHCP range.
Setup Networking on Guest and Host OS'es
Start your guest OS Set up eth1 on your guest account to use DHCP. The host only adapter has a built in DHCP server. If you need to force an ip address to get the adapter set up for a single session only try:
ifconfig eth1 <lowerbound ip from above>On the host system set up vboxnet0 as DHCP or with the static ip address in the IPv4 box in the picture above like you would any network adapter. I have had no luck getting it to run before Oracle virtual machine is started (e.g. at the default run level) After configuring the adapter to run as a service on the host system, the adapter can be started after on guest OS is running by typing as root:
/etc/init.d/net.vboxnet0 start
<optional>
Create a script to start the vboxnet0 adapter on the fly:# echo "/etc/init.d/net.vboxnet0 start" >> /home/<user>/start-vnet.sh
# chmod 770 /usr/sbin/start-vnet.sh
# chgrp vboxguest /usr/sbin/start-vnet.sh
Edit the start-net.sh script and insert:
#!/bin/bashAt the top of the file.
Once the vboxnet0 adapter is started you should be able to ssh into your guest OS:
sudo ssh <username on guest OS>@<ip address from ifconfig eth1 on guest OS>
Happy Computing!!!
No comments:
Post a Comment