Commit 9eb7de97 authored by Binh Nguyen's avatar Binh Nguyen

OSPF combined with SR

parent d42cbdd4
......@@ -2,7 +2,8 @@ Scripts to run Free Range Routing's OSPF on profile sripv6-v3 in PhantomNet (htt
------------------------------------------------------------------------------------
How to run? Everything is running on Node1.
A. How to set up basic IPv6 with OSPF? 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:
......@@ -17,6 +18,15 @@ How to run? Everything is running on Node1.
6. Ping test from node 1 to 5:
ping6 <node 5's nete IPv6 address>
B. Combining OSPF with SR. Again, everything is run on node1:
------------------------------------------------------------
1. After part A, enable SR flags on the routers:
./enable_sr_flags.sh
2. Install SR rules, for high bandwidth path (1->2->4->3->5):
./ul_adj.sh
./dl_adj.sh
3. Install SR rules, for low delay, low bandwidth path (1->2->3->5) the path is enable by OSPF as default:
./del_sr.sh
Other scripts:
......
......@@ -8,31 +8,31 @@ 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"
#$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"
#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"
#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"
#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"
#$SSH_SD "node5.$DOMAIN" "sudo ip -6 addr add $n5_lb dev lo"
#!/bin/bash
#Install routes for each node in the topology. This should be done using a routing
#protocol such as OSPF or ISIS.
#Install forwarding flags on OSPF routers to enable Segment Routing.
#
#Topology:
#
......@@ -21,20 +20,9 @@ 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 SR flags on router node2"
echo "--------------------------------------"
#enable IPV6 forwarding
$SSH_SD node2.$DOMAIN "sudo sysctl net.ipv6.conf.all.forwarding=1"
......@@ -44,19 +32,11 @@ $SSH_SD node2.$DOMAIN "sudo sysctl net.ipv6.conf.all.seg6_enabled=1"
$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 SR flags on router node3"
echo "--------------------------------------"
#enable IPV6 forwarding
$SSH_SD node3.$DOMAIN "sudo sysctl net.ipv6.conf.all.forwarding=1"
......@@ -66,20 +46,13 @@ $SSH_SD node3.$DOMAIN "sudo sysctl net.ipv6.conf.all.seg6_enabled=1"
$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 SR flags on router node4"
echo "--------------------------------------"
#enable IPV6 forwarding
$SSH_SD node4.$DOMAIN "sudo sysctl net.ipv6.conf.all.forwarding=1"
......@@ -88,23 +61,3 @@ $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"
......@@ -9,7 +9,7 @@ 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/ )
n1_a=$(ifconfig | grep -A3 $n1_a_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::*:/2001::204:/ )
echo "n1_lb=\"$LB_IP\""
echo "n1_a=\"$n1_a\""
echo "n1_a_mac=\"$n1_a_mac\""
......@@ -23,15 +23,15 @@ 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_a=$(ifconfig | grep -A3 $n2_a_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::*:/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_b=$(ifconfig | grep -A3 $n2_b_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::*:/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/ )
n2_c=$(ifconfig | grep -A3 $n2_c_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::*:/2001::206:/ )
echo "n2_lb=\"$LB_IP\""
echo "n2_a=\"$n2_a\""
......@@ -52,15 +52,15 @@ 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_b=$(ifconfig | grep -A3 $n3_b_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::*:/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_d=$(ifconfig | grep -A3 $n3_d_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::*:/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/ )
n3_e=$(ifconfig | grep -A3 $n3_e_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::*:/2001::208:/ )
echo "n3_lb=\"$LB_IP\""
echo "n3_b=\"$n3_b\""
......@@ -82,11 +82,11 @@ if [ "$hn" == "node4" ]; then
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_c=$(ifconfig | grep -A3 $n4_c_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::*:/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/ )
n4_d=$(ifconfig | grep -A3 $n4_d_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::*/2001::207:/ )
echo "n4_lb=\"$LB_IP\""
echo "n4_c=\"$n4_c\""
......@@ -104,7 +104,7 @@ 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/ )
n5_e=$(ifconfig | grep -A3 $n5_e_dev | grep inet6 | grep "fe80::" | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::*:/2001::208:/ )
echo "n5_lb=\"$LB_IP\""
echo "n5_e=\"$n5_e\""
......
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