Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ifalias of a network device

735 views
Skip to first unread message

johns...@gmail.com

unread,
May 8, 2013, 4:45:27 AM5/8/13
to
Hello,

I tried:
ip link set em1 alias myalias
and
cat /sys/class/net/em1/ifalias
gives:
myalias

I also tried:
ifconfig p2p1:0 1.2.3.4
but:
cat /sys/class/net/p2p1/ifalias
gives nothing.

what is the difference between the two ?
is there a way that I will set an alias with
ifconfig so I will see it in /sys/class/net/em1/ifalias?

rgs,
Andy



Richard Kettlewell

unread,
May 8, 2013, 4:58:15 AM5/8/13
to
johns...@gmail.com writes:
> I tried:
> ip link set em1 alias myalias
> and
> cat /sys/class/net/em1/ifalias
> gives:
> myalias

This sets the IFLA_IFALIAS property of em1.

> I also tried:
> ifconfig p2p1:0 1.2.3.4
> but:
> cat /sys/class/net/p2p1/ifalias
> gives nothing.

This adds an additional IP address to p2p1, using an emulation of an
obsolete ‘alias interface’ feature.

> what is the difference between the two ?

Completely different meaning of “alias”.

> is there a way that I will set an alias with
> ifconfig so I will see it in /sys/class/net/em1/ifalias?

I don’t believe so.

--
http://www.greenend.org.uk/rjk/

Pascal Hambourg

unread,
May 8, 2013, 5:31:05 AM5/8/13
to
Hello,

johns...@gmail.com a ᅵcrit :
>
> I tried:
> ip link set em1 alias myalias
> and
> cat /sys/class/net/em1/ifalias
> gives:
> myalias
>
> I also tried:
> ifconfig p2p1:0 1.2.3.4
> but:
> cat /sys/class/net/p2p1/ifalias
> gives nothing.
>
> what is the difference between the two ?

/sys/class/net/p2p1/ifalias contains an arbitrary text attribute
associated to the network interface p2p1. AFAIK, it cannot be used as an
interface name by commands such as ifconfig or ip.

p2p1:0 is a label associated to a specific IPv4 address assigned to
p2p1, sometimes referred to as "IP alias". Note "IP", not "interface".
"ip addr" shows it in the line containing that IPv4 address. Labels are
a legacy from old times and are not supported for IPv6 address. It can
be used as an interface name by ifconfig to refer to the associated IPv4
address or by ip but then it refers to the whole interface, not just the
associated address (ip seems to strip the :* part).

> is there a way that I will set an alias with
> ifconfig so I will see it in /sys/class/net/em1/ifalias?

I don't think so. These are two completely different unrelated things.

wkevin

unread,
May 13, 2013, 11:08:02 PM5/13/13
to
Hi,
so we have:
ip link set em1 alias myalias
this causes
cat /sys/class/net/em1/ifalias
to return
myalias

No I looked in the code in the kernel;
ifalias is a field in the net_device structure.
The documentation of this field in include/linux/netdevice.h (where it is declared) says:
/* snmp alias */

I just wonder: is there some SNMP based utility or other utility
where you can see this alias ? what does SNMP has to to with it ?
How SNMP is related here ?

regards,
Kevin


On Wednesday, May 8, 2013 11:45:27 AM UTC+3, johns...@gmail.com wrote:
> Hello,
>
>
>
> I tried:
>
> ip link set em1 alias myalias
>
> and
Hi,
0 new messages