UDE

UDE recipes
Login

UDE recipes

Purpose: short recipes; each topic will grow into its own page.

Template. The recipes below were moved here from docs/examples.md. The topic pages are outlines still to be written: QEMU, 86Box, host access with TAP, links over ssh. Written: Internet access for guests; network booting is written and tested. For everything else, start at the documentation home.

Two QEMU VMs on one udeswitch (expected to work; not yet tested)

QEMU's datagram backends send one raw Ethernet frame per UDP datagram, which is exactly UDE's DATA format. Give each VM its own local port:

udeswitch -v &
# QEMU >= 7.2
L=local.type=inet,local.host=127.0.0.1,local.port=7601
R=remote.type=inet,remote.host=127.0.0.1,remote.port=7500
qemu-system-x86_64 ... -netdev dgram,id=n0,$L,$R \
  -device e1000,netdev=n0,mac=52:54:00:00:00:01
# older QEMU
qemu-system-x86_64 ... -netdev socket,id=n0,udp=127.0.0.1:7500,localaddr=127.0.0.1:7602 \
  -device e1000,netdev=n0,mac=52:54:00:00:00:02

QEMU doesn't send keepalives, so an idle VM's port expires after -T seconds. It comes back as soon as the VM sends anything (ARP, DHCP, ...). If your guests are very quiet, raise -T or use -T 0.

Network boot a QEMU VM (tested)

udeswitch -T 0 &
udedhcpd -a 10.0.0.1/24 -B 10.0.0.2 -b pxelinux.0 &
udetftpd -a 10.0.0.2/24 -r netboot-root &
qemu-system-x86_64 -m 1024 -boot n ... -netdev dgram,id=n0,$L,$R -device e1000,netdev=n0

The whole example, with Debian's installer, is in Network booting.

Host access via TAP (Linux)

sudo ip tuntap add dev ude0 mode tap user $USER
udetap -i ude0 &
sudo ip addr add 10.0.0.1/24 dev ude0; sudo ip link set ude0 up

Join a classic VDE switch with UDE tools

vde_switch -s /tmp/sw -d
udeping -L -s vde:///tmp/sw -r -m 02:00:00:00:00:02 &
udeping -L -s vde:///tmp/sw -m 02:00:00:00:00:01 -c 3 02:00:00:00:00:02

Watch traffic

udeswitch -vv              # per-frame decisions
udedump                    # one line for every frame the switch sees (a monitor port)
kill -USR1 $(pidof udeswitch)   # dump port list + MAC table