From owner-freebsd-questions Sat Aug 31 17:35:28 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0F1F837B401 for ; Sat, 31 Aug 2002 17:35:23 -0700 (PDT) Received: from trinitron.eu.s2m.net (trinitron.eu.s2m.net [217.146.140.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id E429F43E4A for ; Sat, 31 Aug 2002 17:35:20 -0700 (PDT) (envelope-from mgrundmann@activezone.org) Received: from fe1-sf0.netstation.s2m.net (fe1-sf0.netstation.s2m.net [217.146.150.18]) by trinitron.eu.s2m.net (8.12.5/8.12.1) with ESMTP id g810ZDNp022502 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Sun, 1 Sep 2002 02:35:13 +0200 Received: from client26150146217 (client26-150-146-217.hi.de.s2m.net [217.146.150.26]) (authenticated (0 bits)) by fe1-sf0.netstation.s2m.net (8.12.5/8.11.3) with ESMTP id g810ZNbJ015789 (using TLSv1/SSLv3 with cipher RC4-MD5 (128 bits) verified NO) for ; Sun, 1 Sep 2002 02:35:23 +0200 (CEST) (envelope-from mgrundmann@activezone.org) Posted-Date: Sun, 1 Sep 2002 02:35:23 +0200 (CEST) Powered-by: S2M.NETWORK, GERMANY - MAIL2.S2M.NET - ORDB ready Message-ID: <002801c2514f$65b56c50$1a9692d9@hi.de.s2m.net> From: "Markus Grundmann" To: Subject: My version of "ifconfig.c" for FreeBSD 4.x Date: Sun, 1 Sep 2002 02:34:56 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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 ) status: active sf1: flags=8843 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 ) status: active sf2: flags=8843 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 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 mtu 1500 Description "" lo0: flags=8049 mtu 16384 Description "Loopback" inet 127.0.0.1 netmask 0xff000000 sl0: flags=c010 mtu 552 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