Freigeben über


Port-Spiegelung überprüfen

Gilt für: Advanced Threat Analytics, Version 1.9

Hinweis

Dieser Artikel ist nur relevant, wenn Sie ATA-Gateways anstelle von ATA Lightweight Gateways bereitstellen. Informationen dazu, ob Sie ATA-Gateways verwenden müssen, finden Sie unter Auswählen der richtigen Gateways für Ihre Bereitstellung.

Die folgenden Schritte führen Sie durch den Prozess, um zu überprüfen, ob die Port-Spiegelung richtig konfiguriert ist. Damit ATA ordnungsgemäß funktioniert, muss das ATA-Gateway in der Lage sein, den Datenverkehr vom und zum Domänencontroller anzuzeigen. Die Hauptdatenquelle, die von ATA verwendet wird, ist die Deep Packet Inspection der Netzwerkauslastung zu und von Ihren Domänencontrollern. Damit ATA den Netzwerkdatenverkehr sehen kann, muss eine Port-Spiegelung konfiguriert werden. Bei der Port-Spiegelung wird der Datenverkehr von einem Port (dem Quellport) auf einen anderen Port (den Zielport) kopiert.

Überprüfen der Port-Spiegelung mithilfe eines Windows PowerShell-Skripts

  1. Speichern Sie den Text dieses Skripts in einer Datei namens ATAdiag.ps1.
  2. Führen Sie dieses Skript auf dem ATA-Gateway aus, das Sie überprüfen möchten. Das Skript generiert ICMP-Datenverkehr vom ATA-Gateway zum Domänencontroller und sucht diesen Datenverkehr auf der Capture-NIC auf dem Domänencontroller. Wenn der ATA-Gateway ICMP-Datenverkehr mit einer Ziel-IP-Adresse sieht, die mit der von Ihnen in der ATA-Konsole eingegebenen DC-IP übereinstimmt, wird die Port-Spiegelung konfiguriert.

Beispiel für die Ausführung des Skripts:

# ATAdiag.ps1 -CaptureIP n.n.n.n -DCIP n.n.n.n -TestCount n
param([parameter(Mandatory=$true)][string]$CaptureIP, [parameter(Mandatory=$true)][string]$DCIP, [int]$PingCount = 10)

# Set variables
$ErrorActionPreference = "stop"
$starttime = get-date
$byteIn = new-object byte[] 4
$byteOut = new-object byte[] 4
$byteData = new-object byte[] 4096  # size of data

$byteIn[0] = 1  # for promiscuous mode
$byteIn[1-3] = 0
$byteOut[0-3] = 0

# Convert network data to host format
function NetworkToHostUInt16 ($value)
{
    [Array]::Reverse($value)
    [BitConverter]::ToUInt16($value,0)
}
function NetworkToHostUInt32 ($value)
{
    [Array]::Reverse($value)
    [BitConverter]::ToUInt32($value,0)
}
function ByteToString ($value)
{
    $AsciiEncoding = new-object system.text.asciiencoding
    $AsciiEncoding.GetString($value)
}

Write-Host "Testing Port Mirroring..." -ForegroundColor Yellow
Write-Host ""
Write-Host "Here is a summary of the connection we will test." -ForegroundColor Yellow

# Initialize a first ping connection
Test-Connection -Count 1 -ComputerName $DCIP -ea SilentlyContinue
Write-Host ""
Write-Host "Press any key to continue..." -ForegroundColor Red
[void][System.Console]::ReadKey($true)
Write-Host ""
Write-Host "Sending ICMP and Capturing data..." -ForegroundColor Yellow

# Open a socket
$socket = new-object system.net.sockets.socket([Net.Sockets.AddressFamily]::InterNetwork,[Net.Sockets.SocketType]::Raw,[Net.Sockets.ProtocolType]::IP)

# Include the IP header
$socket.setsocketoption("IP","HeaderIncluded",$true)
$socket.ReceiveBufferSize = 10000
$ipendpoint = new-object system.net.ipendpoint([net.ipaddress]"$CaptureIP",0)
$socket.bind($ipendpoint)

# Enable promiscuous mode
[void]$socket.iocontrol([net.sockets.iocontrolcode]::ReceiveAll,$byteIn,$byteOut)

# Initialize test variables
$tests = 0
$TestResult = "Noise"
$OneSuccess = 0

