My personal flavour is Debian (www.debian.org). If you know which programs you need, just install the required and important packages and then select whatever else you need. Gnome or KDE will be too much for those systems, but the X Window System itself should work, perhaps with fvwm or another small window manager. Blackbox is supposed to be small, too. XFce is a bit like KDE but smaller. Debian install doc lists 12Mb as minimum requirement (without X, I presume) and you definitely will need swap space when running X. For router purposes there are distributions that are only for routers, and these are the best choice if you don't need the machine to run anything else.
... View more