summaryrefslogtreecommitdiffstats
path: root/tests/conntrackd/netns/ruleset-nsr1.nft
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2020-12-24 13:03:21 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2020-12-27 11:46:01 +0100
commit7f1fb5dad90f04caa94f4fcefd1340aeb2c2f0e3 (patch)
tree24ffd73b49c176c57e88c9bb311b84dd944b2610 /tests/conntrackd/netns/ruleset-nsr1.nft
parentb031cd2102d9bc2b6ce20a880068022fac9e2d87 (diff)
conntrackd: add ip netns test script
This patch adds a script that creates a ip netns testbed. The network topology looks like this: veth0---veth0 host nsr1 ns2 veth0----veth0 ns1 veth2 | veth0 nsr2 * ns1 and ns2 are clients to generate traffic * nsr1 and nsr2 run conntrackd to synchronize states * nsr1 is the primary gateway - veth2 is used to synchronize states * nsr2 is the backup gateway - veth0 is used to synchronize states To set up the testbed: % sudo ./conntrackd-netns-test.sh start To test your testbed works, from ns2: % sudo ip netns exec ns2 nc -l -p 8080 From ns1: % sudo ip netns exec ns1 nc -vvv 10.0.1.2 8080 From nsr1: % sudo ip netns exec nsr1 conntrackd -s -C conntrackd-nsr1.conf cache internal: current active connections: 1 [...] cache external: current active connections: 0 From nsr2: % sudo ip netns exec nsr1 conntrackd -s -C conntrackd-nsr2.conf cache internal: current active connections: 0 [...] cache external: current active connections: 1 To stop it: % sudo ./conntrackd-netns-test.sh stop Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/conntrackd/netns/ruleset-nsr1.nft')
-rw-r--r--tests/conntrackd/netns/ruleset-nsr1.nft6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/conntrackd/netns/ruleset-nsr1.nft b/tests/conntrackd/netns/ruleset-nsr1.nft
new file mode 100644
index 0000000..bd6f1b4
--- /dev/null
+++ b/tests/conntrackd/netns/ruleset-nsr1.nft
@@ -0,0 +1,6 @@
+table ip filter {
+ chain postrouting {
+ type nat hook postrouting priority srcnat; policy accept;
+ oif veth0 masquerade
+ }
+}