Я использую Ubuntu в качестве гостя на VirtualBox на моем хост-компьютере с Windows 7 в качестве веб-сервера для моих проектов PHP / Ruby.
Я установил сеть в VirtualBox на «мост», так что теперь я могу получить доступ к моему серверу VirtualBox с помощью чего-то вроде 192.168.2.26 - он генерируется DHCP каждый раз, поэтому он не статичен.
Можно ли сделать его статическим или получить IP-адрес VirtualBox в Windows, чтобы я мог установить «virtualbox» на хостах в Windows и перейти в браузере на адрес «Virtualbox», так как я могу использовать «localhost»?
В гостевой редакции Ubuntu / etc / network / interfaces
вы увидите что-то вроде этого
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
измените его, чтобы он был похож на этот
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
, используя параметры, которые имеют смысл в вашей сети. Перезапустите сеть с помощью
/etc/init.d/networking restart
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.