Bereitstellen von netstat nach CentOS Minimal Installation
CentOS beinhaltet nach der Minimalinstallation nur wenig des sonst gewohnten Umfangs, eine reihe von System-Tools fehlen, so scheint es zumindest, bei näherer Betrachtung zeigt sich, das es nur neue Befehle sind, die herkömmlichen Tools können aber nachträglich installiert werden.
Ein solches Tool ist netstat, dieses wie folgt hinzugefügt wird.
$ yum install -y net-tools
Ermitteln welches Installationspaket das gewünschte Tool beinhaltet, lässt sich mit der Option whatprovides.
$ yum whatprovides netstat
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.spreitzer.ch
* epel: mirror.spreitzer.ch
net-tools-2.0-0.24.20131004git.el7.x86_64 : Basic networking tools
Repo : base
Matched from:
Filename : /bin/netstat
net-tools-2.0-0.24.20131004git.el7.x86_64 : Basic networking tools
Repo : @base
Matched from:
Filename : /bin/netstat
net-tools-2.0-0.24.20131004git.el7.x86_64 : Basic networking tools
Repo : @base
Matched from:
Filename : /usr/bin/netstat
net-tools ist eine Sammlung mit Basis-Netzwerkprogramme. Ist das Paket net-tools installiert, stehen folgende Kommandos auf dem Host zur Verfügung:
$ yum info net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
Name : net-tools
Arch : x86_64
Version : 2.0
Release : 0.24.20131004git.el7
Size : 918 k
Repo : installed
From repo : base
Summary : Basic networking tools
URL : http://sourceforge.net/projects/net-tools/
License : GPLv2+
Description : The net-tools package contains basic networking tools,
: including ifconfig, netstat, route, arp and others.
: Most of them are obsolete. For replacement check iproute package.
Mit den net-tools wird die Verfügbarkeit der veralteten Linux-Netzwerk-Befehle wiederhergestellt, folgende Tabelle zeigt die veralteten Linux-Befehle und die neuen Ersetzungsbefehle:
Veraltete Befehle | Neue befehle |
---|---|
arp | ip n (ip neighbor) |
ifconfig | ip a (ip addr), ip link |
iptunnel | ip tunnel |
iwconfig | iw |
nameif | ip link |
netstat | ss -t (für netstat -t), ss -u (für netstat -u) ip route (für netstat -r) ip -s link (für netstat -i) ip maddr (für netstat -g) |
route | ip r (ip route) |
ss – ist ein neues Dienstprogramm zum Untersuchen von Sockets, der Befehl ss
wird verwendet um Socket-Statistiken auszugeben. Es ermöglicht die Anzeige von Informationen ähnlich wie netstat.
Beispiel zur Anwendung von ss anstelle von netstat:
$ ss -tuln4
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
tcp LISTEN 0 128 127.0.0.1:10024 *:*
tcp LISTEN 0 100 127.0.0.1:10025 *:*
tcp LISTEN 0 100 *:587 *:*
tcp LISTEN 0 128 127.0.0.1:783 *:*
tcp LISTEN 0 100 *:465 *:*
tcp LISTEN 0 128 *:22 *:*
tcp LISTEN 0 100 *:25 *:*
tcp LISTEN 0 128 127.0.0.1:8899 *:*
Ebenso kann ein whois lookup oft nützliche Informationen liefern, dazu muss whois installiert werden:
$ yum -y install jwhois
$ whois
jwhois version 4.0, Copyright (C) 1999-2007 Free Software Foundation, Inc.
This program is free software with ABSOLUTELY NO WARRANTY; you may
redistribute it under the terms of the GNU General Public License.
Usage: jwhois [OPTIONS] [QUERY]
--version display version number and patch level
--help display this help
-v, --verbose verbose debug output
-c FILE, --config=FILE use FILE as configuration file
-h HOST, --host=HOST explicitly query HOST
-n, --no-redirect disable content redirection
-s, --no-whoisservers disable whois-servers.net service support
-a, --raw disable reformatting of the query
-i, --display-redirections display all redirects instead of hiding them
-p PORT, --port=PORT use port number PORT (in conjunction with HOST)
-r, --rwhois force an rwhois query to be made
--rwhois-display=DISPLAY sets the display option in rwhois queries
--rwhois-limit=LIMIT sets the maximum number of matches to return