Skip to content

Commit

Permalink
Add tcpdump to mx-rdma-tools and rdma-tools Docker images
Browse files Browse the repository at this point in the history
- Add `install-tcpdump.sh` to build and install tcpdump and libpcap from source.

Signed-off-by: lou-lan <[email protected]>
  • Loading branch information
lou-lan committed Feb 25, 2025
1 parent ef2f160 commit 7ecbfe9
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 2 deletions.
6 changes: 6 additions & 0 deletions mx-rdma-tools/image/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ ARG DEBIAN_FRONTEND=noninteractive
COPY /install-perftest.sh /install-perftest.sh
RUN chmod +x /install-perftest.sh && /install-perftest.sh

# build tcpdump
ENV ENV_VERSION_LIBCAP=<<ENV_VERSION_LIBCAP>>
ENV ENV_VERSION_TCPDUMP=<<ENV_VERSION_TCPDUMP>>
COPY /install-tcpdump.sh /install-tcpdump.sh
RUN chmod +x /install-tcpdump.sh && /install-tcpdump.sh

# install hpcx and nccltest
ENV ENV_DOWNLOAD_HPCX_URL=<<ENV_DOWNLOAD_HPCX_URL>>
ENV ENV_VERSION_NCCLTEST=<<ENV_VERSION_NCCLTEST>>
Expand Down
2 changes: 2 additions & 0 deletions mx-rdma-tools/image/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ ENV_LOCAL_NODE_IP
ENV_BASEIMAGE_CUDA_VERISON
ENV_BASEIMAGE_OS_VERISON
ENV_VERSION_PERFTEST
ENV_VERSION_LIBCAP
ENV_VERSION_TCPDUMP
ENV_VERSION_NCCLTEST
ENV_VERSION_HPCX
LD_LIBRARY_PATH
Expand Down
4 changes: 4 additions & 0 deletions mx-rdma-tools/image/generateDockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export ENV_LD_LIBRARY_PATH="/usr/local/cuda-12.5/compat:/usr/lib/x86_64-linux-gn
# https://github.com/linux-rdma/perftest
export ENV_VERSION_PERFTEST=${ENV_VERSION_PERFTEST:-"24.04.0-0.41"}

# https://www.tcpdump.org/release
export ENV_VERSION_LIBCAP=${ENV_VERSION_LIBCAP:-"libpcap-1.10.5"}
export ENV_VERSION_TCPDUMP=${ENV_VERSION_TCPDUMP:-"tcpdump-4.99.5"}

# https://github.com/NVIDIA/nccl-tests/tags
export ENV_VERSION_NCCLTEST=${ENV_VERSION_NCCLTEST:-"v2.13.10"}

Expand Down
59 changes: 59 additions & 0 deletions mx-rdma-tools/image/install-tcpdump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

# Copyright 2024 Authors of spidernet-io
# SPDX-License-Identifier: Apache-2.0

set -x
set -o xtrace
set -o errexit
set -o pipefail
set -o nounset

echo "build libpcap ${ENV_VERSION_LIBCAP}"
echo "build tcpdump ${ENV_VERSION_TCPDUMP}"

cd /tmp
rm -rf * || true

apt-get update
apt-get install -y --no-install-recommends bison make gcc flex xz-utils


#!/bin/bash

# Check if environment variables are defined
if [ -z "${ENV_VERSION_LIBCAP}" ] || [ -z "${ENV_VERSION_TCPDUMP}" ]; then
echo "Environment variables ENV_VERSION_LIBCAP or ENV_VERSION_TCPDUMP are not defined"
exit 1
fi

# Download files
wget -q https://www.tcpdump.org/release/${ENV_VERSION_LIBCAP}.tar.xz || { echo "Failed to download libcap"; exit 1; }
wget -q https://www.tcpdump.org/release/${ENV_VERSION_TCPDUMP}.tar.xz || { echo "Failed to download tcpdump"; exit 1; }


echo "========================"
echo "========================"
echo "========================"
ls -lh

# Check if files exist
if [ ! -f "${ENV_VERSION_LIBCAP}.tar.xz" ] || [ ! -f "${ENV_VERSION_TCPDUMP}.tar.xz" ]; then
echo "Downloaded files do not exist"
exit 1
fi

# Extract files
tar -xvf ${ENV_VERSION_LIBCAP}.tar.xz || { echo "Failed to extract libcap"; exit 1; }
tar -xvf ${ENV_VERSION_TCPDUMP}.tar.xz || { echo "Failed to extract tcpdump"; exit 1; }

