ifalias of a network device

Discussion in 'Linux Networking' started by johnsonzjo, May 8, 2013.

  1. johnsonzjo

    johnsonzjo Guest

    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
     
    johnsonzjo, May 8, 2013
    #1
    1. Advertisements

  2. This sets the IFLA_IFALIAS property of em1.
    This adds an additional IP address to p2p1, using an emulation of an
    obsolete ‘alias interface’ feature.
    Completely different meaning of “aliasâ€.
    I don’t believe so.
     
    Richard Kettlewell, May 8, 2013
    #2
    1. Advertisements

  3. Hello,

    a écrit :
    /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).
    I don't think so. These are two completely different unrelated things.
     
    Pascal Hambourg, May 8, 2013
    #3
  4. johnsonzjo

    wkevin Guest

    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
     
    wkevin, May 14, 2013
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.