Penguin

Notes relating to the Minix Operating System.

Setting up networking in Minix using tuntap.

For some reason you may want to run Minix on some emulation software and get networking support. Here are some ways you can do it:

Bochs

Add this to your bochsrc(5)?:

ne2k: ioaddr=0x240, irq=9, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=/dev/net/tun, script=/path/to/tunconfig

When installing Minix, tell it to install the ne2k networking driver.

You can change the IP address of your Minix install with:

ifconfig -I /dev/ip -h 192.168.1.1

And everything should just work

Qemu

Load qemu like this:

$ qemu -boot c -hda c.img -net nic,model=ne2k_pci -net tap,ifname=tap0,script=/path/to/tunconfig

When installing Minix, tell it to install the ne2k networking driver.

Qemu seems to provide a different address/IRQ for the ne2k, you need to tell Minix to look in the correct place. Edit the file /usr/etc/rc.local and replace

dp8390_arg='DPETH0=240:9'

with

dp8390_arg='DPETH0=c100:10'

You can get the address/IRQ by going to the Qemu console (Ctrl-Alt-2) and typing 'info pci'

Apparently it is possible to get networking going without jumping through all these hoops by using the network card option '4' in the Minix setup program. I haven't managed to get that working.

External internet

After you can ping your tap0 device on your host, you can allow your guest to access the internet:

# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# echo "1" >/proc/sys/net/ipv4/ip_forward

tunconfig

This shell script looks something like:

#!/bin/bash
/sbin/ifconfig ${1##/*/} 192.168.1.1

Setting up IP Addresses manually.

(Mostly from http://www.minixtips.com/2006/06/minix-with-static-ip-address.html)

Unless you have a dhcpd serving addresses out on your tun device, you probably want to do something like this to stop you having to set up the IP address each time you load minix:

Add the following to /etc/rc.net

ifconfig -I /dev/ip0 -n 255.255.255.0 -h 192.168.1.2
add_route -g 192.168.1.1

Add DNS by adding:

your.name.server %nameserver

to /etc/hosts