18

What is the allowed range of characters in Linux network interfaces names? I've searched around but did not find any definition or clarification. Are uppercase characters allowed? Are uppcase and lowercase letters different?

4

2 Answers 2

19

The iproute2 tools do the following checks for a valid interface name:

  1. The name must not be empty
  2. The name must be less than 16 (IFNAMSIZ) characters
  3. The name must not contain / or any whitespace characters

Using upper-case and lower-case characters are OK and names are case sensitive (e.g. if0 and IF0 are distinct).

If you want more flexibility in names, you can set an alias using ip link DEV set alias .... This will appear in the output of ip link show.

4

Trying some experiments with such names as in ip link set XXX name test\\[]{}.,ä@€ (where XXX is the previous/original name of the network interface), it seems as if Linux will happily accept anything, as long as it is not an embedded \0.

So there don't seem to be any restrictions on what chars can be used, even with UTF-8 encoding you could store Unicode ... but then, not all tools might properly deal with UTF-8 but instead only see the byte soup.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.