NetBSD Qemu

Thursday, March 13th, 2008

I tested NetBSD 4.0 under Qemu and all seems to work fine.
First of all create a slice partition of 3GB.

dd if=/dev/zero of=scratch.img bs=3072 count=1000000

and then boot NetBSD using the iso :

qemu scratch.img -cdrom /home/giany/Desktop/i386cd-4.0.iso -boot d

After booting follow these steps:

Follow the instruction screens when the NetBSD installer appears. If a particular step or
choice is not mentioned here then you sould use the default choices.

- choose a custom installation

- select only one of either the GENERIC or GENERIC.MP kernels, depending on the server

- select all sets except Games and x11

- choose to use the entire disk for the NetBSD installation

- Choose to set the sizes of the NetBSD partitions

Partition sizes should be as follows:

Mountpoint Size
/ 2G
swap 2G
/tmp 512G
/var 20G
/usr 20G
/home rest

- choose to use serial port com0 for the bootblock selection

- choose US/Pacific-New as the timezone

- choose MD5 for password encryption

- set the root password

Configure hostname, IP address, default gateway as needed

After the install process close the Qemu window and run qemu using the image that slice.

qemu -m 256 -hda scratch.img -localtime -net nic,vlan=0,macaddr=00:aa:00:00:01:02,model=i82559er -net tap,vlan=0,script=no

and from the linux box:

ifconfig tap1 2.2.2.1 netmask 255.255.255.0 up

Configure the nameserver in /etc/resolv.conf set in /etc/ifconfig.fxp0 the ip address smth like :

inet 2.2.2.2 netmask 255.255.255.0 media autoselect
inet 3.3.3.3 netmask 255.255.255.0 alias // for multiple interfaces
inet 4.4.4.4 netmask 255.255.255.0 alias

My rc.conf file looks like:

hostname="kwala.x83.net"
domainname="x83.net"
auto_ifconfig=YES
defaultroute="2.2.2.1"
wscons=YES
sshd=YES

To add extra packages check this link ftp://ftp.netbsd.org/pub/NetBSD/packages/4.0/i386/All/ and choose what packages you want. I installed bash/net-snmp/perl/tcsh/mtr.
Now you should see the internet from the NetBSD box.