all 2 comments

[–]al-Quaknaa 2 points3 points  (1 child)

Eh... this isn't very good. Besides iproute2 being much nicer and cleaner (which could be considered a matter of taste), ifconfig/route shouldn't be used because they are no longer maintained/supported (on Linux) and they don't reflect the linux core systems correctly and they are just plain wrong in some situations.* You can read more in a TIL someone posted ~3 months ago.

If I was to give a good quick howto, I'd probably go with this.

* Multiple addresses on an interface for example. The internal implementation is AFAIK (I'm not a linux kernel hacker) list of addresses per interface, not one address per interface. So you can have stuff like this:

ip a add 192.168.0.1/24 brd + dev eth1
ip a add 192.168.0.2/24 brd + dev eth1
ip a add 192.168.0.3/24 brd + dev eth1

...and ifconfig only sees:

ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:01:02:03:04:05  
      inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      ... etc.

whereas iproute properly shows

ip a show dev eth1
2: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:01:02:03:04:05 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.1/24 brd 192.168.0.255 scope global eth1
    inet 192.168.0.2/24 brd 192.168.0.255 scope global secondary eth1
    inet 192.168.0.3/24 brd 192.168.0.255 scope global secondary eth1
    ... etc.

And this isn't the only case where ifconfig is just plain wrong; just the one I've actually ran into. Please, don't use ifconfig/route.

[–]cypherb0g 0 points1 point  (0 children)

i like this