Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Sep 2002 02:34:56 +0200
From:      "Markus Grundmann" <mgrundmann@activezone.org>
To:        <freebsd-questions@FreeBSD.ORG>
Subject:   My version of "ifconfig.c" for FreeBSD 4.x
Message-ID:  <002801c2514f$65b56c50$1a9692d9@hi.de.s2m.net>

next in thread | raw e-mail | index | archive | help
Hi!
 
Some of my servers has more than one interfaces (NICs) and
sometimes I was unable to determine the right interface.
I think a "Description Field" like the Cisco IOS is good idea.
 
Now I have added a new (simple) function named "ifcomment" to the
source file "ifconfig.c". This function reads the description of
an interface from the file "/etc/interfaces" and
prints it out every you enter the command.
 
The modified source (Version 8.2 from FreeBSD 4.6) is available for
download at ftp://ftp.activezone.org/dev/freebsd/ifconfig.tar.gz
 
The output of my ifconfig version is now colored at:
- IFNAME (White)
- IP-Address (White)
- Description Field (Green)
- Status Field (Green/Red)

Example:
--------
sf0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
         Description "Uplink-Interface to the world"
         inet xxx.xxx.xxx.xxx netmask 0xfffffffc broadcast xxxx.xxx.xxx.xxx
         ether xx:xx:xx:xx:xx:xx
         media: Ethernet autoselect (100baseTX <full-duplex>)
         status: active
sf1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
         Description "Client-Network a.b.c.d/prefix"
         inet xxx.xxx.xxx.xxx netmask 0xfffffffc broadcast xxxx.xxx.xxx.xxx
         ether xx:xx:xx:xx:xx:xx
         media: Ethernet autoselect (100baseTX <full-duplex>)
         status: active
sf2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
         Description "Second Uplink-Interface to cisco 3620 (e0/0)"
         inet xxx.xxx.xxx.xxx netmask 0xfffffffc broadcast xxxx.xxx.xxx.xxx
         ether xx:xx:xx:xx:xx:xx
         media: Ethernet autoselect (10baseT/UTP)
         status: active
sf3: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
         Description "This interface is down"
         inet xxx.xxx.xxx.xxx netmask 0xfffffffc broadcast xxxx.xxx.xxx.xxx
         ether xx:xx:xx:xx:xx:xx
         media: Ethernet autoselect (none)
         status: no carrier
lp0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
         Description "<NO DESCRIPTION>"
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
         Description "Loopback"
         inet 127.0.0.1 netmask 0xff000000
sl0: flags=c010<POINTOPOINT,LINK2,MULTICAST> mtu 552
         Description "<NO DESCRIPTION>"
 
 Example of /etc/interfaces:
---------------------------
# IFNAME    DESCRIPTION
sf1: "Uplink-Interface to the world"
sf2: "Client-Network a.b.c.d/prefix"
sf3: "Second Uplink-Interface to cisco 3620 (e0/0)"
sf4: "This interface is down"
lo0: "Loopback"


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002801c2514f$65b56c50$1a9692d9>