|
|
|
|
|
by gnosek
2287 days ago
|
|
ifconfig enp2s0:1 192.168.1.42
Now try ip addr add dev enp2s0 192.168.42.1/24
and observe how ifconfig ignores the second IP on the same interface. enp2s0:1 is an alias to enp2s0, not enp2s0 itself. To replicate your ifconfig command, you'd use ip addr add dev enp2s0 192.168.1.42/32 label enp2s0:1
and then it shows up in ifconfig as well. |
|
Meanwhile having an explicit label can be nice in other situations if you want to replace an address instead of merely adding a new one.
I also seem to recall running into issues dealing with IPv6 with ifconfig that I worked around by switching to ip. I don't remember the specifics however.
Overall I wish ifconfig had been updated, I still find it a lot more user friendly that iproute. In particular the default output of a plain "ifconfig" is vastly more readable IMO: https://svkt.org/~simias/up/20200319-165513_ip.png
In general these days I use ip in scripts and ifconfig (when available) interactively. I don't love having to remember two ways of doing the same thing but I can't rely on ifconfig being available in scripts anymore and I just waste too much time parsing ip's bad output when I'm messing with networking interactively.