ip vs. if{up,down}

Derek Martin invalid at pizzashack.org
Sun Mar 13 22:20:01 EST 2005


On Sun, Mar 13, 2005 at 07:34:32PM -0500, Ben Scott wrote:
> The traditional command to configure an interface on nix is
> "ifconfig".  
[snip]
> 
> The newer command is "ip", which is part of the iproute2 suite.  It
> provides a single interface to IP configuration, and breaks things
> nicely into the datalink and network layers, eliminating the trouble
> with multiple IP addresses per interface that "ifconfig" had.

Another big difference is how these two tools interface with the
kernel.  ifconfig uses the older method of calling SIOC* ioctls on a
socket associated with the interface, whereas ip uses a newer
interface designed to provide cleaner mechanisms to handle multiple
addresses, address families, routing, etc.

Around the time when the ip tools first appeared, I was interested in
re-writing the ifconfig and route commands to address some bugs and
shortcomings in their functionality.  I got about half way finished
with (IPv4 support for) ifconfig when I learned there was a newer,
better mechanism to handle everything.  I stopped working on the
project at that point, because Alexey's code wasn't well documented,
and I felt some futility at having put in all that effort to learning
the old method...

I still think it would be nice to have working, fully-functional
versions of ifconfig and route (for the sake of a reasonable amount of
compatibility with other Unix variants), and I may continue work on it
at some point, but there doesn't seem to be a lot of interest from
what I guaged at that time...  The iproute2 project now has a new
maintainer -- perhaps the code is better commented.  Alexey's original
code had almost no comments whatsoever...

> The ifup/ifdown bit originated with Red Hat, I believe.  They are
> configuration automation scripts which read config info from
> /etc/sysconfig/network* and act on it.  "ifup foo" brings up an
> Interface profile, which might invoke "ifconfig", "ip",
> "ipx_interface", "wvdial", or any number of other tools.  So
> "ifup/ifdown" function at a higher level then ifconfig/ip.

Interestingly, if you use Red Hat's networking GUIs to configure
dial-up access (for those of us unfortunate enough that we still have
to use dial-up), you can use ifup to bring up your dial-up connections
on the command line.  For example, if you created a dial-up connection
called ziplink, then

  # ifup ziplink

will bring up your ziplink connection.  At least, it does on FC2.  It
may or may not work on older RH distros.

> like virtual hosting).  Finally, if portability is one's goal,
> "ifconfig" would be the best answer.

I'm not sure I really agree with that...  I think HP-UX and Solaris
(not necessarily in that order) are the most popular Unix variants in
use today, based on what I've seen in job postings.  Their syntax for
ifconfig (IIRC) is quite different than that for Linux.  Is it based
on BSD's ifconfig?  I haven't managed a system which had the same
syntax, AFAIK.

It has some unusual options/flags/whatever, and the syntax parser is a
little, um, eccentric...  For example, it sets options as it parses
them...  so if you make a typing mistake, you could leave your
interface in an invalid state, potentially cutting yourself off from
the machine (possibly necessitating a trip to a remote facility to fix
the problem)...  This is one of the problems my re-write was designed
to deal with.  It parsed the entire command line before the state of
the interface was changed.  If an error occured, no change occured.
IIRC, ifconfig will also let you do strange things like specify any
number of addresses on the command line (which will change the address
of the interface once for each address, leaving the last one you gave
it.

But I digress...

I guess what I'm trying to say is that those just learning the network
configuration utilities, it's probably best to do so using the
ip tools.  I believe the distros are generally switching to using ip
in their rc scripts, too.  ifconifig and route are broken, lack various
functionality that ip has, and may even eventually not work at all, as
ip becomes the standard way to configure networking on Linux systems.

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail.  Sorry for the inconvenience.  Thank the spammers.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20050313/2c7a448a/attachment.bin


More information about the gnhlug-discuss mailing list