1

I have created a virtual machine with 2 network adapters, one connected to the host using NAT and the second connected through a host-only adapter.

This set-up works for what I want to do,

  • Give the guest OS access to the internet (NAT interface eth0)
  • Expose a web interface, hosted on the guest, to the host OS. (Host-only adapter eth1)

The problem is that the guest interface which is connected to the internet (eth0), has been assigned the same IP address, through DHCP, as the host OS.

ifconfig for host and guest OS

Does anybody know how to configure virtualbox or the guest os so it gets a unique IP address?

Thanks!

My /etc/config/network file in the guest OS:

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config interface 'lan'
        option ifname 'eth0'
        option ipaddr '10.0.2.20'
        option netmask '255.255.255.0'
        option proto 'dhcp'

config interface 'lan2'
        option ifname 'eth1'
        option proto 'static'
        option ipaddr '10.88.12.1'
        option netmask '255.0.0.0'


config interface 'wan6'
        option ifname '@wan'
        option proto 'dhcpv6'

config globals 'globals'
        option ula_prefix 'fd62:86eb:0d01::/48'

If I set proto to static for the lan interface, the IP address is set to 10.0.2.20 but I can not connect to the internet.

2
  • You can set a static ip for the guest. What os does it run?
    – Jake
    Dec 12, 2013 at 11:01
  • Hey, I have updated my question with more details if that helps.
    – TomSelleck
    Dec 12, 2013 at 11:39

1 Answer 1

1

From the VirtualBox GUI, File -> Preferences -> Network -> NAT Networks -> Screwdriver -> Network CIDR. You can change the IP range of your NAT network here, choosing something that does not conflict with your host's LAN. Even 10.0.3.0 will do.

Here is a picture of what it should look like:

enter image description here

7
  • Thanks for the reply, in my VirtualBox Network page, there is no NAT Networks option, only Host-only Networks.
    – TomSelleck
    Dec 12, 2013 at 11:51
  • Did you follow the list of arrows I wrote? Which version of VirtualBox are you running? Dec 12, 2013 at 11:54
  • 4.2.18, looks like it was only introduced in 4.3. I will update it now and give it a try.
    – TomSelleck
    Dec 12, 2013 at 11:56
  • @Tomcelic Please look again at my answer. Dec 12, 2013 at 11:57
  • I have followed your steps and my guest OS uses the NAT Network. The NAT Network isn't connected to the internet though
    – TomSelleck
    Dec 12, 2013 at 12:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .