Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

hallo zusammen,

ich bin auf der Suche nach einem Script das mir in einem Netz z.b 192.168.7.x alle IP-Adressen rauszieht die pingen. Hintergrund ist ich muss wissen welche Rechner/IP-Adressen an sind oder nicht. Dann müsst ich immer eine nach der anderen anpingen. Kann man das in einem Script lösen? Kann mir da jemand netterweise nen Tipp geben?

Du könntest unter z.B. über ein PHP-Script per "Brut-Force" über exec einen Ping versenden und das Ergebnis prüfen. Persönlich finde ich das aber sehr unschön, denn einfach alle Adressen im Netz durchlaufen und pingen, naja. Du könntest auch die Arp-Tabelle holen und diese auswerten und dann gezielt auswerten. Ein weiteres Problem ist, wenn ein Rechner durch eine FW keine ICMP Antworten sendet.

Ich denke eine gute Lösung wäre die Daten, als welchem Port welche Mac-Adresse hängt, vom Switch per SNMP zu holen und falls Du die IP benötigst diese Per ARP zu erfragen ggf. dann über die IP und DNS den Hostnamen.

Phil


#!/usr/bin/perl -w


use strict;

use Net::Ping;


my $i = 0;

my $host = 0;

my $ping = Net::Ping->new('icmp', 1);

my $online = open(ONLINE, ">online.txt");

my $offline = open(OFFLINE, ">offline.txt");


for($i = 0; $i <= 25; $i++)

{

    $host = "192.168.0.$i";


    if($ping->ping($host))

    {

        print "Online: $host\n";

        print ONLINE "Online: $host\n";

    }

    else

    {

        print "Offline: $host\n";

        print OFFLINE "Offline: $host\n";

    }  

}


# eof


Hi,

aber bedenke:

If the "icmp" protocol is specified, the ping() method sends an icmp echo message to the remote host, which is what the UNIX ping program does. If the echoed message is received from the remote host and the echoed information is correct, the remote host is considered reachable. Specifying the "icmp" protocol requires that the program be run as root or that the program be setuid to root.

Und ich hoffe, dass du dein Webserver nicht als root laufen hast ...

ciao,

vic

Ebenfalls eine einfache Lösung ist "nmap -F 192.168.7.0/24". Belohnt wirst du mit einer feinen Liste aller im Netzwerk aktiven Kisten inkl. Ports..

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.