Skip to content

Commit

Permalink
Have routers output tcpdump
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaseizinger committed Sep 13, 2023
1 parent a6cc6b9 commit 87bd67b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 27 deletions.
5 changes: 0 additions & 5 deletions hole-punching-tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,5 @@ RUN --mount=type=cache,target=./target \
mv ./target/x86_64-unknown-linux-musl/release/hole-punching-tests /usr/local/bin/hole-punching-tests

FROM alpine:3

ARG DEBIAN_FRONTEND=noninteractive
RUN --mount=type=cache,target=/var/cache/apk apk add nftables

COPY --from=builder /usr/local/bin/hole-punching-tests /usr/bin/hole-punching-tests

ENV RUST_BACKTRACE=1
8 changes: 2 additions & 6 deletions hole-punching-tests/router/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
FROM ubuntu:jammy
FROM debian:12-slim

ARG DEBIAN_FRONTEND=noninteractive
RUN --mount=type=cache,target=/var/cache/apt apt-get update && apt-get -y install iproute2 nftables ulogd2 jq

# Debugging tools
RUN --mount=type=cache,target=/var/cache/apt apt-get update && apt-get -y install tcpdump iputils-ping
RUN --mount=type=cache,target=/var/cache/apt apt-get update && apt-get -y install iproute2 nftables jq tcpdump

COPY *.sh /scripts/
RUN chmod +x /scripts/*.sh
COPY ulogd.conf /etc/ulogd.conf

ENTRYPOINT ["./scripts/run.sh"]
6 changes: 2 additions & 4 deletions hole-punching-tests/router/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

set -ex
set -e

ADDR_EXTERNAL=$(ip -json addr show eth1 | jq '.[0].addr_info[0].local' -r)
SUBNET_INTERNAL=$(ip -json addr show eth0 | jq '.[0].addr_info[0].local + "/" + (.[0].addr_info[0].prefixlen | tostring)' -r)
Expand All @@ -11,6 +11,4 @@ nft add rule ip nat postrouting ip saddr $SUBNET_INTERNAL oifname "eth1" snat $A

tc qdisc add dev eth1 root netem delay 50ms

tcpdump -i eth0 -n -w /dump.pcap &

ulogd
tcpdump -i eth1
12 changes: 0 additions & 12 deletions hole-punching-tests/router/ulogd.conf

This file was deleted.

0 comments on commit 87bd67b

Please sign in to comment.