Site Home Page
The UML Wiki
UML Community Site

Simple UML Networking

The easiest way to get started with UML networking involves nothing special besides adding a switch to the UML command line.
The uml_net helper
First, you need to make sure that the uml_utilities are installed on the host. You'll be needing the uml_net helper from that package.
Configuring an eth0 device
You can either In both cases, the actual device specification is the same.

Choose an IP address for the host end of the TUN/TAP device (192.168.0.254 in the examples above) that is usable on your network. It will be used on the host as the address of the TUN/TAP interface. If you use a 168.192.x.x or 10.x.x.x address, you may need to set up NAT on the host in order to communicate with the outside Internet.

Enable the device within UML
Choose an IP address for the UML eth0 - the main constraint being that it must be different from the IP address you specified in the eth0=... description above.

Enabling the device is exactly the same as any other Linux machine, except you'll likely do by hand at first for UML:

UML# ifconfig eth0 192.168.0.253 up
* modprobe tun
* ifconfig tap0 192.168.0.252 netmask 255.255.255.255 up
* bash -c echo 1 > /proc/sys/net/ipv4/ip_forward
* route add -host 192.168.0.253 dev tap0
* bash -c echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp
* arp -Ds 192.168.0.253 eth0 pub

If you don't see the output above in your terminal, run dmesg, and you will see it. If there were any problems setting up the host, then error messages will also appear here.

At this point, you should be able to communicate with the host and the local network. To talk to the outside network, set a default route to the host end of the TUN/TAP device

UML# route add default gw 192.168.0.254
Automating network configuration
If you are running a distribution that detects and configures new hardware after boot, then edit the network-scripts/ifcfg-eth0 script, which looks like this on an FC5 filesystem with the IP addresses I've used above:
UML# cat/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.0.253
GATEWAY=192.168.0.254
NETMASK=255.255.255.0
Hosted at SourceForge Logo