LEdoian's Blog

Mind the differences in /etc/services and /etc/protocols

Today I learned, the hard way, that between Arch Linux (or Larch in my case) and OpenWRT the contents of /etc/protocols and /etc/services differ.

That means that if you want to write a set of firewall rules for both, you either need to use different names on the respective platform, force them to be the same [1] or just use numeric protocol numbers and not names.

Apparently, each distro builds the package containing the files by itself. In OpenWRT (or TurrisOS as of current kittens), the file is in base-files package, Debian has netbase (which seems specific for Debian, since it has no dash in the version string), Arch has it in iana-etc (which is built from a xml from sources.archlinux.org with ad hoc awk scripts).

Mind the mess.


[1]Also, if you are tweaking the files, you might want to modernise them to sane names. For example, just call it dns instead of domain, definitely don't call DoT domain-s and if you have paleocene devices, rename bootps to dhcps (or similar). (I needed to make the same-sane pun.)