2021-09-27 15:10:35 +02:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
#
|
|
|
|
# PASST - Plug A Simple Socket Transport
|
|
|
|
# for qemu/UNIX domain socket mode
|
|
|
|
#
|
|
|
|
# PASTA - Pack A Subtle Tap Abstraction
|
|
|
|
# for network namespace/tap device mode
|
|
|
|
#
|
|
|
|
# test/demo/pasta - Quick introduction to pasta
|
|
|
|
#
|
|
|
|
# Copyright (c) 2021 Red Hat GmbH
|
|
|
|
# Author: Stefano Brivio <sbrivio@redhat.com>
|
|
|
|
|
|
|
|
say This is a short introduction to
|
|
|
|
em pasta
|
|
|
|
say .
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
sleep 3
|
|
|
|
|
|
|
|
say Let's fetch the source
|
|
|
|
sleep 1
|
2022-09-13 06:35:23 +02:00
|
|
|
host cd __STATEDIR__
|
2022-07-15 07:21:41 +02:00
|
|
|
host git clone git://passt.top/passt
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 1
|
|
|
|
|
|
|
|
say and build it.
|
|
|
|
sleep 1
|
|
|
|
host cd passt
|
|
|
|
host make
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
say A quick look at the man page...
|
|
|
|
sleep 1
|
|
|
|
hostb man ./pasta.1
|
|
|
|
sleep 5
|
|
|
|
hostb /pasta
|
|
|
|
sleep 2
|
|
|
|
hostb n
|
|
|
|
sleep 2
|
|
|
|
hostb n
|
|
|
|
sleep 10
|
|
|
|
|
|
|
|
nl
|
2021-09-29 16:11:06 +02:00
|
|
|
say without PID, it will create a namespace.
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 3
|
2022-09-13 06:35:23 +02:00
|
|
|
passt cd __STATEDIR__/passt
|
2022-09-13 06:35:27 +02:00
|
|
|
passtb ./pasta -P pasta.pid
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 3
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
say For convenience, let's enter this namespace
|
|
|
|
nl
|
|
|
|
say from another terminal.
|
|
|
|
sleep 3
|
2022-09-13 06:35:27 +02:00
|
|
|
ns cd __STATEDIR__/passt
|
|
|
|
nsout TARGET_PID pgrep -P $(cat pasta.pid)
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 1
|
|
|
|
|
|
|
|
ns nsenter -t __TARGET_PID__ -U -n --preserve-credentials
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
say Now, we're ready to configure networking.
|
|
|
|
sleep 2
|
|
|
|
host q
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
2022-06-10 04:32:42 +02:00
|
|
|
ns ip link show
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 3
|
|
|
|
say Let's configure IPv4 first...
|
|
|
|
sleep 2
|
2022-07-21 13:56:26 +02:00
|
|
|
ns /sbin/dhclient -4 --no-pid
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2022-06-10 04:32:42 +02:00
|
|
|
ns ip addr show
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 5
|
|
|
|
|
|
|
|
nl
|
|
|
|
say SLAAC is already done, but we can also
|
|
|
|
nl
|
|
|
|
say get another address via DHCPv6.
|
|
|
|
sleep 3
|
2022-07-21 13:56:26 +02:00
|
|
|
ns /sbin/dhclient -6 --no-pid
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 3
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
say Let's try to communicate between host and namespace
|
|
|
|
sleep 2
|
|
|
|
nl
|
|
|
|
say ...there's no need to configure port forwarding,
|
|
|
|
nl
|
|
|
|
say pasta detects bound ports and forwards them.
|
|
|
|
sleep 3
|
|
|
|
|
2022-07-15 07:21:34 +02:00
|
|
|
nsb socat TCP6-LISTEN:31337,bind=[::1] STDOUT
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2022-07-15 07:21:34 +02:00
|
|
|
host echo "Hello from the host" | socat -u STDIN TCP6:[::1]:31337
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 5
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
say Now the other way around...
|
|
|
|
nl
|
|
|
|
say we can use a loopback address
|
2022-05-19 01:22:33 +02:00
|
|
|
sleep 2
|
2022-07-15 07:21:34 +02:00
|
|
|
hostb socat TCP6-LISTEN:31337,bind=[::1] STDIO
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2022-07-15 07:21:34 +02:00
|
|
|
ns echo "Hello from the namespace" | socat -u STDIN TCP6:[::1]:31337
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 5
|
|
|
|
|
|
|
|
nl
|
|
|
|
say or the address of the default gateway.
|
|
|
|
sleep 2
|
2022-06-10 04:32:42 +02:00
|
|
|
nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 5
|
2022-07-15 07:21:34 +02:00
|
|
|
hostb socat TCP4-LISTEN:31337 STDIO
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2022-07-15 07:21:34 +02:00
|
|
|
ns echo "Hello from the namespace" | socat -u STDIN TCP4:__GW__:31337
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 3
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
say UDP...
|
|
|
|
sleep 2
|
|
|
|
ns host -t A passt.top
|
|
|
|
sleep 3
|
|
|
|
say seems to work too.
|
|
|
|
sleep 3
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
em pasta
|
|
|
|
say can also take packet captures.
|
|
|
|
sleep 3
|
|
|
|
passt exit
|
|
|
|
sleep 2
|
2022-09-24 00:05:20 +02:00
|
|
|
passtb ./pasta -p ../demo_pasta.pcap
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
|
|
|
passt
|
2022-06-10 04:32:43 +02:00
|
|
|
passt /sbin/dhclient -4 --no-pid
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2022-09-24 00:05:20 +02:00
|
|
|
hostb tshark -r ../demo_pasta.pcap
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 5
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
say And there are tons of totally useless
|
|
|
|
sleep 1
|
|
|
|
bsp 14
|
|
|
|
say absolutely useful features
|
|
|
|
nl
|
|
|
|
say you can find described in the man page.
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
say Let's have a (quick!) look at performance
|
|
|
|
nl
|
|
|
|
say more in the "Performance" section below.
|
|
|
|
sleep 3
|
2022-02-28 02:50:25 +01:00
|
|
|
ns exit
|
2021-09-27 15:10:35 +02:00
|
|
|
passt exit
|
2022-03-01 21:32:08 +01:00
|
|
|
passt make clean
|
2022-02-28 16:18:44 +01:00
|
|
|
passt CFLAGS="-g" make
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2022-09-13 06:35:27 +02:00
|
|
|
passtb perf record -g ./pasta -P pasta.pid
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
|
|
|
|
2022-09-13 06:35:27 +02:00
|
|
|
nsout TARGET_PID pgrep -P $(cat pasta.pid)
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 1
|
|
|
|
ns nsenter -t __TARGET_PID__ -U -n --preserve-credentials
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
info Throughput in Gbps, latency in µs
|
|
|
|
th flow init>ns ns>init
|
|
|
|
|
|
|
|
set OPTS -P4 -l 1M -w 32M -i1 --pacing-timer 100000
|
|
|
|
|
|
|
|
tr TCP/IPv6 throughput
|
|
|
|
hostb sleep 10; iperf3 -c ::1 __OPTS__
|
|
|
|
nsout BW iperf3 -s1J | jq -rM ".end.sum_received.bits_per_second"
|
|
|
|
bw __BW__ 10.0 20.0
|
2021-10-15 20:45:16 +02:00
|
|
|
sleep 5
|
|
|
|
nsb sleep 10; iperf3 -c ::1 __OPTS__
|
|
|
|
hout BW iperf3 -s1J | jq -rM ".end.sum_received.bits_per_second"
|
|
|
|
bw __BW__ 10.0 20.0
|
2021-09-27 15:10:35 +02:00
|
|
|
|
|
|
|
tl TCP/IPv6 RR latency
|
2021-10-15 20:45:16 +02:00
|
|
|
nsb tcp_rr -6 --nolog
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2021-10-15 20:45:16 +02:00
|
|
|
hout LAT tcp_rr --nolog -c -H ::1 | sed -n 's/^throughput=\(.*\)/\1/p'
|
2021-09-27 15:10:35 +02:00
|
|
|
lat __LAT__ 1000 500
|
|
|
|
sleep 2
|
2021-10-15 20:45:16 +02:00
|
|
|
hostb tcp_rr -6 --nolog
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2021-10-15 20:45:16 +02:00
|
|
|
nsout LAT tcp_rr --nolog -c -H ::1 | sed -n 's/^throughput=\(.*\)/\1/p'
|
2021-09-27 15:10:35 +02:00
|
|
|
lat __LAT__ 1000 500
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
tl TCP/IPv6 CRR latency
|
2021-10-15 20:45:16 +02:00
|
|
|
nsb tcp_crr -6 --nolog
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2021-10-15 20:45:16 +02:00
|
|
|
hout LAT tcp_crr --nolog -c -H ::1 | sed -n 's/^throughput=\(.*\)/\1/p'
|
2021-09-27 15:10:35 +02:00
|
|
|
lat __LAT__ 1000 500
|
|
|
|
sleep 2
|
2021-10-15 20:45:16 +02:00
|
|
|
hostb tcp_crr -6 --nolog
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2021-10-15 20:45:16 +02:00
|
|
|
nsout LAT tcp_crr --nolog -c -H ::1 | sed -n 's/^throughput=\(.*\)/\1/p'
|
2021-09-27 15:10:35 +02:00
|
|
|
lat __LAT__ 1000 500
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
tr TCP/IPv4 throughput
|
|
|
|
hostb sleep 10; iperf3 -c 127.0.0.1 __OPTS__
|
|
|
|
nsout BW iperf3 -s1J | jq -rM ".end.sum_received.bits_per_second"
|
|
|
|
bw __BW__ 10.0 20.0
|
2021-10-15 20:45:16 +02:00
|
|
|
sleep 5
|
|
|
|
nsb sleep 10; iperf3 -c 127.0.0.1 __OPTS__
|
|
|
|
hout BW iperf3 -s1J | jq -rM ".end.sum_received.bits_per_second"
|
|
|
|
bw __BW__ 10.0 20.0
|
2021-09-27 15:10:35 +02:00
|
|
|
|
|
|
|
tl TCP/IPv4 RR latency
|
2021-10-15 20:45:16 +02:00
|
|
|
nsb tcp_rr -4 --nolog
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2021-10-15 20:45:16 +02:00
|
|
|
hout LAT tcp_rr --nolog -c -H 127.0.0.1 | sed -n 's/^throughput=\(.*\)/\1/p'
|
2021-09-27 15:10:35 +02:00
|
|
|
lat __LAT__ 1000 500
|
|
|
|
sleep 2
|
2021-10-15 20:45:16 +02:00
|
|
|
hostb tcp_rr -4 --nolog
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2021-10-15 20:45:16 +02:00
|
|
|
nsout LAT tcp_rr --nolog -c -H 127.0.0.1 | sed -n 's/^throughput=\(.*\)/\1/p'
|
2021-09-27 15:10:35 +02:00
|
|
|
lat __LAT__ 1000 500
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
tl TCP/IPv4 CRR latency
|
2021-10-15 20:45:16 +02:00
|
|
|
nsb tcp_crr -4 --nolog
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2021-10-15 20:45:16 +02:00
|
|
|
hout LAT tcp_crr --nolog -c -H 127.0.0.1 | sed -n 's/^throughput=\(.*\)/\1/p'
|
2021-09-27 15:10:35 +02:00
|
|
|
lat __LAT__ 1000 500
|
|
|
|
sleep 2
|
2021-10-15 20:45:16 +02:00
|
|
|
hostb tcp_crr -4 --nolog
|
2021-09-27 15:10:35 +02:00
|
|
|
sleep 2
|
2021-10-15 20:45:16 +02:00
|
|
|
nsout LAT tcp_crr --nolog -c -H 127.0.0.1 | sed -n 's/^throughput=\(.*\)/\1/p'
|
2021-09-27 15:10:35 +02:00
|
|
|
lat __LAT__ 1000 500
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
sleep 5
|
|
|
|
passt exit
|
|
|
|
sleep 2
|
|
|
|
killp PASST
|
|
|
|
killp HOST
|
|
|
|
sleep 2
|
|
|
|
nsb perf report -g --max-stack 3
|
|
|
|
sleep 10
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
say I
|
|
|
|
em knew
|
|
|
|
say it.
|
|
|
|
em syscalls
|
|
|
|
say .
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
nl
|
|
|
|
nl
|
|
|
|
say Thanks for watching!
|
|
|
|
sleep 5
|