Skip to main content

Packet Capture

The Device42 Packet Capture tool enables packet capture as a means of discovery. Packet capture discovers service communication happening in real-time for any service listeners known to Device42, letting you discover service communications that are too infrequent for scheduled discovery jobs to catch.

Device42 packet capture supports both individual and promiscuous interfaces, giving you the flexibility to deploy and use packet capture in the way that makes the most sense for your IT environment.

Prerequisites

You need the following to use the Device42 Packet Capture tool:

  • A Device42 Main Appliance (MA).
  • Network communication allowed from the machine you'll be capturing packets on to your Device42 MA.
  • An active network adapter connected to the target traffic capture network.
  • A packet capture library installed on your operating system:
    • On Windows, use a WinPcap-compatible library like Npcap. Be sure to select the Install in API-Compatible mode option during setup.
    • On Linux, use libpcap.

You can optionally enable promiscuous mode (also known as monitor mode) for the network or the interface of interest.

tip

Watch the Intro to Packet Capture video for a quick overview of how to set up and use packet capture with Device42.

Configure Packet Capture

  1. Download the compressed d42-packet-capture.zip utility file and extract the contents to a directory of your choice.

  2. Place the d42pcap.json config file into the directory with the utility.

  3. On Linux, create a symlink for libpcap as required by the application, which searches for the filename libpcap.so.1:

    sudo ln -s /usr/lib/x86_64-linux-gnu/libpcap.so.1.8.1 /usr/lib/x86_64-linux-gnu/libpcap.so.1

    On Windows, no extra configuration is needed.

  4. Configure the utility by editing the d42pcap.json file. At minimum, configure the following sections to run the Packet Capture utility:

    • Point the utility at your Device42 instance by entering its IP address, username, and password in the device42 section of the config file. Save the file.
    • Enter the name of your capture interface in the device property of the pcap section. Use the name as shown under ipconfig on Windows or ifconfig on Linux. For example, ens32.
    • Adjust the interval property of the common section. The default is to relay 60-second chunks of capture data to Device42 to avoid overwhelming the MA, especially if filtering isn't used or you're capturing traffic from many devices.
  5. Optionally install the utility to run as a Windows or Linux service. See the Install Packet Capture as a System Service section.

Run the Packet Capture Utility

  1. Ensure all Prerequisites are met.
  2. Configure the utility as described in the Configure Packet Capture section above.
  3. Execute the utility by running:
    • Windows: c:\> d42pcap.exe
    • Linux: $ sudo ./d42pcap_linux_64
  4. Optionally configure the following runtime parameters:
ParameterDescription
list-devicesLists all network adapters on the host
versionPrints the version of the utility
logs-dirOverrides the directory to which log files are written
settings-dirThe directory containing the utility's JSON configuration file
settings-nameThe name of the utility's JSON configuration file
debugTurns on debug logging
install-win-serviceInstalls the utility as a Windows service (Windows executable only)
remove-win-serviceRemoves the utility from the installed Windows services (Windows executable only)

Configuration File Definitions

The configuration file contains the following sections:

SectionDescription
device42Contains settings required to interact with Device42.
commonContains common application settings.
pcapContains settings that affect how raw network packets are handled.
captureSettings that affect Device42 NetFlow and Packet Capture engine event processing. This section is intended for Device42 support.

Device42 Configuration

PropertyDescriptionRequired
HostBase URL of the Device42 websiteYes
UserUsernameYes
PasswordPasswordYes

Common Configuration

PropertyDescriptionRequired
IntervalThe number of seconds to collect network events before sending to Device42Yes
logs-dirThe directory to which log files are writtenNo

PCAP Configuration

PropertyDescriptionRequired
DeviceSpecify network capture interfaceYes
include-source-tcp-portsTCP source ports to includeNo
include-destination-tcp-portsTCP destination ports to includeNo
include-source-udp-portsUDP source ports to includeNo
include-destination-udp-portsUDP destination ports to includeNo
include-source-tcp-ipsTCP source IPs to includeNo
include-dest-tcp-ipsTCP destination IPs to includeNo
include-source-udp-ipsUDP source IPs to includeNo
include-dest-udp-ipsUDP destination IPs to includeNo
ignore-tcpIgnore all TCP network eventsNo
ignore-udpIgnore all UDP network eventsNo
promiscuous-modetrue captures all packets passed and received rather than just host packetsYes
sniff-timeoutDuration in nanoseconds to wait for network events to be read (default: 2)Yes
snap-lengthLength of raw network packets to collect (default: 1600)Yes

Capture Configuration

PropertyDescriptionRequired
live-entriesDisplay live entriesNo
live-entries-okDisplay OK live entriesNo
live-entries-nokDisplay NOK live entriesNo
print-dataPrint dataNo
ignore-ipsIgnored IPsNo
ignore-portsIgnored portsNo
pass-toReserved for Device42 useNo
default-protocolReserved for Device42 useNo
only-statsReserved for Device42 useNo
report-any-ipReserved for Device42 useNo
report-src-ipReserved for Device42 useNo
report-dst-ipReserved for Device42 useNo
unprocessed-packetsReserved for Device42 useNo

Install Packet Capture as a System Service

You can install the Packet Capture utility to run as a system service on Windows or Linux.

On Windows:

Execute with the install-win-service flag:

C:\> d42pcap -install-win-service

On Linux:

  1. Create a service file in the /etc/systemd/system directory:

    [Unit]
    Description=Device42 Packet Capture Utility

    [Service]
    PIDFile=/tmp/d42pcap.pid
    User=root
    Group=root
    WorkingDirectory=/usr/bin
    ExecStart=/usr/bin/d42pcap
    Restart=always

    [Install]
    WantedBy=multi-user.target
  2. Enable and start the service:

    sudo systemctl enable d42pcap.service
    sudo systemctl start d42pcap.service