Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Nov 2023 19:41:08 +0300
From:      =?UTF-8?B?w5Z6a2FuIEtJUklL?= <ozkan.kirik@gmail.com>
To:        =?UTF-8?Q?Mina_Gali=C4=87?= <freebsd@igalic.co>
Cc:        Kyle Evans <kevans@freebsd.org>, freebsd-net@freebsd.org
Subject:   Re: How to tell if a network interface was renamed (and from what)
Message-ID:  <CAAcX-AFmebkVC%2BWW0-ezOzprYKaLq7AU6rW3AeVTSYvwqa4j5A@mail.gmail.com>
In-Reply-To: <asAEf4UOWS2O_bDk-Qa2UtgfyUadMkPAqMfWZdCwSEwsRDpjoVY6byT0n--oFhHY0mPZ6oRT1bTjo6od43CPNblyzRVFvh3nGcZuwijPfdc=@igalic.co>
References:  <pdHC0ObBkAbx2HfFIhWYaB5-dmQDEUzNTWvVVJAuJV7FWdWWeSwybVFD-uyBUxPlqDRpAW7D1aAZsbrTxEj9kqsq7ESgO41srPmS-PcXGqw=@igalic.co> <E5F5F61E-3827-404A-A46F-BBCF45A29A82@FreeBSD.org> <9eef5488-e8da-4edd-bc00-baeb5aaf4a23@FreeBSD.org> <CAAcX-AE4rFhO4RGVVFSZJcgQK=qCg-Aucx5QO-wbX1%2B3Ag38Nw@mail.gmail.com> <asAEf4UOWS2O_bDk-Qa2UtgfyUadMkPAqMfWZdCwSEwsRDpjoVY6byT0n--oFhHY0mPZ6oRT1bTjo6od43CPNblyzRVFvh3nGcZuwijPfdc=@igalic.co>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Mina,

Let's explain with a small example:
In this scenario, we are going to add two alternate names for the "lo"
interface. And then we can access to the interface using all of the
names: lo, test1, test2

# ip link show lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

# ip link property add dev lo altname test1
# ip link property add dev lo altname test2

# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    altname test1
    altname test2
2: enp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel
state DOWN mode DEFAULT group default qlen 1000
    link/ether b0:7b:25:31:6c:92 brd ff:ff:ff:ff:ff:ff

# ip link show lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    altname test1
    altname test2

# ip link show test1
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    altname test1
    altname test2

# ip link show test2
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    altname test1
    altname test2

#  ping -I test2 127.0.0.1
ping: Warning: source address might be selected on device other than: test2
PING 127.0.0.1 (127.0.0.1) from 127.0.0.1 test2: 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=3D1 ttl=3D64 time=3D0.023 ms

By the altname feature, the interface name doesn't change, but you can
assign many altnames. So you can access them using these altnames.

Mina Gali=C4=87 <freebsd@igalic.co>, 19 Kas 2023 Paz, 17:36 tarihinde =C5=
=9Funu yazd=C4=B1:
>
>
> Hi =C3=96zkan,
>
> > It would be better if FreeBSD could have "interface altname feature"
> > like Linux has.
>
> even tho I'm writing this email from a Linux laptop, and often
> have to understand Linux specific code to see how I can (or if I
> need to) replicate that on FreeBSD, I'm not familiar enough
> with Linux.
>
> Can you describe the altname feature, and how it works?
>
> Kind regards,
>
> Mina



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAAcX-AFmebkVC%2BWW0-ezOzprYKaLq7AU6rW3AeVTSYvwqa4j5A>