From 787a57122e5556b1868c6b43d6494399e75adcb0 Mon Sep 17 00:00:00 2001 From: Felix Date: Sat, 23 Nov 2019 21:16:33 +0000 Subject: [PATCH] major update not sure --- scripts/hostadress.sh | 21 +++++++++++++++++++++ scripts/routerAdress | 16 ++++++++++++++++ scripts/routerflows.sh | 18 ++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100755 scripts/hostadress.sh create mode 100644 scripts/routerAdress create mode 100755 scripts/routerflows.sh diff --git a/scripts/hostadress.sh b/scripts/hostadress.sh new file mode 100755 index 0000000..6f70937 --- /dev/null +++ b/scripts/hostadress.sh @@ -0,0 +1,21 @@ +#!/bin/bash +#:' +#Este script es para usarlo junto con el routerflows.sh en la practica de OVS c +#como routers +#' + +#Setting addreses +echo "Setting addresses..." +echo "h1 ip addr del 10.0.0.1/8 dev h1-eth0" > fifo +echo "h1 ip addr add 172.16.20.10/24 dev h1-eth0" > fifo +echo "h2 ip addr del 10.0.0.2/8 dev h2-eth0" > fifo +echo "h2 ip addr add 172.16.10.10/24 dev h2-eth0" > fifo +echo "h3 ip addr del 10.0.0.3/8 dev h3-eth0" > fifo +echo "h3 ip addr add 192.168.30.10/24 dev h3-eth0" > fifo + +#Setting default route to the hosts +echo "Setting default route to the hosts..." +echo "h1 ip route add default via 172.16.20.1" > fifo +echo "h2 ip route add default via 172.16.10.1" > fifo +echo "h3 ip route add default via 192.168.30.1" > fifo +echo "Done" diff --git a/scripts/routerAdress b/scripts/routerAdress new file mode 100644 index 0000000..83f168d --- /dev/null +++ b/scripts/routerAdress @@ -0,0 +1,16 @@ +#Setting addreses +h1 ip addr del 10.0.0.1/8 dev h1-eth0 +h1 ip addr add 172.16.20.10/24 dev h1-eth0 + +h2 ip addr del 10.0.0.2/8 dev h2-eth0 +h2 ip addr add 172.16.10.10/24 dev h2-eth0 + +h3 ip addr del 10.0.0.3/8 dev h3-eth0 +h3 ip addr add 192.168.30.10/24 dev h3-eth0 + +#Setting default route to the hosts +h1 ip route add default via 172.16.20.1 + +h2 ip route add default via 172.16.10.1 + +h3 ip route add default via 192.168.30.1 diff --git a/scripts/routerflows.sh b/scripts/routerflows.sh new file mode 100755 index 0000000..ed21cbc --- /dev/null +++ b/scripts/routerflows.sh @@ -0,0 +1,18 @@ +#!/bin/bash +#Setting address +curl -X POST -d '{"address":"172.16.10.1/24"}' http://localhost:8080/router/0000000000000002 +curl -X POST -d '{"address": "172.16.30.1/24"}' http://localhost:8080/router/0000000000000002 +curl -X POST -d '{"address": "192.168.10.1/24"}' http://localhost:8080/router/0000000000000002 +curl -X POST -d '{"address":"172.16.20.1/24"}' http://localhost:8080/router/0000000000000001 +curl -X POST -d '{"address": "172.16.30.30/24"}' http://localhost:8080/router/0000000000000001 +curl -X POST -d '{"address": "192.168.30.1/24"}' http://localhost:8080/router/0000000000000003 +curl -X POST -d '{"address": "192.168.10.20/24"}' http://localhost:8080/router/0000000000000003 + +#Setting default routes +curl -X POST -d '{"gateway": "172.16.30.1"}' http://localhost:8080/router/0000000000000001 +curl -X POST -d '{"gateway": "172.16.30.30"}' http://localhost:8080/router/0000000000000002 +curl -X POST -d '{"gateway": "192.168.10.1"}' http://localhost:8080/router/0000000000000003 + +#Setting static routes +curl -X POST -d '{"destination": "192.168.30.0/24", "gateway": "192.168.10.20"}' http://localhost:8080/router/0000000000000002 + -- 2.25.1