p4_testbed/scripts/10-host_notes.sh
2024-12-23 16:45:18 +01:00

109 lines
4.7 KiB
Bash

#!/bin/bash
# ncs-node1: enp6s0f0np0 / enp6s0f1np1
# - Control:
# - enp4s0f2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
# - Data:
# - enp6s0f0np0 | 10.0.1.1 | 64:9d:99:b1:0a:88 | tb_node1_if0 | 32/2 | 266
# - enp6s0f1np1 | 10.0.1.2 | 64:9d:99:b1:0a:89 | tb_node1_if1 | 32/3 | 267
# - enp6s0f2np2 | 10.0.1.3 | 64:9d:99:b1:0a:8a | tb_node1_if2 | 32/1 | 265
# - enp6s0f3np3 | 10.0.1.4 | 64:9d:99:b1:0a:8b | tb_node1_if3 | 32/0 | 264
#
# ncs-node2:
# - Control:
# - enp4s0f2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
# - Data:
# - enp6s0f0np0 | 10.0.2.1 | 64:9d:99:b1:0a:a4 | tb_node2_if0 | 31/0 | 256
# - enp6s0f1np1 | 10.0.2.2 | 64:9d:99:b1:0a:a5 | tb_node2_if1 | 31/3 | 259
# - enp6s0f2np2 | 10.0.2.3 | 64:9d:99:b1:0a:a6 | tb_node2_if2 | 31/1 | 257
# - enp6s0f3np3 | 10.0.2.4 | 64:9d:99:b1:0a:a7 | tb_node2_if3 | 31/2 | 258
#
# ncs-wedge:
# PORT |MAC |D_P|P/PT|SPEED |FEC |AN|KR|RDY|ADM|OPR|LPBK |FRAMES RX |FRAMES TX |E
# 31/0 |48/0|256|2/ 0|10G |NONE|Ds|Au|YES|ENB|UP | NONE | 62| 0|
# 31/1 |48/1|257|2/ 1|10G |NONE|Ds|Au|YES|ENB|UP | NONE | 62| 0|
# 31/2 |48/2|258|2/ 2|10G |NONE|Ds|Au|YES|ENB|UP | NONE | 62| 0|
# 31/3 |48/3|259|2/ 3|10G |NONE|Ds|Au|YES|ENB|UP | NONE | 62| 0|
# 32/0 |50/0|264|2/ 8|10G |NONE|Ds|Au|YES|ENB|UP | NONE | 62| 0|
# 32/1 |50/1|265|2/ 9|10G |NONE|Ds|Au|YES|ENB|UP | NONE | 62| 0|
# 32/2 |50/2|266|2/10|10G |NONE|Ds|Au|YES|ENB|UP | NONE | 65| 0|
# 32/3 |50/3|267|2/11|10G |NONE|Ds|Au|YES|ENB|UP | NONE | 65| 0|
# node1
# Create Namespace: Testbed on Node1 for Interface n
sudo ip netns add tb_node1_if0
sudo ip netns add tb_node1_if1
sudo ip netns add tb_node1_if2
sudo ip netns add tb_node1_if3
# Add interfaces to namespaces
sudo ip link set enp6s0f0np0 netns tb_node1_if0
sudo ip link set enp6s0f1np1 netns tb_node1_if1
sudo ip link set enp6s0f2np2 netns tb_node1_if2
sudo ip link set enp6s0f3np3 netns tb_node1_if3
# Show Info
sudo ip netns exec tb_node1_if0 ip a s enp6s0f0np0
sudo ip netns exec tb_node1_if1 ip a s enp6s0f1np1
sudo ip netns exec tb_node1_if2 ip a s enp6s0f2np2
sudo ip netns exec tb_node1_if3 ip a s enp6s0f3np3
# Set IP Addresses
sudo ip netns exec tb_node1_if0 ip addr add dev enp6s0f0np0 10.0.1.1/16
sudo ip netns exec tb_node1_if1 ip addr add dev enp6s0f1np1 10.0.1.2/16
sudo ip netns exec tb_node1_if2 ip addr add dev enp6s0f2np2 10.0.1.3/16
sudo ip netns exec tb_node1_if3 ip addr add dev enp6s0f3np3 10.0.1.4/16
# Turn on Links
sudo ip netns exec tb_node1_if0 ip link set up enp6s0f0np0
sudo ip netns exec tb_node1_if1 ip link set up enp6s0f1np1
sudo ip netns exec tb_node1_if2 ip link set up enp6s0f2np2
sudo ip netns exec tb_node1_if3 ip link set up enp6s0f3np3
sudo ./11-host_arps.sh tb_node1_if0 enp6s0f0np0
sudo ./11-host_arps.sh tb_node1_if1 enp6s0f1np1
sudo ./11-host_arps.sh tb_node1_if2 enp6s0f2np2
sudo ./11-host_arps.sh tb_node1_if3 enp6s0f3np3
# node2
# Create Namespace: Testbed on Node1 for Interface n
sudo ip netns add tb_node2_if0
sudo ip netns add tb_node2_if1
sudo ip netns add tb_node2_if2
sudo ip netns add tb_node2_if3
# Add interfaces to namespaces
sudo ip link set enp6s0f0np0 netns tb_node2_if0
sudo ip link set enp6s0f1np1 netns tb_node2_if1
sudo ip link set enp6s0f2np2 netns tb_node2_if2
sudo ip link set enp6s0f3np3 netns tb_node2_if3
# Show Info
sudo ip netns exec tb_node2_if0 ip a s enp6s0f0np0
sudo ip netns exec tb_node2_if1 ip a s enp6s0f1np1
sudo ip netns exec tb_node2_if2 ip a s enp6s0f2np2
sudo ip netns exec tb_node2_if3 ip a s enp6s0f3np3
# Set IP Addresses
sudo ip netns exec tb_node2_if0 ip addr add dev enp6s0f0np0 10.0.2.1/16
sudo ip netns exec tb_node2_if1 ip addr add dev enp6s0f1np1 10.0.2.2/16
sudo ip netns exec tb_node2_if2 ip addr add dev enp6s0f2np2 10.0.2.3/16
sudo ip netns exec tb_node2_if3 ip addr add dev enp6s0f3np3 10.0.2.4/16
# Turn on Links
sudo ip netns exec tb_node2_if0 ip link set up enp6s0f0np0
sudo ip netns exec tb_node2_if1 ip link set up enp6s0f1np1
sudo ip netns exec tb_node2_if2 ip link set up enp6s0f2np2
sudo ip netns exec tb_node2_if3 ip link set up enp6s0f3np3
# execute arp
sudo ./11-host_arps.sh tb_node2_if0 enp6s0f0np0
sudo ./11-host_arps.sh tb_node2_if1 enp6s0f1np1
sudo ./11-host_arps.sh tb_node2_if2 enp6s0f2np2
sudo ./11-host_arps.sh tb_node2_if3 enp6s0f3np3
# Show arp
sudo ip netns exec tb_node2_if0 ip a s enp6s0f0np0
sudo ip netns exec tb_node2_if1 ip a s enp6s0f1np1
sudo ip netns exec tb_node2_if2 ip a s enp6s0f2np2
sudo ip netns exec tb_node2_if3 ip a s enp6s0f3np3