Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I use Ubuntu on VB on my Windows7 machine as web server for my PHP/Ruby progects. I set networking in VB setting to 'bridge' so now I can access my VB server by something like 192.168.2.26 - it is generated by DHCP every time so it is not static. Is it possible to make it static or get VirtualBox IP in Windows so I could set 'virtualbox' in hosts in Windows and go in browser to 'virtualbox' adress as I can go 'localhost'?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

On your Ubuntu guest edit /etc/network/interfaces you'll see something like this

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp

change it to be similar to this

iface eth0 inet static
address 192.168.2.26
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.254

using parameters that make sense in your network. Restart networking with

/etc/init.d/networking restart
share|improve this answer
add comment

On ubuntu guest set the static ip-address by editing the file /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.2.26
netmask 255.255.255.0
gateway windows-machine-ip-adress

And also, place the ip-address of windows machine in resolv.conf.

resolv.conf file typically contains directives with the IP addresses of nameservers available to a host.

#vim /etc/resolv.conf

nameserver windows-machine-ip-address

And restart the network service.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.