cd /tmp/${ENV_VERSION_LIBCAP}
./configure
make && make install

cd /tmp/${ENV_VERSION_TCPDUMP}
./configure
make && make install

cd /tmp
rm -rf * || true
1 change: 0 additions & 1 deletion mx-rdma-tools/image/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ packages=(
hwloc
libgomp1
kmod
tcpdump
ethtool
iptables
#--------------
Expand Down
6 changes: 6 additions & 0 deletions rdma-tools/image/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ ARG DEBIAN_FRONTEND=noninteractive
COPY /install-perftest.sh /install-perftest.sh
RUN chmod +x /install-perftest.sh && /install-perftest.sh

# build tcpdump
ENV ENV_VERSION_LIBCAP=<<ENV_VERSION_LIBCAP>>
ENV ENV_VERSION_TCPDUMP=<<ENV_VERSION_TCPDUMP>>
COPY /install-tcpdump.sh /install-tcpdump.sh
RUN chmod +x /install-tcpdump.sh && /install-tcpdump.sh

# install hpcx and nccltest
ENV ENV_DOWNLOAD_HPCX_URL=<<ENV_DOWNLOAD_HPCX_URL>>
ENV ENV_VERSION_NCCLTEST=<<ENV_VERSION_NCCLTEST>>
Expand Down
2 changes: 2 additions & 0 deletions rdma-tools/image/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ ENV_LOCAL_NODE_IP
ENV_BASEIMAGE_CUDA_VERISON
ENV_BASEIMAGE_OS_VERISON
ENV_VERSION_PERFTEST
ENV_VERSION_LIBCAP
ENV_VERSION_TCPDUMP
ENV_VERSION_NCCLTEST
ENV_VERSION_HPCX
LD_LIBRARY_PATH
Expand Down
4 changes: 4 additions & 0 deletions rdma-tools/image/generateDockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export ENV_VERSION_PERFTEST=${ENV_VERSION_PERFTEST:-"24.04.0-0.41"}
# https://github.com/NVIDIA/nccl-tests/tags
export ENV_VERSION_NCCLTEST=${ENV_VERSION_NCCLTEST:-"v2.13.10"}

# https://www.tcpdump.org/release
export ENV_VERSION_LIBCAP=${ENV_VERSION_LIBCAP:-"libpcap-1.10.5"}
export ENV_VERSION_TCPDUMP=${ENV_VERSION_TCPDUMP:-"tcpdump-4.99.5"}

# https://developer.nvidia.com/networking/hpc-x
export ENV_VERSION_HPCX=${ENV_VERSION_HPCX:-"v2.19"}
export ENV_DOWNLOAD_HPCX_URL="https://content.mellanox.com/hpc/hpc-x/${ENV_VERSION_HPCX}/hpcx-${ENV_VERSION_HPCX}-gcc-mlnx_ofed-${ENV_BASEIMAGE_OS_VERISON}-cuda12-x86_64.tbz"
Expand Down
32 changes: 32 additions & 0 deletions rdma-tools/image/install-tcpdump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# Copyright 2024 Authors of spidernet-io
# SPDX-License-Identifier: Apache-2.0

set -x
set -o xtrace
set -o errexit
set -o pipefail
set -o nounset

echo "build libpcap ${ENV_VERSION_LIBCAP}"
echo "build tcpdump ${ENV_VERSION_TCPDUMP}"

cd /tmp
rm -rf * || true

apt-get update
apt-get install -y --no-install-recommends bison make gcc flex xz-utils

wget https://www.tcpdump.org/release/${ENV_VERSION_LIBCAP}.tar.xz
wget https://www.tcpdump.org/release/${ENV_VERSION_TCPDUMP}.tar.xz

tar -xvf ${ENV_VERSION_LIBCAP}.tar.xz
cd /tmp/${ENV_VERSION_LIBCAP}
./configure
make && make install

tar -xvf ${ENV_VERSION_TCPDUMP}.tar.xz
cd /tmp/${ENV_VERSION_TCPDUMP}
./configure
make && make install
1 change: 0 additions & 1 deletion rdma-tools/image/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ packages=(
hwloc
libgomp1
kmod
tcpdump
ethtool
iptables
#--------------
Expand Down

0 comments on commit 7ecbfe9

Please sign in to comment.