Michael Brown April 16 2009 06:20:02 PMTo assign a static IP to a guest OS, you don't need to make any changes in VirtualBox or on your router (if you're using one). You make the changes within the guest OS itself. Here's how to do it for a Fedora guest, although I imagine the steps will be similar for any Linux guest. (This explanation was largely adapted from a post that I found on the Fedora forum. Credit to original poster, wshawn.)
- Click on System->Administration->Network from the main Fedora menu bar. Enter your Root password when prompted.
- On the Networking Configuration dialog (see graphic below) highlight your live networking device, which is "eth0" in my case, and either double-click upon it or click the Edit button.
- On the the Ethernet Device dialog (see graphic below) you need to check the Statically assign IP addresses Radio Button, and then assign addresses as follows:
- Address is the IP address that you want to give to the guest. Obviously, this needs to be within the address range reserved by your router. I've gone for 192.168.1.100.
- Subnet mask should be set to 255.255.255.0.
- Default gateway address is the IP that you use to router's login address. Note: this is not your router's external IP address. It's the address that you use whenever you log in to your router. It will vary between different makes of router. Check your router's manual for this info. For my Billion 7404VGP router, it's 192.168.1.254. NB: this assumes that you are actually using a router with your guest set to Host Interface Networking (versions of VirtualBox prior to 2.2) or Bridged Networking (VirtualBox 2.2 onwards. If you're using Host-only Network, which a new setting in VirtualBox 2.2, without a router than I'm not sure what address you put here. The 127.0.0.1 loopback address is all I can think of at this time. I'll test and report back, however.
- OK out of the Ethernet Device dialog to return to the Networking Configuration dialog. Switch to the DNS tab and enter the DNS addresses for you ISP. You can find this information from your ISP's web site. The DNS addresses for Internode, which is my ISP, are 220.127.116.11 and 18.104.22.168:
- Important final step: click on File->Save from the Networking Configuration dialog's menu bar.
- You now need to restart the guest OS. NB: restarting the guest OS's networking interface, by typing "/etc/init.d network restart" into a terminal window is not enough for these changes to take effect. You must do a full restart.
Once your Fedora guest OS has been restarted, open a terminal window and type "ifconfig" and check that your IP address is now what you set it to above. Check you can ping it via that address from your host OS and your other VirtualBox guest OS's, if any.
- Comments