1
|
#
|
2
|
# ns1 <-> nsr1 <-> nsr2 <-> ns2
|
3
|
#
|
4
|
ip netns add ns1
|
5
|
ip netns add nsr1
|
6
|
ip netns add nsr2
|
7
|
ip netns add ns2
|
8
|
|
9
|
ip link add veth0 netns nsr1 type veth peer name veth0 netns ns1
|
10
|
ip link add veth1 netns nsr1 type veth peer name veth1 netns nsr2
|
11
|
ip link add veth0 netns nsr2 type veth peer name veth0 netns ns2
|
12
|
|
13
|
ip -net nsr1 addr add 10.141.10.1/24 dev veth0
|
14
|
ip -net nsr1 addr add a010::1/64 dev veth0
|
15
|
ip -net nsr1 addr add b010::10/64 dev veth1
|
16
|
ip -net nsr1 link set up dev veth0
|
17
|
ip -net nsr1 link set up dev veth1
|
18
|
ip -net nsr1 link add name gtp0 type gtp role sgsn local ::0
|
19
|
ip -net nsr1 link set up dev gtp0
|
20
|
ip -net nsr1 ro add 10.141.11.0/24 dev gtp0
|
21
|
ip -net nsr1 ro add a011::/64 dev gtp0
|
22
|
|
23
|
ip -net nsr2 addr add 10.141.11.1/24 dev veth0
|
24
|
ip -net nsr2 addr add a011::1/64 dev veth0
|
25
|
ip -net nsr2 addr add b010::11/64 dev veth1
|
26
|
ip -net nsr2 link set up dev veth0
|
27
|
ip -net nsr2 link set up dev veth1
|
28
|
ip -net nsr2 link add name gtp0 type gtp role ggsn local ::0
|
29
|
ip -net nsr2 link set up dev gtp0
|
30
|
ip -net nsr2 ro add 10.141.10.0/24 dev gtp0
|
31
|
|
32
|
ip netns exec nsr1 sysctl net.ipv4.ip_forward=1 > /dev/null
|
33
|
ip netns exec nsr2 sysctl net.ipv4.ip_forward=1 > /dev/null
|
34
|
ip netns exec nsr1 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null
|
35
|
ip netns exec nsr2 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null
|
36
|
|
37
|
ip -net ns1 addr add 10.141.10.2/24 dev veth0
|
38
|
ip -net ns1 link set up dev veth0
|
39
|
ip -net ns1 ro add default via 10.141.10.1
|
40
|
|
41
|
ip -net ns2 addr add 10.141.11.2/24 dev veth0
|
42
|
ip -net ns2 link set up dev veth0
|
43
|
ip -net ns2 ro add default via 10.141.11.1
|
44
|
|
45
|
# ip netns exec nsr1 ./gtp-tunnel add gtp0 v0 1 ip 10.141.10.2 ip6 b010::11
|
46
|
# ip netns exec nsr2 ./gtp-tunnel add gtp0 v0 1 ip 10.141.10.2 ip6 b010::10
|
47
|
|
48
|
# for iperf3, adjust TCPMSS
|
49
|
ip netns exec nsr1 nft -f - <<EOF
|
50
|
flush ruleset
|
51
|
|
52
|
table ip x {
|
53
|
chain forward {
|
54
|
type filter hook forward priority 0
|
55
|
tcp flags syn tcp option maxseg size set rt mtu
|
56
|
counter
|
57
|
}
|
58
|
}
|
59
|
EOF
|
60
|
|
61
|
# ip netns exec ns2 iperf3 -s
|
62
|
# ip netns exec ns1 iperf3 -c 192.168.10.2 -n 100G
|