UDE

uderouter
Login

uderouter

Purpose: joining switches into separate IPv4 networks, as a router joins Ethernet segments.

Every option is in uderouter(8). For whole networks built with it, see Several networks; for what happens to each packet, see Routing and NAT.

A router on two switches

Each switch is a broadcast domain of its own. uderouter joins each one given with -i as a host with an address there, and forwards IPv4 between them:

udeswitch -p 7500 &
udeswitch -p 7600 &
uderouter -i 127.0.0.1:7500,10.0.1.1/24 -i 127.0.0.1:7600,10.0.2.1/24 &
udeping -s 127.0.0.1:7600 -a 10.0.2.5/24 -g 10.0.2.1 -r &
udeping -s 127.0.0.1:7500 -a 10.0.1.5/24 -g 10.0.1.1 -c 3 10.0.2.5
uderouter: if0 10.0.1.1/24 on 02:55:0a:00:01:01 (127.0.0.1:7500)
uderouter: if1 10.0.2.1/24 on 02:55:0a:00:02:01 (127.0.0.1:7600)
64 bytes from 10.0.2.5: icmp_seq=1 ttl=63 time=1.777 ms

The TTL of 63 is the router at work. It needs no privileges and does not touch the host's network: hosts are whatever joins the switches, emulated machines, UDE tools, or the host itself through udetap.

Interfaces

-i SWITCH,ADDR/LEN[,MAC] takes any switch URL libude accepts (127.0.0.1:7500, udp://..., vde:///tmp/sw, so a router can join a classic VDE switch too), the interface's address and prefix length, and optionally its MAC address. Up to 16 interfaces; their subnets may not overlap.

Without a MAC, the interface gets 02:55: followed by its address in hexadecimal: 10.0.1.1 is 02:55:0a:00:01:01. Such an address is locally administered, the same every time the router starts, so hosts' ARP caches stay right across a restart, and easy to spot in udedump output.

Routes

The subnet of each interface is a connected route. -r NET/LEN:GATEWAY adds a static one, through a gateway that must be a neighbour on one of those subnets; -r default:GATEWAY is 0.0.0.0/0. Up to 48 routes, and the longest matching prefix wins:

uderouter -i 127.0.0.1:7500,10.0.1.1/24 -i 127.0.0.1:7600,10.0.2.1/24 \
    -r 10.0.3.0/24:10.0.2.254 -r default:10.0.2.2
uderouter: route 10.0.3.0/24 via 10.0.2.254 (if1)
uderouter: route 0.0.0.0/0 via 10.0.2.2 (if1)

There is no routing protocol: chained routers each need routes to the networks behind the others.

What it does to packets

--no-icmp-errors drops undeliverable packets silently, like a firewalled router. -v logs every drop and ICMP error:

uderouter: if0: TTL exceeded: 10.0.1.5 -> 10.0.2.5
uderouter: if1: 10.0.2.77 does not answer ARP: host unreachable for 10.0.2.77

Ctrl+C (or SIGTERM) prints the statistics and exits; -q silences both the startup lines and the statistics.

With udeslirp and udetap

Both are worked through in Several networks.

Configuration file keys

Each long option is also a key of the [uderouter] table, with _ for -. interface and route are arrays; connection, from [global] or the table, is ignored, because each interface names its switch.

[uderouter]
interface = ["127.0.0.1:7500,10.0.1.1/24", "127.0.0.1:7600,10.0.2.1/24"]
route = ["default:10.0.2.2"]
icmp_errors = true
uderouter -C lab.toml -v

The complete list is in ude.conf(5).

udeswitch :7500 uderouter udeswitch :7600 hosts 10.0.1.0/24 hosts 10.0.2.0/24 10.0.1.1 10.0.2.1
A: box "udeswitch" ":7500" fit
R: box "uderouter" fit at A + (2.2, 0)
B: box "udeswitch" ":7600" fit at R + (2.2, 0)
HA: box "hosts" "10.0.1.0/24" fit at A + (0, -1.0)
HB: box "hosts" "10.0.2.0/24" fit at B + (0, -1.0)
line from A.e to R.w "10.0.1.1" above
line from R.e to B.w "10.0.2.1" above
line from HA.n to A.s
line from HB.n to B.s