Commit d42cbdd4 authored by Binh Nguyen's avatar Binh Nguyen

Scripts to run OSPF6 v3 on a topology

parent 81743090
*.log
*.conf
Scripts to run Free Range Routing's OSPF on profile sripv6-v3 in PhantomNet (https://www.phantomnet.org/show-profile.php?uuid=dfcfe493-56a9-11e7-91c5-90e2ba22fee4)
------------------------------------------------------------------------------------
How to run? Everything is running on Node1.
1. Obtain interfaces information by: ./get_all_info.sh. Result is in net_info.sh
2. Add global IPv6 addresses to interfaces: ./add_global_ipv6.sh
3. Create and install configuration files for FRR's Zebra and OSPF6. The configuration is copied to /usr/local/etc/ on each node after running the command:
./create_all_zebra_conf.sh
./create_all_ospf_conf.sh
4. Run FRR on node 2, 3, 4:
./start_all_frr.sh
5. After several seconds, the routes are populated by OSPF. Check routes on node 2,3,4 using:
ip -6 route
6. Install default routes on the end hosts: node1 and node 5
./install_default_route_on_hosts.sh
6. Ping test from node 1 to 5:
ping6 <node 5's nete IPv6 address>
Other scripts:
--------------
1. kill_frr.sh: kill zebra and ospf deamons on a OSPF router.
2. start_frr.sh: start zebra and ospf deamons on a OSPF router.
3. zebra/ospf.log: log files of zebra and ospf.
4. other scripts are irrelevant, park here now for later use.
#!/bin/bash
source net_info.sh
SSH_SD="ssh -t -t"
DOMAIN=$(hostname | awk -F'.' '{print $2"."$3"."$4"."$5}')
#----------node1---------
echo "Add IPv6 addresses on node 1"
$SSH_SD "node1.$DOMAIN" "sudo ip -6 addr add $n1_a dev $n1_a_dev"
$SSH_SD "node1.$DOMAIN" "sudo ip -6 addr add $n1_lb dev lo"
#----------node2---------
echo "Add IPv6 addresses on node 2"
$SSH_SD "node2.$DOMAIN" "sudo ip -6 addr add $n2_a dev $n2_a_dev"
$SSH_SD "node2.$DOMAIN" "sudo ip -6 addr add $n2_b dev $n2_b_dev"
$SSH_SD "node2.$DOMAIN" "sudo ip -6 addr add $n2_c dev $n2_c_dev"
$SSH_SD "node2.$DOMAIN" "sudo ip -6 addr add $n2_lb dev lo"
#----------node3---------
echo "Add IPv6 addresses on node 3"
$SSH_SD "node3.$DOMAIN" "sudo ip -6 addr add $n3_b dev $n3_b_dev"
$SSH_SD "node3.$DOMAIN" "sudo ip -6 addr add $n3_d dev $n3_d_dev"
$SSH_SD "node3.$DOMAIN" "sudo ip -6 addr add $n3_e dev $n3_e_dev"
$SSH_SD "node3.$DOMAIN" "sudo ip -6 addr add $n3_lb dev lo"
#----------node4---------
echo "Add IPv6 addresses on node 4"
$SSH_SD "node4.$DOMAIN" "sudo ip -6 addr add $n4_d dev $n4_d_dev"
$SSH_SD "node4.$DOMAIN" "sudo ip -6 addr add $n4_c dev $n4_c_dev"
$SSH_SD "node4.$DOMAIN" "sudo ip -6 addr add $n4_lb dev lo"
#----------node5---------
echo "Add IPv6 addresses on node 5"
$SSH_SD "node5.$DOMAIN" "sudo ip -6 addr add $n5_e dev $n5_e_dev"
$SSH_SD "node5.$DOMAIN" "sudo ip -6 addr add $n5_lb dev lo"
#!/bin/bash
hn=$(hostname)
for i in 2 3 4
do
echo -e "\n========================="
echo "Create OSPF conf of node $i ..."
scp net_info.sh create_ospf_conf.sh node$i:~/ > /dev/null
ssh node$i "./create_ospf_conf.sh"
done
echo "DONE installing OSPF6 conf files on all nodes!"
exit 0
#!/bin/bash
hn=$(hostname)
for i in 2 3 4
do
echo -e "\n=========================="
echo "Create zebra conf of node $i ..."
scp net_info.sh create_zebra_conf.sh node$i:~/ > /dev/null
ssh node$i "./create_zebra_conf.sh"
done
echo "DONE installing Zebra conf files on all nodes!"
exit 0
#!/bin/bash
source net_info.sh
OSPF="ospf6d.conf"
ETC="/usr/local/etc/"
META="hostname ospf6d@plant\npassword zebra\nlog file ospf6.log\nservice advanced-vty\n!"
echo "!" > $OSPF
echo -e $META >> $OSPF
#NODE2
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node2" ]; then
echo "#Node $hn..."
echo "interface $n2_a_dev" >> $OSPF
echo "interface $n2_b_dev" >> $OSPF
echo "interface $n2_c_dev" >> $OSPF
echo "interface lo" >> $OSPF
echo "router ospf6" >> $OSPF
echo " router-id 0.0.0.2" >> $OSPF
echo " area 0.0.0.0 range $n2_a/80" >> $OSPF
echo " interface $n2_a_dev area 0.0.0.0" >> $OSPF
echo " area 0.0.0.0 range $n2_b/80" >> $OSPF
echo " interface $n2_b_dev area 0.0.0.0" >> $OSPF
echo " area 0.0.0.0 range $n2_c/80" >> $OSPF
echo " interface $n2_c_dev area 0.0.0.0" >> $OSPF
fi
#NODE3
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node3" ]; then
echo "#Node $hn..."
echo "interface $n3_b_dev" >> $OSPF
echo "interface $n3_d_dev" >> $OSPF
echo "interface $n3_e_dev" >> $OSPF
echo "interface lo" >> $OSPF
echo "router ospf6" >> $OSPF
echo " router-id 0.0.0.3" >> $OSPF
echo " area 0.0.0.0 range $n3_b/80" >> $OSPF
echo " interface $n3_b_dev area 0.0.0.0" >> $OSPF
echo " area 0.0.0.0 range $n3_d/80" >> $OSPF
echo " interface $n3_d_dev area 0.0.0.0" >> $OSPF
echo " area 0.0.0.0 range $n3_e/80" >> $OSPF
echo " interface $n3_e_dev area 0.0.0.0" >> $OSPF
fi
#NODE4
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node4" ]; then
echo "#Node $hn..."
echo "interface $n4_c_dev" >> $OSPF
echo "interface $n4_d_dev" >> $OSPF
echo "interface lo" >> $OSPF
echo "router ospf6" >> $OSPF
echo " router-id 0.0.0.4" >> $OSPF
echo " area 0.0.0.0 range $n4_c/80" >> $OSPF
echo " interface $n4_c_dev area 0.0.0.0" >> $OSPF
echo " area 0.0.0.0 range $n4_d/80" >> $OSPF
echo " interface $n4_d_dev area 0.0.0.0" >> $OSPF
fi
echo "line vty" >> $OSPF
cat $OSPF
sudo cp $OSPF $ETC
exit 0
#!/bin/bash
source net_info.sh
ZEBRA="zebra.conf"
ETC="/usr/local/etc/"
META="hostname Router\n
password zebra\n
enable password zebra\n
log file zebra.log\n!"
LB="interface lo\n
ip forwarding\n
line vty"
echo "!" > $ZEBRA
echo -e $META >> $ZEBRA
#NODE2
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node2" ]; then
echo "#Node $hn..."
echo "interface $n2_a_dev" >> $ZEBRA
echo " ipv6 address $n2_a/80" >> $ZEBRA
echo "interface $n2_b_dev" >> $ZEBRA
echo " ipv6 address $n2_b/80" >> $ZEBRA
echo "interface $n2_c_dev" >> $ZEBRA
echo " ipv6 address $n2_c/80" >> $ZEBRA
fi
#NODE3
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node3" ]; then
echo "#Node $hn..."
echo "interface $n3_b_dev" >> $ZEBRA
echo " ipv6 address $n3_b/80" >> $ZEBRA
echo "interface $n3_d_dev" >> $ZEBRA
echo " ipv6 address $n3_d/80" >> $ZEBRA
echo "interface $n3_e_dev" >> $ZEBRA
echo " ipv6 address $n3_e/80" >> $ZEBRA
fi
#NODE4
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node4" ]; then
echo "#Node $hn..."
echo "interface $n4_c_dev" >> $ZEBRA
echo " ipv6 address $n4_c/80" >> $ZEBRA
echo "interface $n4_d_dev" >> $ZEBRA
echo " ipv6 address $n4_d/80" >> $ZEBRA
fi
echo -e $LB >> $ZEBRA
cat $ZEBRA
sudo cp $ZEBRA $ETC
exit 0
#!/bin/bash
source net_info.sh
SSH_SD="ssh -t -t"
#Node name for SSH
DOMAIN=$(hostname | awk -F'.' '{print $2"."$3"."$4"."$5}')
INGRESS_NODES=("node2" "node3")
DST_IPS=($n5_e $n1_a)
#----------node2 (ingress)-------------
echo ""
echo "Delete SR rules on ingress nodes "${INGRESS_NODES[@]}""
echo "--------------------------------------"
#ip forwarding for pkts to DST_IP
$SSH_SD ${INGRESS_NODES[0]}.$DOMAIN "sudo ip -6 route del ${DST_IPS[0]}/128"
$SSH_SD ${INGRESS_NODES[1]}.$DOMAIN "sudo ip -6 route del ${DST_IPS[1]}/128"
#!/bin/bash
source net_info.sh
SSH_SD="ssh -t -t"
#Node name for SSH
DOMAIN=$(hostname | awk -F'.' '{print $2"."$3"."$4"."$5}')
SRC_NODE="node5.$DOMAIN"
INGRESS_NODE="node3.$DOMAIN"
#IP and interfaces
DST_IP=$n1_a
#segments
MID_SEGS=("$n4_d" "$n2_c") #via node3's netd adjacency and node2.
MID_SEG_DEVS="$n3_d_dev"
#----------node3 (ingress)-------------
echo ""
echo "Install rules on ingress nodes $INGRESS_NODE"
echo "--------------------------------------"
#ip forwarding for pkts to DST_IP
$SSH_SD $INGRESS_NODE "sudo ip -6 route add $DST_IP/128 dev $MID_SEG_DEVS encap seg6 mode encap segs ${MID_SEGS[0]},${MID_SEGS[1]}"
#!/bin/bash
source net_info.sh
SSH_SD="ssh -t -t"
#Node name for SSH
DOMAIN=$(hostname | awk -F'.' '{print $2"."$3"."$4"."$5}')
SRC_NODE="node5.$DOMAIN"
INGRESS_NODE="node3.$DOMAIN"
#IP and interfaces
DST_IP=$n1_a
#segments
MID_SEGS=("$n2_b") #via node3's netd adjacency and node2.
MID_SEG_DEVS="$n3_b_dev"
#----------node3 (ingress)-------------
echo ""
echo "Install rules on ingress nodes $INGRESS_NODE"
echo "--------------------------------------"
#ip forwarding for pkts to DST_IP
$SSH_SD $INGRESS_NODE "sudo ip -6 route add $DST_IP/128 dev $MID_SEG_DEVS encap seg6 mode encap segs ${MID_SEGS[0]}"
#!/bin/bash
#deploy and run myself
echo "#!/bin/bash" > net_info.sh
hn=$(hostname)
echo "Get info of node $hn ..."
./get_info.sh >> net_info.sh
for i in 2 3 4 5
do
echo "Get info of node $i ..."
scp get_info.sh node$i:~/ > /dev/null
ssh node$i "./get_info.sh" >> net_info.sh
done
echo "DONE. See net_info.sh"
#!/bin/bash
LB_IP="fc01::1"
INF="/proj/PhantomNet/binh/simeca_scripts/get_interface_map.pl"
#NODE1
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node1" ]; then
echo "#Node $hn..."
n1_a_dev=$($INF | grep neta | awk '{print $3}')
n1_a_mac=$(ifconfig | grep $n1_a_dev | awk '{print $5}')
n1_a=$(ifconfig | grep -A3 $n1_a_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::204/2001::204/ )
echo "n1_lb=\"$LB_IP\""
echo "n1_a=\"$n1_a\""
echo "n1_a_mac=\"$n1_a_mac\""
echo "n1_a_dev=\"$n1_a_dev\""
fi
#NODE2
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node2" ]; then
echo "#Node $hn..."
n2_a_dev=$($INF | grep neta | awk '{print $3}')
n2_a_mac=$(ifconfig | grep $n2_a_dev | awk '{print $5}')
n2_a=$(ifconfig | grep -A3 $n2_a_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::204/2001::204/ )
n2_b_dev=$($INF | grep netb | awk '{print $3}')
n2_b_mac=$(ifconfig | grep $n2_b_dev | awk '{print $5}')
n2_b=$(ifconfig | grep -A3 $n2_b_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::204/2001::205/ )
n2_c_dev=$($INF | grep netc | awk '{print $3}')
n2_c_mac=$(ifconfig | grep $n2_c_dev | awk '{print $5}')
n2_c=$(ifconfig | grep -A3 $n2_c_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::204/2001::206/ )
echo "n2_lb=\"$LB_IP\""
echo "n2_a=\"$n2_a\""
echo "n2_a_mac=\"$n2_a_mac\""
echo "n2_a_dev=\"$n2_a_dev\""
echo "n2_b=\"$n2_b\""
echo "n2_b_mac=\"$n2_b_mac\""
echo "n2_b_dev=\"$n2_b_dev\""
echo "n2_c=\"$n2_c\""
echo "n2_c_mac=\"$n2_c_mac\""
echo "n2_c_dev=\"$n2_c_dev\""
fi
#NODE3
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node3" ]; then
echo "#Node $hn..."
n3_b_dev=$($INF | grep netb | awk '{print $3}')
n3_b_mac=$(ifconfig | grep $n3_b_dev | awk '{print $5}')
n3_b=$(ifconfig | grep -A3 $n3_b_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::204/2001::205/ )
n3_d_dev=$($INF | grep netd | awk '{print $3}')
n3_d_mac=$(ifconfig | grep $n3_d_dev | awk '{print $5}')
n3_d=$(ifconfig | grep -A3 $n3_d_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::204/2001::207/ )
n3_e_dev=$($INF | grep nete | awk '{print $3}')
n3_e_mac=$(ifconfig | grep $n3_e_dev | awk '{print $5}')
n3_e=$(ifconfig | grep -A3 $n3_e_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::204/2001::208/ )
echo "n3_lb=\"$LB_IP\""
echo "n3_b=\"$n3_b\""
echo "n3_b_mac=\"$n3_b_mac\""
echo "n3_b_dev=\"$n3_b_dev\""
echo "n3_d=\"$n3_d\""
echo "n3_d_mac=\"$n3_d_mac\""
echo "n3_d_dev=\"$n3_d_dev\""
echo "n3_e=\"$n3_e\""
echo "n3_e_mac=\"$n3_e_mac\""
echo "n3_e_dev=\"$n3_e_dev\""
fi
#NODE4
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node4" ]; then
echo "#Node $hn..."
n4=$($INF)
n4_c_dev=$($INF | grep netc | awk '{print $3}')
n4_c_mac=$(ifconfig | grep $n4_c_dev | awk '{print $5}')
n4_c=$(ifconfig | grep -A3 $n4_c_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::204/2001::206/ )
n4_d_dev=$($INF | grep netd | awk '{print $3}')
n4_d_mac=$(ifconfig | grep $n4_d_dev | awk '{print $5}')
n4_d=$(ifconfig | grep -A3 $n4_d_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::204/2001::207/ )
echo "n4_lb=\"$LB_IP\""
echo "n4_c=\"$n4_c\""
echo "n4_c_mac=\"$n4_c_mac\""
echo "n4_c_dev=\"$n4_c_dev\""
echo "n4_d=\"$n4_d\""
echo "n4_d_mac=\"$n4_d_mac\""
echo "n4_d_dev=\"$n4_d_dev\""
fi
#NODE5
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node5" ]; then
echo "#Node $hn..."
n5_e_dev=$($INF | grep nete | awk '{print $3}')
n5_e_mac=$(ifconfig | grep $n5_e_dev | awk '{print $5}')
n5_e=$(ifconfig | grep -A3 $n5_e_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::204/2001::208/ )
echo "n5_lb=\"$LB_IP\""
echo "n5_e=\"$n5_e\""
echo "n5_e_mac=\"$n5_e_mac\""
echo "n5_e_dev=\"$n5_e_dev\""
fi
#!/bin/bash
source net_info.sh
SSH_SD="ssh -t -t"
#Node name for SSH
DOMAIN=$(hostname | awk -F'.' '{print $2"."$3"."$4"."$5}')
$SSH_SD node1.$DOMAIN "sudo ip -6 route add $n5_e/80 dev $n1_a_dev"
$SSH_SD node1.$DOMAIN "sudo ip -6 neigh add $n5_e lladdr $n2_a_mac dev $n1_a_dev"
$SSH_SD node1.$DOMAIN "sudo ip -6 neigh replace $n5_e lladdr $n2_a_mac dev $n1_a_dev"
$SSH_SD node5.$DOMAIN "sudo ip -6 route add $n1_a/80 dev $n5_e_dev"
$SSH_SD node5.$DOMAIN "sudo ip -6 neigh add $n1_a dev $n5_e_dev"
$SSH_SD node5.$DOMAIN "sudo ip -6 neigh replace $n1_a lladdr $n3_e_mac dev $n5_e_dev"
#!/bin/bash
#Install routes for each node in the topology. This should be done using a routing
#protocol such as OSPF or ISIS.
#
#Topology:
#
# |---(netb)---node3----(nete)---node5
# node1---(neta)---node2 --| |
# | |
# | (netd)
# | |
# |---(netc)---node4
#
source net_info.sh
SSH_SD="ssh -t -t"
#Node name for SSH
DOMAIN=$(hostname | awk -F'.' '{print $2"."$3"."$4"."$5}')
#----------node1-----------------
echo ""
echo "Install routes on source node1"
echo "--------------------------------------"
#ip route to node 5:
$SSH_SD node1.$DOMAIN "sudo ip -6 route add $n5_e/128 dev $n1_a_dev"
#arp to node 5 via node 2:
$SSH_SD node1.$DOMAIN "sudo ip -6 neigh add $n5_e lladdr $n2_a_mac dev $n1_a_dev"
#if rerun the arp assignment, need to use "replace"
$SSH_SD node1.$DOMAIN "sudo ip -6 neigh replace $n5_e lladdr $n2_a_mac dev $n1_a_dev"
#----------node2-------------
echo ""
echo "Install routes on node2"
echo "--------------------------------------"
#enable IPV6 forwarding
$SSH_SD node2.$DOMAIN "sudo sysctl net.ipv6.conf.all.forwarding=1"
#enable SRH processing flag on node
$SSH_SD node2.$DOMAIN "sudo sysctl net.ipv6.conf.all.seg6_enabled=1"
#enable SRH processing flag on interfaces
$SSH_SD node2.$DOMAIN "sudo sysctl net.ipv6.conf.$n2_a_dev.seg6_enabled=1"
$SSH_SD node2.$DOMAIN "sudo sysctl net.ipv6.conf.$n2_b_dev.seg6_enabled=1"
$SSH_SD node2.$DOMAIN "sudo sysctl net.ipv6.conf.$n2_c_dev.seg6_enabled=1"
#arp for node5
$SSH_SD node2.$DOMAIN "sudo ip -6 neigh add $n5_e lladdr $n4_c_mac dev $n2_c_dev"
$SSH_SD node2.$DOMAIN "sudo ip -6 neigh add $n5_e lladdr $n3_b_mac dev $n2_b_dev"
$SSH_SD node2.$DOMAIN "sudo ip -6 neigh add $n1_a lladdr $n1_a_mac dev $n2_a_dev"
#ip forwarding for pkts to next-hop (encapsulated pkt's destination)
$SSH_SD node2.$DOMAIN "sudo ip -6 route add $n4_c/128 dev $n2_c_dev"
$SSH_SD node2.$DOMAIN "sudo ip -6 route add $n3_b/128 dev $n2_b_dev"
$SSH_SD node2.$DOMAIN "sudo ip -6 route add $n1_a/128 dev $n2_a_dev"
#----------node3-------------
echo ""
echo "Install routes on node3"
echo "--------------------------------------"
#enable IPV6 forwarding
$SSH_SD node3.$DOMAIN "sudo sysctl net.ipv6.conf.all.forwarding=1"
#enable SRH processing flag on node
$SSH_SD node3.$DOMAIN "sudo sysctl net.ipv6.conf.all.seg6_enabled=1"
#enable SRH processing flag on interface
$SSH_SD node3.$DOMAIN "sudo sysctl net.ipv6.conf.$n3_b_dev.seg6_enabled=1"
$SSH_SD node3.$DOMAIN "sudo sysctl net.ipv6.conf.$n3_d_dev.seg6_enabled=1"
$SSH_SD node3.$DOMAIN "sudo sysctl net.ipv6.conf.$n3_e_dev.seg6_enabled=1"
#arp for the next segment
$SSH_SD node3.$DOMAIN "sudo ip -6 neigh add $n1_a lladdr $n2_b_mac dev $n3_b_dev"
$SSH_SD node3.$DOMAIN "sudo ip -6 neigh add $n1_a lladdr $n4_d_mac dev $n3_d_dev"
#ip forwarding for pkts to next-hop (encapsulated pkt's destination)
$SSH_SD node3.$DOMAIN "sudo ip -6 route add $n2_b/128 dev $n3_b_dev"
$SSH_SD node3.$DOMAIN "sudo ip -6 route add $n4_d/128 dev $n3_d_dev"
$SSH_SD node3.$DOMAIN "sudo ip -6 route add $n5_e/128 dev $n3_e_dev"
#--------node4--------------
echo ""
echo "Install routes on node4"
echo "--------------------------------------"
#enable IPV6 forwarding
$SSH_SD node4.$DOMAIN "sudo sysctl net.ipv6.conf.all.forwarding=1"
#enable SRH processing flag on node
$SSH_SD node4.$DOMAIN "sudo sysctl net.ipv6.conf.all.seg6_enabled=1"
#enable SRH processing flag on interface
$SSH_SD node4.$DOMAIN "sudo sysctl net.ipv6.conf.$n4_c_dev.seg6_enabled=1"
$SSH_SD node4.$DOMAIN "sudo sysctl net.ipv6.conf.$n4_d_dev.seg6_enabled=1"
#arp for the next segment
$SSH_SD node4.$DOMAIN "sudo ip -6 neigh add $n1_a lladdr $n2_c_mac dev $n4_c_dev"
$SSH_SD node4.$DOMAIN "sudo ip -6 neigh add $n5_e lladdr $n3_d_mac dev $n4_d_dev"
#ip forwarding for pkts to next-hop (encapsulated pkt's destination)
$SSH_SD node4.$DOMAIN "sudo ip -6 route add $n3_d/128 dev $n4_d_dev"
$SSH_SD node4.$DOMAIN "sudo ip -6 route add $n2_c/128 dev $n4_c_dev"
#----------node5-----------------
echo ""
echo "Install routes on source node5"
echo "--------------------------------------"
#ip route to node 1:
$SSH_SD node5.$DOMAIN "sudo ip -6 route add $n1_a/128 dev $n5_e_dev"
#arp to node 5 via node 2:
$SSH_SD node5.$DOMAIN "sudo ip -6 neigh add $n1_a lladdr $n3_e_mac dev $n5_e_dev"
#if rerun the arp assignment, need to use "replace"
$SSH_SD node5.$DOMAIN "sudo ip -6 neigh replace $n1_a lladdr $n3_e_mac dev $n5_e_dev"
#!/bin/bash
source net_info.sh
iperf -V -M 1350 -c $n5_e
#!/bin/bash
for i in zebra ospf6
do
ps ax | grep "$i" | grep -v "grep" | awk '{system("kill -9 " $1)}'
done
#!/bin/bash
#Node node1...
n1_lb="fc01::1"
n1_a=""
n1_a_mac="00:04:23:b7:21:2a"
n1_a_dev="enp9s4f0"
#Node node2...
n2_lb="fc01::1"
n2_a="2001::204:23ff:feb7:176c"
n2_a_mac="00:04:23:b7:17:6c"
n2_a_dev="enp9s4f0"
n2_b="2001::205:23ff:feb7:176d"
n2_b_mac="00:04:23:b7:17:6d"
n2_b_dev="enp9s4f1"
n2_c="2001::206:23ff:feb7:1488"
n2_c_mac="00:04:23:b7:14:88"
n2_c_dev="enp10s3f0"
#Node node3...
n3_lb="fc01::1"
n3_b="2001::205:23ff:feb7:2046"
n3_b_mac="00:04:23:b7:20:46"
n3_b_dev="enp9s4f0"
n3_d="2001::207:23ff:feb7:2047"
n3_d_mac="00:04:23:b7:20:47"
n3_d_dev="enp9s4f1"
n3_e="2001::208:23ff:feb7:1ab8"
n3_e_mac="00:04:23:b7:1a:b8"
n3_e_dev="enp10s3f0"
#Node node4...
n4_lb="fc01::1"
n4_c="2001::206:23ff:feb7:23a0"
n4_c_mac="00:04:23:b7:23:a0"
n4_c_dev="enp9s4f0"
n4_d="2001::207:23ff:feb7:23a1"
n4_d_mac="00:04:23:b7:23:a1"
n4_d_dev="enp9s4f1"
#Node node5...
n5_lb="fc01::1"
n5_e="2001::208:23ff:feb7:1df4"
n5_e_mac="00:04:23:b7:1d:f4"
n5_e_dev="enp9s4f0"
#!/bin/bash
hn=$(hostname)
for i in 2 3 4
do
echo -e "\n========================="
echo "Start FRR on node $i ..."
scp kill_frr.sh start_frr.sh node$i:~/ > /dev/null
ssh node$i "sudo ./start_frr.sh"
done
echo "DONE starting FRR on all nodes!"
exit 0
#!/bin/bash
if [ "$(whoami)" != "root" ]; then
echo "Must run as root: sudo <cmd>"
exit 1
fi
export LD_LIBRARY_PATH=/usr/local/lib
sudo chmod 777 /var/run/
sudo chmod 777 /var/run/
sudo chmod 755 /var/run/sshd #for ssh access.
sudo chmod 644 /var/run/sshd.pid
sudo sysctl net.ipv6.conf.all.forwarding=1 #enable ip forwarding for fe80:: addresses
./kill_frr.sh
for i in zebra ospf6d
do
$i -d;
ps ax | grep $i
done
#!/bin/bash
source net_info.sh
SSH_SD="ssh -t -t"
#Node name for SSH
DOMAIN=$(hostname | awk -F'.' '{print $2"."$3"."$4"."$5}')
SRC_NODE="node1.$DOMAIN"
INGRESS_NODE="node2.$DOMAIN"
#IP and interfaces
DST_IP=$n5_e
#segments
MID_SEGS=("$n4_c" "$n3_d") #via node2's netc adjacency and node4.
MID_SEG_DEVS="$n2_c_dev"
#----------node2 (ingress)-------------
echo ""
echo "Install rules on ingress nodes $INGRESS_NODE"
echo "--------------------------------------"
#ip forwarding for pkts to DST_IP
$SSH_SD $INGRESS_NODE "sudo ip -6 route add $DST_IP/128 dev $MID_SEG_DEVS encap seg6 mode encap segs ${MID_SEGS[0]},${MID_SEGS[1]}"
#!/bin/bash
source net_info.sh
SSH_SD="ssh -t -t"
#Node name for SSH
DOMAIN=$(hostname | awk -F'.' '{print $2"."$3"."$4"."$5}')
SRC_NODE="node1.$DOMAIN"
INGRESS_NODE="node2.$DOMAIN"
#IP and interfaces
DST_IP=$n5_e
#segments
MID_SEGS=("$n3_b") #via node3.
MID_SEG_DEVS="$n2_b_dev"
#----------node2 (ingress)-------------
echo ""
echo "Install rules on ingress nodes $INGRESS_NODE"
echo "--------------------------------------"
#ip forwarding for pkts to DST_IP
$SSH_SD $INGRESS_NODE "sudo ip -6 route add $DST_IP/128 dev $MID_SEG_DEVS encap seg6 mode encap segs ${MID_SEGS[0]}"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment