QEMU NETWORK ACCESS TO A GUEST MACHINE THROUGH REDIRECTED HOST PORTS
TCP port 5555 on the host is redirected to the guest's port 80 (the web server) and TCP port 5556 on the host is redirected to the guest's port 445 (Windows networking):
qemu -m 256 -hda winxp.img -kernel-kqemu -redir tcp:5555::80 -redir tcp:5556::445 &
qemu-system-x86_64.exe -L . -m 1024M -hda centos55.img -redir tcp:1234::22 tcp:6789::80
for just accessing the internet (which is usually enabled by default)
-net nic -net user
-default vlan nat (allows 1 guest browsing) -tap configuration (host-guest ping) -more than one host
the "new" options we'll use are the following:
qemu -net nic -net user //allows a virtual lan for basic NAT browsing
-localtime //allows virtual machine to use host clock -full-screen //opens virtual machine in full screen, ctl-alt-f does the same
ctl-alt-2 //puts in the "monitor mode" where we control or virtual machines help //lists all of the commands we could use in monitor mode system_reset //turns power off and on for our virtual machines quit //quits the qemu virtual manager (ergo pulls plug on all virtual machines)
NOTE, Damn Small Linux is based on knoppix (good hardware detection) and it's small (50 MB)
qemu -kernel-kqemu -L . -cdrom dsl-4.4.6.iso -hda hd.img -boot d -m 512 -usb -localtime -net nic -net user
inside dsl it's another esoteric string of commands to get it to boot properly: (learned by pressing f2 and f3 and a little net research, yes I updated their wiki)
even with these options you still have to remember your screen size (800x600 w/ 24bit)
inside of terminal (bash shell) "ifconfig"
shows that it boots by default with "ifconfig inet dhcp"
10.0.2.15 (host Network)
QEMU VLAN <------> Firewall/DHCP server <-----> Internet
----> DNS server (10.0.2.3)
----> SMB server (10.0.2.4)
"startx" is the command to start the gui windows... if you mess something up in the configuration xsetup.sh
somehow if you start DSL in text mode (2) and you can't really get it to work, you'll just have to restart the system...
If NE2000 can't be detected on a Linux virtual machine, please try these.
$ modprobe ne2k-pci $ dhclient eth0 (or $ dhcpcd eth0)
to give the virtual machine the ability to interact with the host machine install the openvpn virtual win32 ethernet adapter http://openvpn.net/
After installation note the name of the virtual win32 ethernet adapter (most likely Local Area Connection 4)
assign your virtual adapter a static ip address, but don't use the same network address as your real physical network adapter!
e.g. if your NIC is 192.168.0.x, use different IP address 192.168.200.y for TAP-Win32 Adapter.
192.168.200.10 255.255.255.0 192.168.200.1
now start qemu with the following parameters
qemu -kernel-kqemu -L . -cdrom dsl-4.4.6.iso -boot d -m 512 -usb -localtime -net nic -net tap,ifname="Local Area Connection 4"
Time to see if you remember your basic linux networking commands
ifconfig inet static ifconfig eth0 address 192.168.200.11 netmask 255.255.255.0 ifconfig eth0 network 192.168.200.0 broadcast 192.168.200.255 gateway 192.168.200.10
Now you can test your connection to the host from inside of your virtual machine
you should see your win32 adapter light up in your host system tray as packets echo back and forth
from a cmd prompt in your host you can ping 192.168.200.11 and voila, yes, your host can communicate with your virtual machine (you should get low latency as well ;)
-net option is used to set data input/output terminal. For NE2000, it is -net nic. If you want to use more than two NE2000 or more than two guest OSes, it is necessary to set macaddr for each -net nic option like -net nic,macaddr=52:54:00:12:34:56. The value of macaddr should be different for each NE2000.
sudo /etc/init.d/networking restart
$ sudo vi /etc/resolv.conf
You need to remove old DNS server assigned by DHCP server: search myisp.com nameserver 192.168.1.254 nameserver 220.127.116.11 nameserver 18.104.22.168
test the dns $ host cyberciti.biz