Napatech: Difference between revisions

From VoIPmonitor.org
(Add troubleshooting for service startup order issue after Git upgrade with init.d scripts (modify /etc/init.d/voipmonitor to add /opt/napatech3/bin/ntstart.sh and sleep 60))
(Review: oprava hierarchie nadpisů, konzistentní použití syntaxhighlight místo pre/odsazení, reorganizace sekcí, zkrácení AI Summary)
Line 1: Line 1:
== Configuration & building ==
= Napatech Integration =


= First Installation =
This guide covers building VoIPmonitor sniffer with Napatech SmartNIC support, configuration, and troubleshooting.


== First Installation ==


== Steps ==
=== Prerequisites ===
* Download latest Napatech drivers and untar into <code>/opt/napatech3</code>
* Build the Napatech driver according to vendor documentation
* Install required development libraries


* download latest Napatech drivers and untar it into e.g. /opt/napatech3
=== Build Steps ===
* build the driver
* download the the sniffer's source


cd /usr/src
<syntaxhighlight lang="bash">
git clone -b master https://github.com/voipmonitor/sniffer.git
# Clone the sniffer source
    OR
cd /usr/src
git clone -b develop https://github.com/voipmonitor/sniffer.git
git clone -b develop https://github.com/voipmonitor/sniffer.git
cd sniffer
cd sniffer
./configure --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib
 
# Configure with Napatech library paths
./configure --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib
 
# Install missing dependencies if configure reports errors, then run make
make
</syntaxhighlight>


'''Note:''' The development branch is named <code>develop</code> (NOT "development"). Use <code>git checkout develop</code> to switch to it.
'''Note:''' The development branch is named <code>develop</code> (NOT "development"). Use <code>git checkout develop</code> to switch to it.


If you already have the repository cloned and want to switch to the develop branch:
If you already have the repository cloned and want to switch to the develop branch:
<pre>
<syntaxhighlight lang="bash">
cd /usr/src/sniffer
cd /usr/src/sniffer
git fetch origin
git fetch origin
git checkout develop
git checkout develop
git pull
git pull
</pre>
</syntaxhighlight>


Install all libraries that the configure needs.
=== Verify Build ===


* run make
Check that voipmonitor is linked against Napatech's libpcap:
* check it's built properly
<syntaxhighlight lang="bash">
ldd ./voipmonitor | grep pcap
</syntaxhighlight>


root@server:/usr/src/sniffer# ldd ./voipmonitor | grep pcap
Expected output:
libpcap.so.1 => /opt/napatech3/lib/libpcap.so.1 (0x00007fc0b69b0000)
<pre>
libpcap.so.1 => /opt/napatech3/lib/libpcap.so.1 (0x00007fc0b69b0000)
</pre>


* replace original binary in the /usr/local/sbin
=== Install and Run ===
* run it


= Upgrade =
<syntaxhighlight lang="bash">
# Replace original binary
cp ./voipmonitor /usr/local/sbin/voipmonitor


