Thursday, December 27, 2012

Renaming network interfaces

Since OpenSolaris Crossbow project it's possible to rename network interfaces. This capability is also know as vanity names. This is of great help in organizing and documenting system configuration.

By default, the physical names will be abstracted to net0, net1, and so on...
The net prefix can be tweaked on svc:/network/datalink-management:default.
See the linkname-policy/phys-prefix SMF property.
See also dlmgmtd(1m).

In most cases it seems advantageous to rename interfaces.
For example, assume a desktop with both a wired and wireless connection.
By default, there will exist both net0 and net1.
But it could be easier to give them more meaningful names.
Assuming the wired interface is net0 it could be renamed to e0 (for ethernet).
By the same token I'd rather rename net1 to w0 (for wireless).
To accomplish this it suffices to:
 
# dladm rename-link net0 e0
# dladm rename-link net1 w0 


But note that you can only do this if the link is not busy.
Otherwise you get error messages such as:

# dladm rename-link net0 e0
dladm: rename operation failed: link busy