Author | Chieh-Ting Chung |
---|---|
sksksk1748@gmail.com |
- P4 , Source_routing
- h1 的 packet 要送到 h2。但特別之處在於,Ethernet header 跟 IP header 中間加入了自己設計的 header,使用這個 header 與自己設計的 rule, 使 packet 能按照特殊 header 裡的 label(port) 決定 packet 傳送路線。
- Use the
port
field in headersrcRoute_t
as a label for label routing - Modify the parser
- Define to actions
label_output
: match the label and forward the packet to the portpop_label_output
: remove headersrcRoute_t
and output to the port
- Create a table for label routing (
s1-runtime.json
,s2-runtime.json
) - Modify rules to forward the label
1
to h2
- I assume
Oracle VM VirtualBox
. You have to install - Copy the latest exercise
$ git clone https://github.com/p4lang/tutorials
source_routing
├── build/ #compile完才會產生
│ └── ...
├── logs/ #compile完才會產生
│ └── ...
├── pcaps/ #compile完才會產生
│ └── ...
├── solution/
│ └── ...
└── ...
- Add my github
P4
source filesource_routing.p4
,s1-runtime.json
,s2-runtime.json
ands3-runtime.json
to~/tutorials/exercises/source_routing/
- In your shell, run
$ make stop $ make clean $ make run
- You should now see a Mininet command prompt. Open two terminals for
h1
andh2
, respectivelymininet> xterm h1 h2
- Run
receive.py
in h2$ ./receive.py
- Run
sender.py
in h1$ ./send.py 10.0.2.2
- "Node:h1" key in
1
Type space separated port nums or "q" to quit: 1
-
h1 key in
1
-
- key in 的
1
,就是特殊 header 的 Label, 所以 table rule match 的 port, 其實就是這邊 key in 的1
--------------------------------------------------------------------------------- | Ethernet | Label = 自己輸入要輸入的 port number (command line 輸入), bos=1 | IP | ---------------------------------------------------------------------------------
- key in 的
-
-
h1 send h2 (出現下圖結果,表示 h2 成功收到 h1 的 packet)
-
檢查 packet 經過的 switch (使用
~source_routing/pcaps
裡的 Wireshark) -
可以看出
s1-eth1_out.pcap
跟s2-eth2_out.pcap
都有收到 Protocol 是0x1234
的 packet
- P4_lang/tutorials ... source_routing
- 【NTUST】 109.1 CS5146701 Lab2 , Pei-Li Sun PROFESSOR