[Novalug] Aaarrrghghgh! : ifconfig (was networking...)

Peter Larsen peter@peterlarsen.org
Thu Nov 24 11:50:09 EST 2016


Beartooth,
I think we need to take one step backwards here - there's a bit of a
communication block more than anything else here. If you're familiar
with ifconfig, then "ip" isn't going to be brand new or complex. It's
just a different command which comes equipted with a lot more features
than ifconfig does.  It's part of the "iproute" (iproute2) package and
is part of the core packages on RHEL6/7. To get a full description of
all it's glory details, you simply need to "man ip" and once you are
done running screaming around because there's too much stuff there,
focus on the "ip addr" sub command which is most likely the only
features you're currently seeing with ifconfig.  Note that "route",
"netstat" and similar tools are all deprecated (obsolete). Any check of
the man pages of any of the "old" commands will tell you that. Even more
so, they've been deprecated for almost 10 years now ..  yeah, it's a
very slow change since it replaces core utilities in Linux. And note,
nobody has removed the old versions - so let's not get that discussion
started (again).

Btw. there's a good page here on iproute2: http://baturin.org/docs/iproute2

"ip addr" comes with several main features:
    ip addr add
    ip addr delete
    ip addr flush
    ip addr show

Most common people will use "show" which is also the default if you
don't specify a command. So on the system I mentioned yesterday, this is
what I see:
$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
    link/ether 52:54:00:28:e5:59 brd ff:ff:ff:ff:ff:ff
    inet 192.168.11.16/24 brd 192.168.11.255 scope global eth0
    inet6 fe80::5054:ff:fe28:e559/64 scope link
       valid_lft forever preferred_lft forever

As you can see, it's pretty much the same information, but easier read
by a machine. There's also some filtering possible like:

ip addr show up

Shows only interfaces that are active/up.  Even more fun, try:

ip addr show static

And you only see the configurations (per interface) that is statically
defined - ie. no dhcp addresses.  On the other hand:

ip addr show dynamic

shows you all the "dhcp" or dynamicly assigned addresses - like your ppp.

One of the biggest differences is that iproute2 doesn't use the "dot"
subnet notation, but instead uses the slash /## notation. That part can
take a bit getting used to, but it's easily translated. The number is
the number of leftmost bits in the mask, so 255.255.255.0 = /24 since
each 255 (decimal) is 8 bits all set.

Since you can still use ifconfig try running first ifconfig then ip addr
and compare results. You should see the same interfaces, the same data -
just formatted differently. And before you mention the stats, they're
under "link": ip -s link show" will give you all the link stats you want.

So to manually add an interface or address to an interface, you use the
"ip addr add" notation:

ip addr add <ip>/<mask> dev <int>

That's all for all the defaults, like the ones you posted using ifconfig
earlier.

This doesn't change anything else we've talked about. nmcli
(NetworkManager) is still the way to go for network configuration. 
There's a rather long but good description of NetworkManager here:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html-single/Networking_Guide/index.html
- the CentOS6 version of the networking guide is here:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/part-Networking.html

I hope this helps - and that we didn't rewrite the book on networking
here. It's "just" a different tool which once you get used to the
commands you're familiar with from ifconfig offers a lot more
functionality.

I did a quick search on ifconfig to iproute2 and got a great number of
links that shows how the old command maps to the new commands. Maybe
this will be a better source of getting started with:
https://tty1.net/blog/2010/ifconfig-ip-comparison_en.html  (and yes,
note the date *grin*).  Here's another:
https://dougvitale.wordpress.com/2011/12/21/deprecated-linux-networking-commands-and-their-replacements/

Good luck - and please do keep asking clarifying questions if that's
needed. But if this increases the stress levels, I would recommend
starting AFTER thanksgiving so you can enjoy today with no more
additional stress :) Happy Thanksgiving!

-- 
Regards
  Peter Larsen




On 11/24/2016 09:56 AM, Beartooth wrote:
> On Wed, 23 Nov 2016, Jared Scott wrote:
>
>> You can use the ip commands.
>>
>> For `ifconfig`
>>
>> *ip addr*
>>
>> or
>>
>> *ip addr show*
>>
>> For `ifconfig eth0` use:
>> *ip addr show eth0*
>
>     I keep getting "command not found" for those.
>
> [btth@localhost ~]$ ipaddr
> bash: ipaddr: command not found
> [btth@localhost ~]$ ipaddr show
> bash: ipaddr: command not found
> [btth@localhost ~]$ ipaddr show eth0
> bash: ipaddr: command not found
> [btth@localhost ~]$ *ipaddr show*
> bash: *ipaddr: command not found
> [btth@localhost ~]$
>






More information about the Novalug mailing list