From d41fdd708df95b848be1d883ac12a5c8b09e21e3 Mon Sep 17 00:00:00 2001 From: Yuri Volchkov Date: Fri, 3 Nov 2017 17:16:42 +0100 Subject: [PATCH] how to actually call fixnetwork.sh It was a bit unclear for me, what to do with fixnetwork.sh script. This modifications should help to avoid confusion Edit by Knorrie: * Fix up some whitespace * Make fixnetwork executable, it already had a shebang * Copy both router and host files, if present: [RH]* --- bgp-contd/README.md | 13 ++++++++++--- bgp-contd/lxc/fixnetwork.sh | 0 bgp-intro/README.md | 11 +++++++++-- bgp-intro/lxc/fixnetwork.sh | 0 ospf-intro/README.md | 11 +++++++++-- ospf-intro/lxc/fixnetwork.sh | 0 6 files changed, 28 insertions(+), 7 deletions(-) mode change 100644 => 100755 bgp-contd/lxc/fixnetwork.sh mode change 100644 => 100755 bgp-intro/lxc/fixnetwork.sh mode change 100644 => 100755 ospf-intro/lxc/fixnetwork.sh diff --git a/bgp-contd/README.md b/bgp-contd/README.md index e1744e5..5e5f164 100644 --- a/bgp-contd/README.md +++ b/bgp-contd/README.md @@ -20,16 +20,23 @@ Well, you know the drill. :-) Thankfully, most of the configuration is provided already, so we can quickly set up this whole network using our LXC environment. Just like in the previous tutorials, the birdbase container can be cloned, after which the lxc network information and configuration inside the containers can be copied into them. - 1. Clone this git repository somewhere to be able to use some files from the bgp-contd/lxc/ directory inside. + 1. Clone this git repository somewhere to be able to use some files from the bgp-contd/lxc/ directory inside: + + cd ~ + git clone https://github.com/knorrie/network-examples.git + 2. lxc-copy the birdbase container several times: for router in 0 1 2 10 11 12 20; do lxc-copy -s -n birdbase -N R$router; done 3. Set up the network interfaces in the lxc configuration. This can be done by removing all network related configuration that remains from the cloned birdbase container, and then appending all needed interface configuration by running the fixnetwork.sh script that can be found in `bgp-contd/lxc/` in this git repository. Of course, have a look at the contents of the script first, before executing it. - . ./fixnetwork.sh + cd /var/lib/lxc + ~/network-examples/bgp-contd/lxc/fixnetwork.sh - 4. Copy extra configuration into the containers. The bgp-intro/lxc/ directory inside this git repository contains a little file hierarchy that can just be copied over the configuration of the containers. For each router, it's a network/interfaces configuration file which adds an IP address that corresponds with the Router ID to the loopback interface, and a simple BIRD configuration file that serves as a starting point for our next steps. + 4. Copy extra configuration into the containers. The bgp-contd/lxc/ directory inside this git repository contains a little file hierarchy that can just be copied over the configuration of the containers. For each router, it's a network/interfaces configuration file whcih adds an IP address that corresponds with the Router ID to the loopback interface, and a simple BIRD configuration file that serves as a starting point for our next steps: + + cp ~/network-examples/bgp-contd/lxc/[RH]* . -r 5. Start all containers diff --git a/bgp-contd/lxc/fixnetwork.sh b/bgp-contd/lxc/fixnetwork.sh old mode 100644 new mode 100755 diff --git a/bgp-intro/README.md b/bgp-intro/README.md index 2e4b109..ad2d274 100644 --- a/bgp-intro/README.md +++ b/bgp-intro/README.md @@ -45,7 +45,11 @@ Our networks start to look serious now! It might be handy to print this image so Thankfully, most of the configuration is provided already, so we can quickly set up this whole network using our LXC environment. Just like in the previous tutorial, the birdbase container can be cloned, after which the lxc network information and configuration inside the containers can be copied into them. - 1. Clone this git repository somewhere to be able to use some files from the bgp-intro/lxc/ directory inside. + 1. Clone this git repository somewhere to be able to use some files from the bgp-intro/lxc/ directory inside: + + cd ~ + git clone https://github.com/knorrie/network-examples.git + 2. lxc-copy the birdbase container several times: lxc-copy -s -n birdbase -N R0 @@ -61,10 +65,13 @@ Thankfully, most of the configuration is provided already, so we can quickly set 3. Set up the network interfaces in the lxc configuration. This can be done by removing all network related configuration that remains from the cloned birdbase container, and then appending all needed interface configuration by running the fixnetwork.sh script that can be found in `bgp-intro/lxc/` in this git repository. Of course, have a look at the contents of the script first, before executing it. - . ./fixnetwork.sh + cd /var/lib/lxc + ~/network-examples/bgp-intro/lxc/fixnetwork.sh 4. Copy extra configuration into the containers. The bgp-intro/lxc/ directory inside this git repository contains a little file hierarchy that can just be copied over the configuration of the containers. For each router, it's a network/interfaces configuration file which adds an IP address that corresponds with the Router ID to the loopback interface, and a simple BIRD configuration file that serves as a starting point for our next steps. + cp ~/network-examples/bgp-intro/lxc/[RH]* . -r + 5. Start all containers for router in 0 1 3 10 11 12; do lxc-start -d -n R$router; sleep 2; done diff --git a/bgp-intro/lxc/fixnetwork.sh b/bgp-intro/lxc/fixnetwork.sh old mode 100644 new mode 100755 diff --git a/ospf-intro/README.md b/ospf-intro/README.md index 0ccf8bd..68dda07 100644 --- a/ospf-intro/README.md +++ b/ospf-intro/README.md @@ -82,7 +82,11 @@ Let's build some containers! If you don't have [a lab environment](/lxcbird/READ To create the eight containers we need, connected together in different networks, the following steps are needed: - 1. Clone this git repository somewhere to be able to use some files from the ospf-intro/lxc/ directory inside. + 1. Clone this git repository somewhere to be able to use some files from the ospf-intro/lxc/ directory inside: + + cd ~ + git clone https://github.com/knorrie/network-examples.git + 2. lxc-copy the birdbase container several times: lxc-copy -s -n birdbase -N R1 @@ -96,10 +100,13 @@ To create the eight containers we need, connected together in different networks 3. Set up the network interfaces in the lxc configuration. This can be done by removing all network related configuration that remains from the cloned birdbase container, and then appending all needed interface configuration by running the fixnetwork.sh script that can be found in `ospf-intro/lxc/` in this git repository. Of course, have a look at the contents of the script first, before executing it. Since this example is only using IPv4 and single IP addresses on the interfaces, I simply added them to the lxc configuration instead of the network/interfaces file inside the container. - . ./fixnetwork.sh + cd /var/lib/lxc + ~/network-examples/ospf-intro/lxc/fixnetwork.sh 4. Copy extra configuration into the containers. The ospf-intro/lxc/ directory inside this git repository contains a little file hierarchy that can just be copied over the configuration of the containers. For each router, it's a network/interfaces configuration file which adds an IP address that corresponds with the Router ID to the loopback interface, and a simple BIRD configuration file that serves as a starting point for our next steps. + cp ~/network-examples/ospf-intro/lxc/[RH]* . -r + 5. Start all containers for router in 1 2 5 6; do lxc-start -d -n R$router; sleep 2; done diff --git a/ospf-intro/lxc/fixnetwork.sh b/ospf-intro/lxc/fixnetwork.sh old mode 100644 new mode 100755