[CentOS] CentOS7 and "ip link alias"

Sun Nov 8 12:52:19 UTC 2015
Jonathan Billings <billings at negate.org>

On Nov 2, 2015, at 2:40 PM, Mike - st257 <silvertip257 at gmail.com> wrote:
> But when I try to remove it, I'm either trying to do something _actually_
> not supported or I don't have the proper syntax to accomplish what I want.

It doesn’t look like ‘ip link’ has the syntax to remove an alias, but it can be done via sysfs:

# ip link show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
# ip link set dev lo alias loopback
# ip link show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    alias loopback
# echo > /sys/class/net/lo/ifalias
# ip link show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

It also can be set there too:

# echo hicentos > /sys/class/net/lo/ifalias
# ip link show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    alias hicentos

--
Jonathan Billings <billings at negate.org>