while ($tests -le $PingCount)
{
    if (!$socket.Available)  # see if any packets are in the queue
    {
        start-sleep -milliseconds 500
        continue
    }

    # Capture traffic
    $rcv = $socket.receive($byteData,0,$byteData.length,[net.sockets.socketflags]::None)

    # Decode the header so we can read ICMP
    $MemoryStream = new-object System.IO.MemoryStream($byteData,0,$rcv)
    $BinaryReader = new-object System.IO.BinaryReader($MemoryStream)

    # Set IP version & header length
    $VersionAndHeaderLength = $BinaryReader.ReadByte()

    # TOS
    $TypeOfService= $BinaryReader.ReadByte()

    # More values, and the Protocol Number for ICMP traffic
    # Convert network format of big-endian to host format of little-endian
    $TotalLength = NetworkToHostUInt16 $BinaryReader.ReadBytes(2)
    $Identification = NetworkToHostUInt16 $BinaryReader.ReadBytes(2)
    $FlagsAndOffset = NetworkToHostUInt16 $BinaryReader.ReadBytes(2)
    $TTL = $BinaryReader.ReadByte()
    $ProtocolNumber = $BinaryReader.ReadByte()
    $Checksum = [Net.IPAddress]::NetworkToHostOrder($BinaryReader.ReadInt16())

    # The source and destination IP addresses
    $SourceIPAddress = $BinaryReader.ReadUInt32()
    $DestinationIPAddress = $BinaryReader.ReadUInt32()

    # The source and destimation ports
    $sourcePort = [uint16]0
    $destPort = [uint16]0

    # Close the stream reader
    $BinaryReader.Close()
    $memorystream.Close()

    # Cast DCIP into an IPaddress type
    $DCIPP = [ipaddress] $DCIP
    $DestinationIPAddressP = [ipaddress] $DestinationIPAddress

    #Ping the DC at the end after starting the capture
    Test-Connection -Count 1 -ComputerName $DCIP -ea SilentlyContinue | Out-Null

    # This is the match logic - check to see if Destination IP from the Ping sent matches the DCIP entered by in the ATA Console
    # The only way the ATA Gateway should see a destination of the DC is if Port Spanning is configured

    if ($DestinationIPAddressP -eq $DCIPP)  # is the destination IP eq to the DC IP?
    {
        $TestResult = "Port Spanning success!"
        $OneSuccess = 1
    } else {
        $TestResult = "Noise"
    }

    # Put source, destination, test result in Powershell object
    new-object psobject | add-member -pass noteproperty CaptureSource $([system.net.ipaddress]$SourceIPAddress) | add-member -pass noteproperty CaptureDestination $([system.net.ipaddress]$DestinationIPAddress) | Add-Member -pass NoteProperty Result $TestResult | Format-List | Out-Host
    #Count tests
    $tests ++
}

if ($OneSuccess -eq 1)
{
    Write-Host "Port Spanning Success!" -ForegroundColor Green
    Write-Host ""
    Write-Host "At least one packet which was addressed to the DC, was picked up by the Gateway." -ForegroundColor Yellow
    Write-Host "A little noise is OK, but if you don't see a majority of successes, you might want to re-run." -ForegroundColor Yellow
} else {
    Write-Host "No joy, all noise.  You may want to re-run, increase the number of Ping Counts, or check your config." -ForegroundColor Red
}

Write-Host ""
Write-Host "Press any key to continue..." -ForegroundColor Red
[void][System.Console]::ReadKey($true)

Überprüfung der Port-Spiegelung mit dem Netzwerkmonitor

  1. Installieren Sie Microsoft Network Monitor 3.4 auf dem ATA-Gateway, das Sie überprüfen möchten.

    Wichtig

    Installieren Sie Microsoft Message Analyzer oder eine andere Software zur Datenverkehrserfassung auf dem ATA-Gateway.

  2. Öffnen Sie Network Monitor und erstellen Sie eine neue Registerkarte für die Erfassung.

    1. Wählen Sie nur den Capture-Netzwerkanschluss oder den Netzwerkanschluss aus, der mit dem Switch-Port verbunden ist, der als Ziel für die Portspiegelung konfiguriert ist.

    2. Stellen Sie sicher, dass P-Mode aktiviert ist.

    3. Klicken Sie auf Neue Erfassung.

      Screenshot of the Microsoft Network Monitor dialog showing the New Capture button.

  3. Geben Sie im Fenster „Filter anzeigen“ den folgenden Filter ein: KerberosV5 ODER LDAP und wählen Sie dann Anwenden.

    Screenshot of the Microsoft Network Monitor dialog with the Display Filter area showing.

  4. Wählen Sie Start, um die Erfassungssitzung zu starten. Wenn der Datenverkehr zum und vom Domänencontroller nicht angezeigt wird, überprüfen Sie Ihre Port-Spiegelungskonfiguration.

    Screenshot of the Microsoft Network Monitor dialog with the Start button showing.

    Hinweis

    Es ist wichtig, dass Sie den Datenverkehr zu und von den Domänencontrollern sehen.

  5. Wenn Sie den Datenverkehr nur in eine Richtung sehen, sollten Sie mit Ihrem Netzwerk- oder Virtualisierungsteam zusammenarbeiten, um die Konfiguration der Port-Spiegelung zu überprüfen.

Weitere Informationen