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=1 ttl=64 time=0.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ć <free...@igalic.co>, 19 Kas 2023 Paz, 17:36 tarihinde şunu yazdı:
>
>
> Hi Özkan,
>
> > 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

Reply via email to