==The GUI way (from the sensor's version 24.23)==
# Restart the service
systemctl restart voipmonitor
</syntaxhighlight>


== Upgrade ==


Until sensor's version 24.23 was not possible to do the sensor's upgrade via 'upgrade_by_git' option because the configure script
=== GUI Upgrade (v24.23+) ===
overwritten the adjusted Makefile and you built a binary with standard pcap libs (until you overwritten the orig libs). With 'configure_param' option you can adjust the Makefile creation for appropriate includes/libs


From sensor version 24.23, you can perform upgrades via the GUI using the <code>upgrade_by_git</code> option. The <code>configure_param</code> option ensures the Makefile is created with appropriate includes/libs.


* set these options into voipmonitor.conf
Add these options to <code>/etc/voipmonitor.conf</code>:
<syntaxhighlight lang="ini">
upgrade_by_git = yes
git_folder = /usr/src/sniffer
configure_param = --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib
</syntaxhighlight>


upgrade_by_git = yes
After restarting the sniffer, click '''UPGRADE''' in the GUI. The sniffer will automatically perform: git pull → configure → make clean → make → stop → make install → start.
git_folder = /usr/src/sniffer
configure_param = --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib


* restart sniffer
=== Manual Upgrade ===
* do the upgrade via clicking in the GUI


The sniffer will perform (after click on UPGRADE in GUI) git pull,configure,make_clean,make, service voipmonitor stop, make install, service voipmonitor start.
<syntaxhighlight lang="bash">
cd /usr/src/sniffer
git checkout develop
git pull
./configure --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib
make
make install
systemctl restart voipmonitor
</syntaxhighlight>


== Napatech Driver Configuration ==


==The manual way==
=== VoIPmonitor Configuration ===
cd /usr/src/sniffer
git checkout develop
git pull
./configure --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib
make


* copy to the original directory and restart sensor
In <code>/etc/voipmonitor.conf</code>:
<syntaxhighlight lang="ini">
interface = napa0


# IMPORTANT: BPF filter option must be commented out!
#filter = udp or (vlan and udp)
</syntaxhighlight>


= napatech drivers =
=== ntpcap.ini Configuration ===


== Settings sample ==
File: <code>/opt/napatech3/config/ntpcap.ini</code>
<syntaxhighlight lang="ini">
[Common]
Ntpl1 = "Assign[streamid=0;txport=0;txignore=true]=all"


* in voipmonitor.conf
[napa0]
interface = napa0
StreamId = 0
Tx = 0
</syntaxhighlight>


# filter option must be commented out !!! E.g.
For older Napatech driver versions:
#filter = udp or (vlan and udp)
<syntaxhighlight lang="ini">
[napa0]
Rx1="Assign[streamid=252;txport=0;txignore=true]=all"
Tx=0
</syntaxhighlight>


* /opt/napatech3/config/ntpcap.ini
=== ntservice.ini Configuration ===


# Napatech default ntpcap.ini file
File: <code>/opt/napatech3/config/ntservice.ini</code>
[Common]
<syntaxhighlight lang="ini">
Ntpl1 = "Assign[streamid=0;txport=0;txignore=true]=all"
[System]
TimestampFormat = NATIVE_UNIX
TimestampMethod = EOF
HostBufferWaitMethod = 0
SDRAMFillLevelWarning = 0


[napa0 ]
[logging]
StreamId = 0
LogMask = 0x07
Tx = 0
LogToFile = 0
LogFileName = /tmp/Log3G_%s.log
LogBufferWrap = wrap


* old version
[Adapter0]
[napa0]
AdapterType = NT4E
Rx1="Assign[streamid=252;txport=0;txignore=true]=all"
BusId = 00:07:00:00
Tx=0
PacketDescriptor = NT
HostBuffersRx = [8,16,0]
HostBuffersTx = [8,16,0]
TimeSyncProtocol = NT
TimeSyncConnectorIn = Ext
TimeSyncConnectorOut = None
TimeSyncConnectorRepeat = None
TimeSyncTimeJumpThreshold = 1
TimeSyncTimeOffset = 0
MaxFrameSize = 9018
AltTPID = 0x8100
Profile = Capture
DiscardSize = 16
OsTimeSyncFailover = DISABLE
</syntaxhighlight>


* /opt/napatech3/config/ntservice.ini
=== Time Source Configuration ===


[System]
By default, Napatech uses GMT timestamps. To use system time instead:
TimestampFormat = NATIVE_UNIX
TimestampMethod = EOF
HostBufferWaitMethod = 0
SDRAMFillLevelWarning = 0


'''For newer Napatech drivers:'''
<syntaxhighlight lang="ini">
TimesynConnectorExt1 = None
TimeSyncReferencePriority = OSTime
</syntaxhighlight>


[logging]
'''Alternative for older drivers:'''
LogMask = 0x07
<syntaxhighlight lang="ini">
LogToFile = 0
# For GMT (external PPS):
LogFileName = /tmp/Log3G_%s.log
TimeSyncConnectorExt1 = PpsIn
LogBufferWrap = wrap


[Adapter0]
# For system-dependent time:
AdapterType = NT4E
TimeSyncConnectorExt1 = NttsIn
BusId = 00:07:00:00
</syntaxhighlight>
PacketDescriptor = NT
HostBuffersRx = [8,16,0]
HostBuffersTx = [8,16,0]
TimeSyncProtocol = NT
TimeSyncConnectorIn = Ext
TimeSyncConnectorOut = None
TimeSyncConnectorRepeat = None
TimeSyncTimeJumpThreshold = 1
TimeSyncTimeOffset = 0
MaxFrameSize = 9018
AltTPID = 0x8100
Profile = Capture
DiscardSize = 16
OsTimeSyncFailover = DISABLE


Timing source
'''Tip:''' If spool directories are created with incorrect dates (e.g., <code>1970-01-01</code>), see [[#Troubleshooting: Spool Directories with Date 1970-01-01|troubleshooting section below]].
In napatech where timestamp of packets is shifted to GMT and you want use system time instead:
GMT:
TimeSyncConnectorExt1 = PpsIn
System dependent:
TimeSyncConnectorExt1 = NttsIn


For new napatech drivers use following to set OS time for packets from napatech
== Systemd Service Configuration ==
TimesynConnectorExt1  = None
TimeSyncReferencePrioroity =OSTime


'''Troubleshooting:''' If spool directories are created with incorrect dates (e.g., <code>1970-01-01</code>), see [[#Troubleshooting:_Spool_Directories_with_Date_1970-01-01|below]] for the solution by setting <code>timeSource = OS</code>.
You need to ensure Napatech drivers (ntservice) start before VoIPmonitor. See [[Systemd_for_voipmonitor_service_management#Dependency_Customization|systemd service file configuration]] for adding:


== Hints ==
<syntaxhighlight lang="ini">
=== service file for voipmonitor ===
After=ntservice.service
You need to add to voipmonitor's service file that napatech drivers (ntservice) needs to be started before the voipmonitor
Requires=ntservice.service
[https://www.voipmonitor.org//doc/Systemd_for_voipmonitor_service_management#service_file_and_napatech_drivers by modifiyng the service file]
</syntaxhighlight>


=== Filter traffic on Napatech card ===
== Traffic Filtering on Napatech Card ==
If you want to filter a data directly in the Napatech card you can use this example as a starting point.
(many thanks to Distributel for the example)


Create a file e.g /opt/napatech3/myfilter.ntpl
To filter traffic directly on the Napatech card, create an NTPL filter file.


# Start NTPL
Example: <code>/opt/napatech3/myfilter.ntpl</code>
# Delete all existing filter
<syntaxhighlight lang="bash">
delete = all
# Start NTPL
# Delete all existing filter
delete = all


# Setup UDP macros
# Setup UDP macros
DefineMacro("mUdpSrcPort", "Data[DynOffset=DynOffUDPFrame;Offset=0;DataType=ByteStr2]")
DefineMacro("mUdpDestPort", "Data[DynOffset=DynOffUDPFrame;Offset=2;DataType=ByteStr2]")


DefineMacro("mUdpSrcPort", "Data[DynOffset=DynOffUDPFrame;Offset=0;DataType=ByteStr2]")
# Setup filters
DefineMacro("mUdpDestPort", "Data[DynOffset=DynOffUDPFrame;Offset=2;DataType=ByteStr2]")
# SIP filter (ports 5060, 5061)
Assign[StreamId = 0] = (mUdpSrcPort == 5060, 5061) AND (mUdpDestPort == 5060, 5061)
# RTP filter (ports 10000-61743 in HEX)
Assign[StreamId = 0] = (mUdpSrcPort == (0x2710..0xF12F))
Assign[StreamId = 1] = (mUdpSrcPort == 5060, 5061) AND (mUdpDestPort == 5060, 5061)
Assign[StreamId = 1] = (mUdpSrcPort == (0x2710..0xF12F))
Assign[StreamId = 2] = (mUdpSrcPort == 5060, 5061) AND (mUdpDestPort == 5060, 5061)
Assign[StreamId = 2] = (mUdpSrcPort == (0x2710..0xF12F))
Assign[StreamId = 3] = (mUdpSrcPort == 5060, 5061) AND (mUdpDestPort == 5060, 5061)
Assign[StreamId = 3] = (mUdpSrcPort == (0x2710..0xF12F))
# End NTPL


# Setup filters
# Enable Deduplication
# The first line is the SIP filter. The second line is the RTP filter for our specific ports in HEX (10000-61743)
DeduplicationConfig[drop=duplicate] = GroupID == 0
 
Define ckRecipe = CorrelationKey(Begin=StartOfFrame[0], End=EndOfFrame[0], DeduplicationGroupID=0)
Assign[StreamId = 0] = (mUdpSrcPort == 5060, 5061) AND (mUdpDestPort == 5060, 5061)
Assign[StreamID=0,1,2,3; CorrelationKey=ckRecipe] = Port == 0,1,2,3
Assign[StreamId = 0] = (mUdpSrcPort == (0x2710..0xF12F))
</syntaxhighlight>
Assign[StreamId = 1] = (mUdpSrcPort == 5060, 5061) AND (mUdpDestPort == 5060, 5061)
Assign[StreamId = 1] = (mUdpSrcPort == (0x2710..0xF12F))
Assign[StreamId = 2] = (mUdpSrcPort == 5060, 5061) AND (mUdpDestPort == 5060, 5061)
Assign[StreamId = 2] = (mUdpSrcPort == (0x2710..0xF12F))
Assign[StreamId = 3] = (mUdpSrcPort == 5060, 5061) AND (mUdpDestPort == 5060, 5061)
Assign[StreamId = 3] = (mUdpSrcPort == (0x2710..0xF12F))
# End NTPL
 
# Enable Deduplication
DeduplicationConfig[drop=duplicate] = GroupID == 0
Define ckRecipe = CorrelationKey(Begin=StartOfFrame[0], End=EndOfFrame[0], DeduplicationGroupID=0)
Assign[StreamID=0,1,2,3; CorrelationKey=ckRecipe] = Port == 0,1,2,3


Apply the filter:
<syntaxhighlight lang="bash">
/opt/napatech3/bin/ntstart.sh -n myfilter.ntpl
</syntaxhighlight>


Start it with the command
== Troubleshooting ==


/opt/napatech3/bin/ntstart.sh -n myfilters.ntpl
=== Spool Directories with Date 1970-01-01 ===


=== Troubleshooting: Spool Directories with Date 1970-01-01 ===
If spool directories are created with incorrect timestamps (e.g., <code>1970-01-01</code>), the Napatech card is providing Unix Epoch time instead of actual system time.
If spool directories are created with incorrect timestamps (e.g., <code>1970-01-01</code> instead of the current date) on sensors using Napatech cards, this indicates the Napatech card is providing Unix Epoch time (timestamp = 0) instead of the actual system time.


<strong>Solution:</strong>
'''Solution:'''


;1. Edit the Napatech configuration file:
1. Edit <code>/opt/napatech3/config/ntservice.ini</code>
Edit <code>/opt/napatech/bin3/ntservice.ini</code> (or <code>/opt/napatech3/config/ntservice.ini</code> on some installations).


;2. Add or modify the timeSource settings:
2. For newer drivers, add:
For newer Napatech drivers, add this parameter to force the card to use system time:
<syntaxhighlight lang="ini">
<pre>
timeSource = OS
timeSource = OS
</pre>
</syntaxhighlight>


For older driver configurations in the <code>[Adapter0]</code> section, you may need to adjust:
For older drivers, in the <code>[Adapter0]</code> section:
<pre>
<syntaxhighlight lang="ini">
OsTimeSyncFailover = ENABLE
OsTimeSyncFailover = ENABLE
</pre>
</syntaxhighlight>


;3. Restart the Napatech service:
3. Restart services:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
systemctl stop ntservice
systemctl stop ntservice
systemctl start ntservice
systemctl start ntservice
</syntaxhighlight>
;4. Restart the voipmonitor sniffer service:
<syntaxhighlight lang="bash">
systemctl restart voipmonitor
systemctl restart voipmonitor
</syntaxhighlight>
</syntaxhighlight>


;5. Verify the fix:
4. Verify fix:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Check that new directories have correct dates
ls -ltd /var/spool/voipmonitor/*
ls -ltd /var/spool/voipmonitor/*
</syntaxhighlight>
</syntaxhighlight>


=== Troubleshooting: Napatech Interfaces in DOWN State ===
=== Napatech Interfaces in DOWN State ===
If standard capture tools like <code>tcpdump</code> or <code>tshark</code> show no packets on Napatech interfaces, verify that the Napatech interfaces are not in a DOWN state.
 
If <code>tcpdump</code> or <code>tshark</code> show no packets on Napatech interfaces:


;1. Check interface status:
1. Check interface status:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Check if Napatech interfaces are UP
ip link show napa0
ip link show napa0
# Check all Napatech interfaces
ip link show | grep napa
ip link show | grep napa
</syntaxhighlight>
</syntaxhighlight>
If the interfaces show a DOWN state instead of UP, continue with step 2.


;2. Verify Napatech drivers are loaded:
2. Verify drivers are loaded:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Check if ntpcap module is loaded
lsmod | grep ntpcap
lsmod | grep ntpcap
# Check Napatech driver service status
systemctl status ntservice
systemctl status ntservice
</syntaxhighlight>
</syntaxhighlight>
If the drivers are not loaded, start the service:
<syntaxhighlight lang="bash">systemctl start ntservice</syntaxhighlight>
;3. Check if custom libpcap is being used:
The Napatech setup requires linking against a custom <code>libpcap</code> library provided by Napatech. Standard system libpcap will not work correctly with Napatech cards.


3. Verify voipmonitor uses Napatech libpcap:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Verify voipmonitor is linked against Napatech libpcap
ldd /usr/local/sbin/voipmonitor | grep pcap
ldd /usr/local/sbin/voipmonitor | grep pcap
</syntaxhighlight>
</syntaxhighlight>
Expected output should show something like:
<pre>
libpcap.so.1 => /opt/napatech3/lib/libpcap.so.1 (0x00007f00b69b0000)
</pre>


If it shows system libpcap (e.g., <code>/lib/x86_64-linux-gnu/libpcap.so.1</code>), you need to rebuild using the custom library.
Expected output should show <code>/opt/napatech3/lib/libpcap.so.1</code>, NOT system libpcap.
 
;4. Rebuild with custom libpcap:
If voipmonitor is not using the Napatech libpcap, rebuild the sniffer:


4. If using system libpcap, rebuild voipmonitor:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
cd /usr/src/sniffer
cd /usr/src/sniffer
Line 269: Line 283:
</syntaxhighlight>
</syntaxhighlight>


After rebuilding, verify again with <code>ldd /usr/local/sbin/voipmonitor | grep pcap</code>.
=== Drivers Not Capturing Traffic ===
 
;5. Check ntpcap configuration:
Incorrect ntpcap configuration can prevent interfaces from coming up properly. Review <code>/opt/napatech3/config/ntpcap.ini</code>:
 
<syntaxhighlight lang="bash">
cat /opt/napatech3/config/ntpcap.ini
</syntaxhighlight>
 
Ensure:
* Stream IDs are properly assigned
* Interface names (e.g., <code>napa0</code>) match what you use in <code>voipmonitor.conf</code>
 
=== Troubleshooting: Napatech Drivers Not Capturing Traffic ===
If the VoIPmonitor sniffer is running but no calls are being captured, and you are using Napatech cards, the issue may be with the Napatech driver state. This can happen after driver crashes, system updates, or hardware resets.


<strong>Symptoms:</strong>
'''Symptoms:'''
* VoIPmonitor GUI shows no calls (CDR list or Active Calls are empty)
* GUI shows no calls
* <code>tshark -i napa0</code> shows no packets
* <code>tshark -i napa0</code> shows no packets
* Napatech interfaces are UP but not receiving data
* Interfaces are UP but not receiving data
* Restarting only VoIPmonitor service does not resolve the issue
 
<strong>Solution:</strong>
 
Restart the Napatech drivers to reset the capture engine:


'''Solution:''' Restart Napatech drivers:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Step 1: Stop VoIPmonitor sniffer service
systemctl stop voipmonitor
systemctl stop voipmonitor
# Step 2: Navigate to Napatech binary directory
cd /opt/napatech3/bin/
cd /opt/napatech3/bin/
# Step 3: Stop Napatech drivers
./ntstop
./ntstop
# Step 4: Start Napatech drivers
./ntstart
./ntstart
# Step 5: Restart VoIPmonitor sniffer service
systemctl start voipmonitor
systemctl start voipmonitor
</syntaxhighlight>
</syntaxhighlight>


If your system uses a different path for Napatech (e.g., <code>/opt/napatech</code> or <code>/opt/napatech3</code>), adjust the path in step 2 accordingly. You can locate the drivers with:
Verify traffic capture:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
find /opt -name "ntstart" 2>/dev/null
</syntaxhighlight>
<strong>Verification:</strong>
After restarting the drivers, verify that traffic is being captured:
<syntaxhighlight lang="bash">
# Check if packets are being captured on the Napatech interface
tshark -i napa0 -Y "sip || rtp" -n -c 10
tshark -i napa0 -Y "sip || rtp" -n -c 10
# Verify VoIPmonitor is processing calls
tail -f /var/log/syslog | grep voipmonitor
</syntaxhighlight>
</syntaxhighlight>


If the issue persists after restarting the drivers, check the Napatech logs for error messages:
If issues persist, check logs:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# View Napatech service logs
journalctl -u ntservice -n 50
journalctl -u ntservice -n 50
# Or check log file if configured
tail -f /tmp/Log3G_*.log
tail -f /tmp/Log3G_*.log
</syntaxhighlight>
</syntaxhighlight>


=== Troubleshooting: Compilation Errors with DPDK Headers ===
=== Compilation Errors with DPDK Headers ===
If compilation fails when using Napatech drivers on a system that also has system DPDK libraries installed, you may encounter errors in <code>dpdk.cpp</code> such as:
<pre>
error: 'RTE_ETH_MQ_TX_NONE' was not declared in this scope
</pre>
 
This occurs because the system's package manager-installed DPDK libraries are conflicting with the specific DPDK headers included with the Napatech SDK. The compiler is mixing incompatible header versions.


<strong>Solution:</strong>
If compilation fails with errors like <code>RTE_ETH_MQ_TX_NONE was not declared</code>, system DPDK libraries are conflicting with Napatech SDK.


Disable DPDK support in the generated <code>config.h</code> file:
'''Solution:''' Disable DPDK support in <code>config.h</code>:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Step 1: Run configure to generate config.h
# Run configure first
./configure --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib
./configure --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib


# Step 2: Open config.h
# Edit config.h - change:
# Location: config.h in the sniffer source directory
#define HAVE_LIBDPDK 1
 
# To:
# Step 3: Disable DPDK support by either:
#define HAVE_LIBDPDK 0
# Option A: Set HAVE_LIBDPDK to 0
# Change: #define HAVE_LIBDPDK 1
# To:     #define HAVE_LIBDPDK 0


# Option B: Comment out the entire block between:
# Then compile
# #ifdef HAVE_LIBDPDK and #endif
 
# Step 4: Save the file and compile
make
make
# Step 5: Verify compilation succeeded
ls -l voipmonitor
</syntaxhighlight>
</syntaxhighlight>


<strong>Note:</strong> Disabling DPDK support via <code>config.h</code> allows the Napatech card to function using the Napatech-provided libpcap library without requiring the DPDK-specific code. This is typically sufficient for most Napatech deployments that do not require the advanced DPDK polling mode.
=== Service Startup Order (init.d) ===


=== Troubleshooting: Service Startup Order Issue (init.d only) ===
If VoIPmonitor fails with <code>libpcap error no such device exists</code> after upgrade, Napatech drivers may not be initialized when VoIPmonitor starts.
After a manual Git upgrade on a sensor with Napatech cards, the VoIPmonitor service may fail to start with the error <code>libpcap error no such device exists</code>. This occurs when the service startup order causes VoIPmonitor to start before the Napatech drivers are fully initialized.
 
This issue only affects systems using the traditional <code>/etc/init.d/voipmonitor</code> script. For systems using systemd, see [[#Troubleshooting: Git Upgrade Error with systemd|below]].
 
<strong>Solution for init.d systems:</strong>
 
Modify the <code>/etc/init.d/voipmonitor</code> script to ensure Napatech drivers are loaded before VoIPmonitor starts:


'''For init.d systems:''' Edit <code>/etc/init.d/voipmonitor</code> and add before voipmonitor binary execution:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Step 1: Open the init.d script
nano /etc/init.d/voipmonitor
# Step 2: In the start() section, add the Napatech driver start
# command BEFORE the command that launches voipmonitor
# Add these lines before the voipmonitor binary execution:
/opt/napatech3/bin/ntstart.sh
/opt/napatech3/bin/ntstart.sh
sleep 60
sleep 60
# The sleep command allows sufficient time for the
# Napatech drivers to fully initialize. You may need
# to adjust the value (e.g., 30, 45, 60 seconds) based
# on your hardware.
# Step 3: Save and close the script
# Step 4: Restart the voipmonitor service
service voipmonitor restart
</syntaxhighlight>
</syntaxhighlight>


<strong>Verification:</strong>
'''For systemd systems:''' Add to the service unit file:
 
<syntaxhighlight lang="ini">
After applying the fix, check if VoIPmonitor starts correctly:
After=ntservice.service
 
Requires=ntservice.service
<syntaxhighlight lang="bash">
# Check service status
service voipmonitor status
 
# Check the logs for successful interface binding
tail -f /var/log/voipmonitor/voipmonitor.log | grep interface
 
# You should see a line like:
# "Listening on interface napa0" instead of an error
</syntaxhighlight>
</syntaxhighlight>


=== Troubleshooting: Git Upgrade Error with systemd ===
See [[Systemd_for_voipmonitor_service_management#Dependency_Customization|systemd documentation]] for details.
For systems using systemd instead of init.d scripts, the service startup order is managed differently. If you encounter <code>libpcap error no such device exists</code> after a Git upgrade with systemd:


See [[Systemd_for_voipmonitor_service_management#service_file_and_napatech_drivers|systemd service file configuration]] to ensure the service unit file includes:
== AI Summary for RAG ==


<pre>
'''Summary:''' Guide for building VoIPmonitor sniffer with Napatech SmartNIC support. Build process: clone source with <code>git clone -b develop</code>, configure with <code>--with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib</code>, and make. For GUI upgrades (v24.23+), set <code>upgrade_by_git=yes</code> and <code>configure_param</code> in voipmonitor.conf. Configuration requires: interface=napa0 in voipmonitor.conf (BPF filter must be disabled), ntpcap.ini for stream assignment, ntservice.ini for adapter settings. Time source configuration: set <code>timeSource=OS</code> for system time. Troubleshooting covers: 1970-01-01 spool directories (time source misconfiguration), interfaces in DOWN state (requires Napatech libpcap), drivers not capturing (restart with ntstop/ntstart), DPDK compilation errors (set HAVE_LIBDPDK=0 in config.h), service startup order (add ntservice dependency).
After=ntservice.service
Requires=ntservice.service
</pre>


This ensures the Napatech driver service (ntservice) is started before VoIPmonitor begins.
'''Keywords:''' Napatech, SmartNIC, compilation, configure, upgrade_by_git, configure_param, ntpcap.ini, ntservice.ini, timeSource, 1970-01-01, NTPL filter, libpcap, ntstop, ntstart, HAVE_LIBDPDK, systemd, init.d


== AI Summary for RAG ==
'''Summary:''' Instructions for building VoIPmonitor sniffer with Napatech support. Clone with <code>git clone -b develop</code> or switch branch with <code>git checkout develop</code>, then configure with --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib and make. For GUI upgrades (v24.23+), set upgrade_by_git=yes and configure_param options. Includes ntpcap.ini, ntservice.ini config samples, time source configuration for correct timestamps, NTPL filtering, and troubleshooting for: spool directories with 1970-01-01 dates (set timeSource=OS), Napatech interfaces in DOWN state (requires custom libpcap), drivers not capturing traffic (restart with ntstop/ntstart commands), compilation errors with DPDK headers (edit config.h to set HAVE_LIBDPDK=0 when system DPDK libraries conflict with Napatech SDK), and service startup order issue after Git upgrade (modify /etc/init.d/voipmonitor to add /opt/napatech3/bin/ntstart.sh and sleep 60 before launching voipmonitor binary; for systemd use After=ntservice.service Requires=ntservice.service).
'''Keywords:''' Napatech, compilation, git checkout develop, configure, upgrade_by_git, configure_param, ntpcap.ini, ntservice.ini, timeSource, 1970-01-01, timestamp, epoch time, NTPL filter, DOWN state, custom libpcap, interfaces, troubleshooting, ntstop, ntstart, no calls captured, driver restart, rte_eth_mq_tx_none, config.h, dpdk.cpp, HAVE_LIBDPDK, service startup order, init.d, libpcap error no such device exists, git upgrade, ntstart.sh, sleep, systemd, After=ntservice.service
'''Key Questions:'''
'''Key Questions:'''
* How do I compile VoIPmonitor with Napatech support?
* How do I compile VoIPmonitor with Napatech support?
* How do I switch to the develop branch?
* What configure options are needed for Napatech?
* What configure options are needed for Napatech?
* Napatech interfaces are in DOWN state, how do I fix it?
* How do I upgrade VoIPmonitor with Napatech via GUI?
* Why is tcpdump showing no packets on Napatech interfaces?
* Why are spool directories created with date 1970-01-01?
* How do I verify voipmonitor is using Napatech libpcap?
* How do I fix Napatech interfaces in DOWN state?
* VoIPmonitor not capturing calls with Napatech, how do I restart the drivers?
* VoIPmonitor not capturing calls with Napatech, how to fix?
* What do I do when ntstop or ntstart are located?
* How do I restart Napatech drivers?
* How do I fix RTE_ETH_MQ_TX_NONE compilation error when building with Napatech?
* How to fix RTE_ETH_MQ_TX_NONE compilation error?
* What do I do if system DPDK libraries conflict with Napatech SDK?
* VoIPmonitor service fails to start with libpcap error no such device exists after Git upgrade, how do I fix it?
* How to fix Napatech service startup order issue with init.d script?
* Do I need to add sleep after ntstart.sh in voipmonitor init script?
* How to configure Napatech driver dependency in systemd?
* How to configure Napatech driver dependency in systemd?
* What does libpcap error no such device exists mean with Napatech cards?
* What does libpcap error no such device exists mean?

Revision as of 11:25, 6 January 2026

Napatech Integration

This guide covers building VoIPmonitor sniffer with Napatech SmartNIC support, configuration, and troubleshooting.

First Installation

Prerequisites

  • Download latest Napatech drivers and untar into /opt/napatech3
  • Build the Napatech driver according to vendor documentation
  • Install required development libraries

Build Steps

# Clone the sniffer source
cd /usr/src
git clone -b develop https://github.com/voipmonitor/sniffer.git
cd sniffer

# Configure with Napatech library paths
./configure --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib

# Install missing dependencies if configure reports errors, then run make
make

Note: The development branch is named develop (NOT "development"). Use git checkout develop to switch to it.

If you already have the repository cloned and want to switch to the develop branch:

cd /usr/src/sniffer
git fetch origin
git checkout develop
git pull

Verify Build

Check that voipmonitor is linked against Napatech's libpcap:

ldd ./voipmonitor | grep pcap

Expected output:

libpcap.so.1 => /opt/napatech3/lib/libpcap.so.1 (0x00007fc0b69b0000)

Install and Run

# Replace original binary
cp ./voipmonitor /usr/local/sbin/voipmonitor

# Restart the service
systemctl restart voipmonitor

Upgrade

GUI Upgrade (v24.23+)

From sensor version 24.23, you can perform upgrades via the GUI using the upgrade_by_git option. The configure_param option ensures the Makefile is created with appropriate includes/libs.

Add these options to /etc/voipmonitor.conf:

upgrade_by_git = yes
git_folder = /usr/src/sniffer
configure_param = --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib

After restarting the sniffer, click UPGRADE in the GUI. The sniffer will automatically perform: git pull → configure → make clean → make → stop → make install → start.

Manual Upgrade

cd /usr/src/sniffer
git checkout develop
git pull
./configure --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib
make
make install
systemctl restart voipmonitor

Napatech Driver Configuration

VoIPmonitor Configuration

In /etc/voipmonitor.conf:

interface = napa0

# IMPORTANT: BPF filter option must be commented out!
#filter = udp or (vlan and udp)

ntpcap.ini Configuration

File: /opt/napatech3/config/ntpcap.ini

[Common]
Ntpl1 = "Assign[streamid=0;txport=0;txignore=true]=all"

[napa0]
StreamId = 0
Tx = 0

For older Napatech driver versions:

[napa0]
Rx1="Assign[streamid=252;txport=0;txignore=true]=all"
Tx=0

ntservice.ini Configuration

File: /opt/napatech3/config/ntservice.ini

[System]
TimestampFormat = NATIVE_UNIX
TimestampMethod = EOF
HostBufferWaitMethod = 0
SDRAMFillLevelWarning = 0

[logging]
LogMask = 0x07
LogToFile = 0
LogFileName = /tmp/Log3G_%s.log
LogBufferWrap = wrap

[Adapter0]
AdapterType = NT4E
BusId = 00:07:00:00
PacketDescriptor = NT
HostBuffersRx = [8,16,0]
HostBuffersTx = [8,16,0]
TimeSyncProtocol = NT
TimeSyncConnectorIn = Ext
TimeSyncConnectorOut = None
TimeSyncConnectorRepeat = None
TimeSyncTimeJumpThreshold = 1
TimeSyncTimeOffset = 0
MaxFrameSize = 9018
AltTPID = 0x8100
Profile = Capture
DiscardSize = 16
OsTimeSyncFailover = DISABLE

Time Source Configuration

By default, Napatech uses GMT timestamps. To use system time instead:

For newer Napatech drivers:

TimesynConnectorExt1 = None
TimeSyncReferencePriority = OSTime

Alternative for older drivers:

# For GMT (external PPS):
TimeSyncConnectorExt1 = PpsIn

# For system-dependent time:
TimeSyncConnectorExt1 = NttsIn

Tip: If spool directories are created with incorrect dates (e.g., 1970-01-01), see troubleshooting section below.

Systemd Service Configuration

You need to ensure Napatech drivers (ntservice) start before VoIPmonitor. See systemd service file configuration for adding:

After=ntservice.service
Requires=ntservice.service

Traffic Filtering on Napatech Card

To filter traffic directly on the Napatech card, create an NTPL filter file.

Example: /opt/napatech3/myfilter.ntpl

# Start NTPL
# Delete all existing filter
delete = all

# Setup UDP macros
DefineMacro("mUdpSrcPort", "Data[DynOffset=DynOffUDPFrame;Offset=0;DataType=ByteStr2]")
DefineMacro("mUdpDestPort", "Data[DynOffset=DynOffUDPFrame;Offset=2;DataType=ByteStr2]")

# Setup filters
# SIP filter (ports 5060, 5061)
Assign[StreamId = 0] = (mUdpSrcPort == 5060, 5061) AND (mUdpDestPort == 5060, 5061)
# RTP filter (ports 10000-61743 in HEX)
Assign[StreamId = 0] = (mUdpSrcPort == (0x2710..0xF12F))
Assign[StreamId = 1] = (mUdpSrcPort == 5060, 5061) AND (mUdpDestPort == 5060, 5061)
Assign[StreamId = 1] = (mUdpSrcPort == (0x2710..0xF12F))
Assign[StreamId = 2] = (mUdpSrcPort == 5060, 5061) AND (mUdpDestPort == 5060, 5061)
Assign[StreamId = 2] = (mUdpSrcPort == (0x2710..0xF12F))
Assign[StreamId = 3] = (mUdpSrcPort == 5060, 5061) AND (mUdpDestPort == 5060, 5061)
Assign[StreamId = 3] = (mUdpSrcPort == (0x2710..0xF12F))
# End NTPL

# Enable Deduplication
DeduplicationConfig[drop=duplicate] = GroupID == 0
Define ckRecipe = CorrelationKey(Begin=StartOfFrame[0], End=EndOfFrame[0], DeduplicationGroupID=0)
Assign[StreamID=0,1,2,3; CorrelationKey=ckRecipe] = Port == 0,1,2,3

Apply the filter:

/opt/napatech3/bin/ntstart.sh -n myfilter.ntpl

Troubleshooting

Spool Directories with Date 1970-01-01

If spool directories are created with incorrect timestamps (e.g., 1970-01-01), the Napatech card is providing Unix Epoch time instead of actual system time.

Solution:

1. Edit /opt/napatech3/config/ntservice.ini

2. For newer drivers, add:

timeSource = OS

For older drivers, in the [Adapter0] section:

OsTimeSyncFailover = ENABLE

3. Restart services:

systemctl stop ntservice
systemctl start ntservice
systemctl restart voipmonitor

4. Verify fix:

ls -ltd /var/spool/voipmonitor/*

Napatech Interfaces in DOWN State

If tcpdump or tshark show no packets on Napatech interfaces:

1. Check interface status:

ip link show napa0
ip link show | grep napa

2. Verify drivers are loaded:

lsmod | grep ntpcap
systemctl status ntservice

3. Verify voipmonitor uses Napatech libpcap:

ldd /usr/local/sbin/voipmonitor | grep pcap

Expected output should show /opt/napatech3/lib/libpcap.so.1, NOT system libpcap.

4. If using system libpcap, rebuild voipmonitor:

cd /usr/src/sniffer
git pull
./configure --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib
make
make install
systemctl restart voipmonitor

Drivers Not Capturing Traffic

Symptoms:

  • GUI shows no calls
  • tshark -i napa0 shows no packets
  • Interfaces are UP but not receiving data

Solution: Restart Napatech drivers:

systemctl stop voipmonitor
cd /opt/napatech3/bin/
./ntstop
./ntstart
systemctl start voipmonitor

Verify traffic capture:

tshark -i napa0 -Y "sip || rtp" -n -c 10

If issues persist, check logs:

journalctl -u ntservice -n 50
tail -f /tmp/Log3G_*.log

Compilation Errors with DPDK Headers

If compilation fails with errors like RTE_ETH_MQ_TX_NONE was not declared, system DPDK libraries are conflicting with Napatech SDK.

Solution: Disable DPDK support in config.h:

# Run configure first
./configure --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib

# Edit config.h - change:
#define HAVE_LIBDPDK 1
# To:
#define HAVE_LIBDPDK 0

# Then compile
make

Service Startup Order (init.d)

If VoIPmonitor fails with libpcap error no such device exists after upgrade, Napatech drivers may not be initialized when VoIPmonitor starts.

For init.d systems: Edit /etc/init.d/voipmonitor and add before voipmonitor binary execution:

/opt/napatech3/bin/ntstart.sh
sleep 60

For systemd systems: Add to the service unit file:

After=ntservice.service
Requires=ntservice.service

See systemd documentation for details.

AI Summary for RAG

Summary: Guide for building VoIPmonitor sniffer with Napatech SmartNIC support. Build process: clone source with git clone -b develop, configure with --with-dpdk-include=/opt/napatech3/include --with-dpdk-lib=/opt/napatech3/lib, and make. For GUI upgrades (v24.23+), set upgrade_by_git=yes and configure_param in voipmonitor.conf. Configuration requires: interface=napa0 in voipmonitor.conf (BPF filter must be disabled), ntpcap.ini for stream assignment, ntservice.ini for adapter settings. Time source configuration: set timeSource=OS for system time. Troubleshooting covers: 1970-01-01 spool directories (time source misconfiguration), interfaces in DOWN state (requires Napatech libpcap), drivers not capturing (restart with ntstop/ntstart), DPDK compilation errors (set HAVE_LIBDPDK=0 in config.h), service startup order (add ntservice dependency).

Keywords: Napatech, SmartNIC, compilation, configure, upgrade_by_git, configure_param, ntpcap.ini, ntservice.ini, timeSource, 1970-01-01, NTPL filter, libpcap, ntstop, ntstart, HAVE_LIBDPDK, systemd, init.d

Key Questions:

  • How do I compile VoIPmonitor with Napatech support?
  • What configure options are needed for Napatech?
  • How do I upgrade VoIPmonitor with Napatech via GUI?
  • Why are spool directories created with date 1970-01-01?
  • How do I fix Napatech interfaces in DOWN state?
  • VoIPmonitor not capturing calls with Napatech, how to fix?
  • How do I restart Napatech drivers?
  • How to fix RTE_ETH_MQ_TX_NONE compilation error?
  • How to configure Napatech driver dependency in systemd?
  • What does libpcap error no such device exists mean?