3b24dea6fd6ceb6fcf990185ecb2588443ee8986
[vpp.git] / src / plugins / srv6-mobile / extra / README.md
1 # What's `runner.py` doing?
2
3 ## Common configurations
4
5 ### VPP1
6 ```
7 create host-interface name eth1
8 set int ip addr host-eth1 A1::1/120
9 set int state host-eth1 up
10 ip route add ::/0 via host-eth1 A1::2
11 ```
12
13
14 ### VPP2
15
16 ```
17 create host-interface name eth1
18 set int ip addr host-eth1 A1::2/120
19 create host-interface name eth2
20 set int ip addr host-eth2 A2::1/120
21 set int state host-eth1 up
22 set int state host-eth2 up
23 ip route add ::/0 via host-eth2 A2::2
24 ```
25
26
27 ### VPP3
28
29 ```
30 create host-interface name eth1
31 set int ip addr host-eth1 A2::2/120
32 create host-interface name eth2
33 set int ip addr host-eth2 A3::1/120
34 set int state host-eth1 up
35 set int state host-eth2 up
36 ip route add ::/0 via host-eth1 A2::1
37 ```
38
39 ### VPP4
40
41 ```
42 create host-interface name eth1
43 set int ip addr host-eth1 A3::2/120
44 set int state host-eth1 up
45 ip route add ::/0 via host-eth1 A3::1
46 ```
47
48
49 ## Drop-in for GTP-U over IPv4
50
51 What's happened when you run `test tmap`:
52
53     $ ./runner.py test tmap
54
55
56 Setting up a virtual interface of packet generator:
57
58 #### VPP1
59
60 ```
61 create packet-generator interface pg0
62 set int mac address pg0 aa:bb:cc:dd:ee:01
63 set int ip addr pg0 172.16.0.1/30
64 set ip arp pg0 172.16.0.2/30 aa:bb:cc:dd:ee:02
65 ```
66
67 #### VPP4
68
69 ```
70 create packet-generator interface pg0
71 set int mac address pg0 aa:bb:cc:dd:ee:11
72 set int ip addr pg0 1.0.0.2/30
73 set ip arp pg0 1.0.0.1 aa:bb:cc:dd:ee:22
74 ```
75
76 SRv6 and IP routing settings:
77
78 #### VPP1
79
80 ```
81 sr policy add bsid D1:: next D2:: next D3:: gtp4_removal sr_prefix D4::/32 v6src_prefix C1::/64
82 sr steer l3 172.20.0.1/32 via bsid D1::
83
84 ```
85
86 #### VPP2
87
88 ```
89 sr localsid address D2:: behavior end
90 ip route add D3::/128 via host-eth2 A2::2
91 ```
92
93 #### VPP3
94
95 ```
96 sr localsid address D3:: behavior end
97 ip route add D4::/32 via host-eth2 A3::2
98 ```
99
100 #### VPP4
101
102 ```
103 sr localsid prefix D4::/32 behavior end.m.gtp4.e v4src_position 64
104 ip route add 172.20.0.1/32 via pg0 1.0.0.1
105 ```
106
107
108
109
110 ## Packet generator and testing
111
112     Example how to build custom SRv6 packet in scapy and ipaddress pkgs
113
114     s = '\x11' * 4 + IPv4Address(u"192.168.192.10").packed + '\x11' * 8
115     ip6 = IPv6Address(s)
116     IPv6(dst=ip6, src=ip6)
117
118
119 ## end.m.gtp4.e
120
121     First set behavior so our localsid node is called with the packet
122     matching C1::1 in fib table
123     sr localsid address C1::1 behavior end.m.gtp4.ess
124
125     show sr localsids behaviors
126     show sr localsid
127
128     We should send a well formated packet to C::1 destination address
129     that contains the correct spec as for end.m.gtp4.e with encapsulated
130     ipv4 src and dst address and teid with port for the conversion to
131     GTPU IPv4 packet
132
133
134 ## additional commands
135
136     gdb - breakpoint
137
138     break sr_policy_rewrite.c:1620
139
140     break src/plugins/srv6-end/node.c:84
141
142     TMAP
143     Linux:
144
145     ip link add tmp1 type veth peer name tmp2
146     ip link set dev tmp1 up
147     ip link set dev tmp2 up
148     ip addr add 172.20.0.2/24 dev tmp2
149
150     create host-interface name tmp1
151     set int mac address host-tmp1 02:fe:98:c6:c8:7b
152     set interface ip address host-tmp1 172.20.0.1/24
153     set interface state host-tmp1 up
154
155     VPP
156     set sr encaps source addr C1::
157     sr policy add bsid D1::999:2 next D2:: next D3:: gtp4_removal sr-prefix fc34:5678::/64 local-prefix C1::/64
158     sr steer l3 172.21.0.0/24 via bsid d1::999:2
159
160     END
161     Linux
162     create host-interface name tmp1
163     set int mac address host-tmp1 02:fe:98:c6:c8:7b
164     set interface ip address host-tmp1 A1::1/64
165     set interface state host-tmp1 up
166
167     VPP
168     sr localsid address 1111:1111:c0a8:c00a:1122:1111:1111:1111 behavior end.m.gtp4.e
169
170     trace add af-packet-input 10
171
172     sr localsid address C3:: behavior end.m.gtp4.e
173     sr localsid address 2001:200:0:1ce1:3000:757f:0:2 behavior end.m.gtp4.e