Thursday, June 10, 2010

VirtualBox: Networking between Linux Host and Windows XP Guest

In this article we will learn how to configure networking between Linux host OS and Windows Guest (VM) using Virtualbox

1. First of all download and install Virtualbox on your Linux host and install the guest operating system

2. Now configure network on Guest OS, open VM settings and click Network

3. Select Host-Only Adapter from "Attached to" combo



The VM will create the default network interface named by "vboxnet0" on the host OS,

#ifconfig
vboxnet0  Link encap:Ethernet  HWaddr 0A:00:27:00:00:00 
          inet addr:192.168.56.1  Bcast:192.168.56.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3599 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:3896747 (3.7 MiB)

VirtualBox automatically assigned IP address 192.168.56.1 on the host to that network interface.

4. Launch the XP guest OS from virtualbox and configured the network upon VM successfully boot

 5. Make sure both Host and guest can responding to each other 'ping'
ping 192.168.56.10
PING 192.168.56.10 (192.168.56.10) 56(84) bytes of data.
64 bytes from 192.168.56.10: icmp_seq=1 ttl=128 time=1.83 ms
64 bytes from 192.168.56.10: icmp_seq=2 ttl=128 time=0.512 ms

Enabling Internet for VM.

Above steps was fine as far as networking between Host and VM is concerned, however if you want to let VM also access the Internet then you have to configure the following iptables rules and enable ipfowarding on Host OS.

# insert NAT rule
iptables -t nat -A POSTROUTING -o vboxnet0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# enable forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

19 comments:

  1. Thanks for the posting. I like your info really help to me...
    Windows Network Setup

    ReplyDelete
  2. You guys out there are performing a great job.
    TopFiveAwards.com

    ReplyDelete
  3. Thanks guys, for sharing this conductive accumulation.
    hostinghq

    ReplyDelete
  4. I would simply say to you all “awesome information”
    Hoster Talk

    ReplyDelete
  5. Thanks for sharing this information.

    ReplyDelete
  6. one more thing you send that box. its not proper visible

    ReplyDelete
  7. Interesting post. Ill be sticking around to hear more from you guys. Thanks! Carpet Cleaning adelaide

    ReplyDelete
  8. Thanks for another essential posting. Where else could everyone get that kind of information in their normal complete way of crafting? I have a demonstration incoming week, and I am searching for such information.
    dulux painting sydney

    ReplyDelete
  9. Thanks for sharing this great Post dude
    Web Design Company Bangalore

    ReplyDelete
  10. Nice Post!!! Web hosting is, at its most basic, simply the storage of files for one or more Internet websites as well as the service of maintaining those files, serving the needs of the people who own the website being hosted and maintaining the immense computer servers that store the billions of bits of data that every website creates. If any person is interest to have Cheapest Web Hosting he/ she must find out the trusted online shop.

    ReplyDelete
  11. Thank you very much for keep this information.
    web hosting reviews

    ReplyDelete
  12. Very informative and useful post you shared!!
    Hosting Service

    ReplyDelete
  13. I perceive to inspect this blog. Each and every day your blog having some superb subject.
    Zenyataa shoes

    ReplyDelete
  14. I truly like your blog.. extremely decent tones and topic. Did you make this site yourself or did you enlist somebody to do it for you? Plz answer back as I'm hoping to make my own blog and might want to know where u got this from. good wishes
    analog sports watches
    analog sports watches

    ReplyDelete
  15. It was enlightening and content was helpful to broaden my horizon of information on the topic.
    digital teaching device
    smart classroom solutions

    ReplyDelete