mirror of
https://github.com/knorrie/network-examples
synced 2025-08-22 10:09:36 +00:00
BGP Intro: container configuration
This commit is contained in:
parent
bb5236f280
commit
18ccede019
@ -1,5 +1,5 @@
|
||||
BGP
|
||||
===
|
||||
BGP, Part I
|
||||
===========
|
||||
|
||||
In the previous tutorial, we discovered how to let [OSPF](/ospf-intro/README.md) dynamically configure routing inside a network. This tutorial provides an introduction to another routing protocol, which is BGP, the Border Gateway Protocol. As the name implies, this protocol acts on the border of a network. Where OSPF is well suited to keep track of all tiny details of what's happening in our internal network, BGP will be talking to the outside world to interconnect our network with other networks, managed by someone else.
|
||||
|
||||
@ -17,7 +17,7 @@ The picture shows two networks, which are interconnected through router `R3` and
|
||||
|
||||
* A complete network under control of somebody has an AS ([Autonomous System](https://tools.ietf.org/html/rfc1930)) number. By specifying the AS number when configuring BGP connections, we let it know if the neighbour is in our own network (our AS), or in an external network (another AS).
|
||||
* If neighbouring routers between different networks are directly connected, they often interconnect using a minimal sized network range. For IPv4, this is usually a `/30` and for IPv6 a `/120` or a `/126` prefix, containing only the two routers. In the example above, the small network ranges are taken from the network of `AS64080`.
|
||||
* The routes that are published to another network are as aggregated as possible, to minimize the amount of them. While the internal routing table in for example AS64080 might contain dozens of prefixes, for each little vlan, and probably a number of single host routes (IPv4 `/32` and IPv6 `/128`), they're advertised to the outside as just three routes in total.
|
||||
* The routes that are published to another network are as aggregated as possible, to minimize the amount of them. While the internal routing table in for example `AS64080` might contain dozens of prefixes, for each little vlan, and probably a number of single host routes (IPv4 `/32` and IPv6 `/128`), they're advertised to the outside as just three routes in total.
|
||||
|
||||
## OSPF vs. BGP
|
||||
|
||||
@ -41,10 +41,123 @@ In the second half of this tutorial we'll configure a network, using OSPF, BGP a
|
||||
|
||||

|
||||
|
||||
It's starting to look serious now!
|
||||
### Setting up the containers and networks
|
||||
|
||||
Hopsa, clone some containers, copy paste configuration
|
||||
* already provide bird config with ospf for internal network
|
||||
It's starting to look serious now! 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.
|
||||
2. lxc-clone the birdbase container several times:
|
||||
|
||||
lxc-clone -s birdbase R0
|
||||
lxc-clone -s birdbase R1
|
||||
lxc-clone -s birdbase R3
|
||||
lxc-clone -s birdbase R10
|
||||
lxc-clone -s birdbase R11
|
||||
lxc-clone -s birdbase R12
|
||||
lxc-clone -s birdbase H6
|
||||
lxc-clone -s birdbase H7
|
||||
lxc-clone -s birdbase H19
|
||||
lxc-clone -s birdbase H34
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
5. Start all containers
|
||||
|
||||
lxc-start -d -n R0
|
||||
lxc-start -d -n R1
|
||||
lxc-start -d -n R3
|
||||
lxc-start -d -n R10
|
||||
lxc-start -d -n R11
|
||||
lxc-start -d -n R12
|
||||
lxc-start -d -n H6
|
||||
lxc-start -d -n H7
|
||||
lxc-start -d -n H19
|
||||
lxc-start -d -n H34
|
||||
|
||||
6. Verify connectivity and look around a bit. Here's an example for R1:
|
||||
|
||||
lxc-attach -n R1
|
||||
|
||||
root@R1:/# ip a
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
|
||||
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||
inet 127.0.0.1/8 scope host lo
|
||||
valid_lft forever preferred_lft forever
|
||||
inet 10.40.217.1/32 scope global lo
|
||||
valid_lft forever preferred_lft forever
|
||||
inet6 2001:db8:40::1/128 scope global
|
||||
valid_lft forever preferred_lft forever
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
109: vlan216: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
|
||||
link/ether 02:00:0a:28:d8:03 brd ff:ff:ff:ff:ff:ff
|
||||
inet 10.40.216.3/28 brd 10.40.216.15 scope global vlan216
|
||||
valid_lft forever preferred_lft forever
|
||||
inet6 2001:db8:40:d8::3/120 scope global
|
||||
valid_lft forever preferred_lft forever
|
||||
inet6 fe80::aff:fe28:d803/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
111: vlan3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
|
||||
link/ether 02:00:0a:28:03:01 brd ff:ff:ff:ff:ff:ff
|
||||
inet 10.40.3.1/24 brd 10.40.3.255 scope global vlan3
|
||||
valid_lft forever preferred_lft forever
|
||||
inet6 2001:db8:40:3::1/120 scope global
|
||||
valid_lft forever preferred_lft forever
|
||||
inet6 fe80::aff:fe28:301/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
|
||||
root@R1:/# ip r
|
||||
10.40.2.0/24 via 10.40.216.2 dev vlan216 proto bird
|
||||
10.40.3.0/24 dev vlan3 proto kernel scope link src 10.40.3.1
|
||||
10.40.216.0/28 dev vlan216 proto kernel scope link src 10.40.216.3
|
||||
10.40.217.0 via 10.40.216.2 dev vlan216 proto bird
|
||||
10.40.217.3 via 10.40.216.1 dev vlan216 proto bird
|
||||
10.40.217.16/30 via 10.40.216.1 dev vlan216 proto bird
|
||||
|
||||
root@R1:/# birdc show route
|
||||
BIRD 1.4.5 ready.
|
||||
10.40.217.16/30 via 10.40.216.1 on vlan216 [ospf1 22:58:02] * I (150/20) [10.40.217.3]
|
||||
10.40.216.0/28 dev vlan216 [ospf1 22:58:02] * I (150/10) [10.40.217.3]
|
||||
10.40.217.0/32 via 10.40.216.2 on vlan216 [ospf1 22:58:02] * I (150/10) [10.40.217.0]
|
||||
10.40.217.1/32 dev lo [ospf1 22:57:42] * I (150/0) [10.40.217.1]
|
||||
10.40.217.3/32 via 10.40.216.1 on vlan216 [ospf1 22:58:02] * I (150/10) [10.40.217.3]
|
||||
10.40.2.0/24 via 10.40.216.2 on vlan216 [ospf1 22:58:02] * I (150/20) [10.40.217.0]
|
||||
10.40.3.0/24 dev vlan3 [ospf1 22:57:42] * I (150/10) [10.40.217.1]
|
||||
|
||||
root@R1:/# ip -6 r
|
||||
2001:db8:40:: via fe80::aff:fe28:d802 dev vlan216 proto bird metric 1024
|
||||
unreachable 2001:db8:40::1 dev lo proto kernel metric 256 error -101
|
||||
2001:db8:40::3 via fe80::aff:fe28:d801 dev vlan216 proto bird metric 1024
|
||||
2001:db8:40:2::/120 via fe80::aff:fe28:d802 dev vlan216 proto bird metric 1024
|
||||
2001:db8:40:3::/120 dev vlan3 proto kernel metric 256
|
||||
2001:db8:40:d8::/120 dev vlan216 proto kernel metric 256
|
||||
2001:db8:40:d910::/120 via fe80::aff:fe28:d801 dev vlan216 proto bird metric 1024
|
||||
fe80::/64 dev vlan216 proto kernel metric 256
|
||||
fe80::/64 dev vlan3 proto kernel metric 256
|
||||
|
||||
root@R1:/# birdc6 show route
|
||||
BIRD 1.4.5 ready.
|
||||
2001:db8:40:d8::/120 dev vlan216 [ospf1 22:58:08] * I (150/10) [10.40.217.3]
|
||||
2001:db8:40::/128 via fe80::aff:fe28:d802 on vlan216 [ospf1 22:58:08] * I (150/20) [10.40.217.0]
|
||||
2001:db8:40:2::/120 via fe80::aff:fe28:d802 on vlan216 [ospf1 22:58:08] * I (150/20) [10.40.217.0]
|
||||
2001:db8:40:3::/120 dev vlan3 [ospf1 22:57:41] * I (150/10) [10.40.217.1]
|
||||
2001:db8:40::3/128 via fe80::aff:fe28:d801 on vlan216 [ospf1 22:58:08] * I (150/20) [10.40.217.3]
|
||||
2001:db8:40:d910::/120 via fe80::aff:fe28:d801 on vlan216 [ospf1 22:58:08] * I (150/20) [10.40.217.3]
|
||||
|
||||
As you can see, OSPF is running for IPv4 and IPv6, and has discovered the complete internal network of AS64080.
|
||||
|
||||
Now make sure you can do the following, or answer the following questions:
|
||||
* From H6, `traceroute -n` and `traceroute6 -n` to a few destinations in AS64080 to get acquainted with the network topology.
|
||||
* Look at the BIRD logging. A fun way to follow the logging is to do `tail -F R*/rootfs/var/log/bird/*.log` from outside the containers, and then start all of them.
|
||||
* Find out why `10.40.217.18` or `2001:db8:40:d910::2` on `R10` cannot be pinged from `R1`, while the route to `10.40.217.16/30` and `2001:db8:40:d910::/120` are actually present in the routing table of `R1` and `R3`.
|
||||
|
||||
------------
|
||||
|
||||
### TODO:
|
||||
|
||||
Zoom in on R3, R10 and add BGP configuration
|
||||
* add ebgp protocol
|
||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
1
bgp-intro/lxc/H19/rootfs/etc/bird/bird.conf
Normal file
1
bgp-intro/lxc/H19/rootfs/etc/bird/bird.conf
Normal file
@ -0,0 +1 @@
|
||||
|
1
bgp-intro/lxc/H19/rootfs/etc/bird/bird6.conf
Normal file
1
bgp-intro/lxc/H19/rootfs/etc/bird/bird6.conf
Normal file
@ -0,0 +1 @@
|
||||
|
14
bgp-intro/lxc/H19/rootfs/etc/network/interfaces
Normal file
14
bgp-intro/lxc/H19/rootfs/etc/network/interfaces
Normal file
@ -0,0 +1,14 @@
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
auto vlan48
|
||||
iface vlan48 inet manual
|
||||
up ip link set up dev vlan48
|
||||
up ip addr add 10.40.52.19/21 brd + dev vlan48
|
||||
up ip addr add 2001:db8:10:30::413/117 dev vlan48
|
||||
up ip route add default via 10.40.48.1 dev vlan48
|
||||
up ip route add default via 2001:db8:10:30::1 dev vlan48
|
||||
down ip route -6 del default
|
||||
down ip addr del 2001:db8:10:30::413/117 dev vlan48
|
||||
down ip addr del 10.40.52.19/21 dev vlan48
|
||||
down up link set down dev vlan48
|
1
bgp-intro/lxc/H34/rootfs/etc/bird/bird.conf
Normal file
1
bgp-intro/lxc/H34/rootfs/etc/bird/bird.conf
Normal file
@ -0,0 +1 @@
|
||||
|
1
bgp-intro/lxc/H34/rootfs/etc/bird/bird6.conf
Normal file
1
bgp-intro/lxc/H34/rootfs/etc/bird/bird6.conf
Normal file
@ -0,0 +1 @@
|
||||
|
14
bgp-intro/lxc/H34/rootfs/etc/network/interfaces
Normal file
14
bgp-intro/lxc/H34/rootfs/etc/network/interfaces
Normal file
@ -0,0 +1,14 @@
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
auto vlan36
|
||||
iface vlan36 inet manual
|
||||
up ip link set up dev vlan36
|
||||
up ip addr add 10.40.36.34/24 brd + dev vlan36
|
||||
up ip addr add 2001:db8:10:24::22/120 dev vlan36
|
||||
up ip route add default via 10.40.36.1 dev vlan36
|
||||
up ip route add default via 2001:db8:10:24::1 dev vlan36
|
||||
down ip route -6 del default
|
||||
down ip addr del 2001:db8:10:24::22/120 dev vlan36
|
||||
down ip addr del 10.40.36.34/24 dev vlan36
|
||||
down up link set down dev vlan36
|
1
bgp-intro/lxc/H6/rootfs/etc/bird/bird.conf
Normal file
1
bgp-intro/lxc/H6/rootfs/etc/bird/bird.conf
Normal file
@ -0,0 +1 @@
|
||||
|
1
bgp-intro/lxc/H6/rootfs/etc/bird/bird6.conf
Normal file
1
bgp-intro/lxc/H6/rootfs/etc/bird/bird6.conf
Normal file
@ -0,0 +1 @@
|
||||
|
14
bgp-intro/lxc/H6/rootfs/etc/network/interfaces
Normal file
14
bgp-intro/lxc/H6/rootfs/etc/network/interfaces
Normal file
@ -0,0 +1,14 @@
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
auto vlan2
|
||||
iface vlan2 inet manual
|
||||
up ip link set up dev vlan2
|
||||
up ip addr add 10.40.2.6/24 brd + dev vlan2
|
||||
up ip addr add 2001:db8:40:2::6/120 dev vlan2
|
||||
up ip route add default via 10.40.2.1 dev vlan2
|
||||
up ip route add default via 2001:db8:40:2::1 dev vlan2
|
||||
down ip route -6 del default
|
||||
down ip addr del 2001:db8:40:2::6/120 dev vlan2
|
||||
down ip addr del 10.40.2.6/24 dev vlan2
|
||||
down up link set down dev vlan2
|
1
bgp-intro/lxc/H7/rootfs/etc/bird/bird.conf
Normal file
1
bgp-intro/lxc/H7/rootfs/etc/bird/bird.conf
Normal file
@ -0,0 +1 @@
|
||||
|
1
bgp-intro/lxc/H7/rootfs/etc/bird/bird6.conf
Normal file
1
bgp-intro/lxc/H7/rootfs/etc/bird/bird6.conf
Normal file
@ -0,0 +1 @@
|
||||
|
14
bgp-intro/lxc/H7/rootfs/etc/network/interfaces
Normal file
14
bgp-intro/lxc/H7/rootfs/etc/network/interfaces
Normal file
@ -0,0 +1,14 @@
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
auto vlan3
|
||||
iface vlan3 inet manual
|
||||
up ip link set up dev vlan3
|
||||
up ip addr add 10.40.3.7/24 brd + dev vlan3
|
||||
up ip addr add 2001:db8:40:3::7/120 dev vlan3
|
||||
up ip route add default via 10.40.3.1 dev vlan3
|
||||
up ip route add default via 2001:db8:40:3::1 dev vlan3
|
||||
down ip route -6 del default
|
||||
down ip addr del 2001:db8:40:3::7/120 dev vlan3
|
||||
down ip addr del 10.40.3.7/24 dev vlan3
|
||||
down up link set down dev vlan3
|
26
bgp-intro/lxc/R0/rootfs/etc/bird/bird.conf
Normal file
26
bgp-intro/lxc/R0/rootfs/etc/bird/bird.conf
Normal file
@ -0,0 +1,26 @@
|
||||
router id 10.40.217.0;
|
||||
|
||||
log "/var/log/bird/bird.log" all;
|
||||
debug protocols { states, routes, filters, interfaces }
|
||||
|
||||
protocol kernel {
|
||||
import none;
|
||||
export all;
|
||||
}
|
||||
|
||||
protocol device {
|
||||
# defaults...
|
||||
}
|
||||
|
||||
protocol ospf {
|
||||
area 0 {
|
||||
interface "lo" {
|
||||
stub;
|
||||
};
|
||||
interface "vlan216" {
|
||||
};
|
||||
interface "vlan2" {
|
||||
stub;
|
||||
};
|
||||
};
|
||||
}
|
25
bgp-intro/lxc/R0/rootfs/etc/bird/bird6.conf
Normal file
25
bgp-intro/lxc/R0/rootfs/etc/bird/bird6.conf
Normal file
@ -0,0 +1,25 @@
|
||||
router id 10.40.217.0;
|
||||
|
||||
log "/var/log/bird/bird6.log" all;
|
||||
debug protocols { states, routes, filters, interfaces }
|
||||
|
||||
protocol kernel {
|
||||
import none;
|
||||
export all;
|
||||
}
|
||||
|
||||
protocol device {
|
||||
# defaults...
|
||||
}
|
||||
|
||||
protocol ospf {
|
||||
area 0 {
|
||||
# BIRD ignores the IPv6 lo because it has no link local address
|
||||
stubnet 2001:db8:40::/128;
|
||||
interface "vlan216" {
|
||||
};
|
||||
interface "vlan2" {
|
||||
stub;
|
||||
};
|
||||
};
|
||||
}
|
24
bgp-intro/lxc/R0/rootfs/etc/network/interfaces
Normal file
24
bgp-intro/lxc/R0/rootfs/etc/network/interfaces
Normal file
@ -0,0 +1,24 @@
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
up ip addr add 10.40.217.0/32 dev lo
|
||||
up ip addr add 2001:db8:40:: dev lo
|
||||
down ip addr del 2001:db8:40:: dev lo
|
||||
down ip addr del 10.40.217.0/32 dev lo
|
||||
|
||||
auto vlan2
|
||||
iface vlan2 inet manual
|
||||
up ip link set up dev vlan2
|
||||
up ip addr add 10.40.2.1/24 brd + dev vlan2
|
||||
up ip addr add 2001:db8:40:2::1/120 dev vlan2
|
||||
down ip addr del 2001:db8:40:2::1/120 dev vlan2
|
||||
down ip addr del 10.40.2.1/24 dev vlan2
|
||||
down up link set down dev vlan2
|
||||
|
||||
auto vlan216
|
||||
iface vlan216 inet manual
|
||||
up ip link set up dev vlan216
|
||||
up ip addr add 10.40.216.2/28 brd + dev vlan216
|
||||
up ip addr add 2001:db8:40:d8::2/120 dev vlan216
|
||||
down ip addr del 2001:db8:40:d8::2/120 dev vlan216
|
||||
down ip addr del 10.40.216.2/28 dev vlan216
|
||||
down up link set down dev vlan216
|
26
bgp-intro/lxc/R1/rootfs/etc/bird/bird.conf
Normal file
26
bgp-intro/lxc/R1/rootfs/etc/bird/bird.conf
Normal file
@ -0,0 +1,26 @@
|
||||
router id 10.40.217.1;
|
||||
|
||||
log "/var/log/bird/bird.log" all;
|
||||
debug protocols { states, routes, filters, interfaces }
|
||||
|
||||
protocol kernel {
|
||||
import none;
|
||||
export all;
|
||||
}
|
||||
|
||||
protocol device {
|
||||
# defaults...
|
||||
}
|
||||
|
||||
protocol ospf {
|
||||
area 0 {
|
||||
interface "lo" {
|
||||
stub;
|
||||
};
|
||||
interface "vlan216" {
|
||||
};
|
||||
interface "vlan3" {
|
||||
stub;
|
||||
};
|
||||
};
|
||||
}
|
25
bgp-intro/lxc/R1/rootfs/etc/bird/bird6.conf
Normal file
25
bgp-intro/lxc/R1/rootfs/etc/bird/bird6.conf
Normal file
@ -0,0 +1,25 @@
|
||||
router id 10.40.217.1;
|
||||
|
||||
log "/var/log/bird/bird6.log" all;
|
||||
debug protocols { states, routes, filters, interfaces }
|
||||
|
||||
protocol kernel {
|
||||
import none;
|
||||
export all;
|
||||
}
|
||||
|
||||
protocol device {
|
||||
# defaults...
|
||||
}
|
||||
|
||||
protocol ospf {
|
||||
area 0 {
|
||||
# BIRD ignores the IPv6 lo because it has no link local address
|
||||
stubnet 2001:db8:40::1/128;
|
||||
interface "vlan216" {
|
||||
};
|
||||
interface "vlan3" {
|
||||
stub;
|
||||
};
|
||||
};
|
||||
}
|
24
bgp-intro/lxc/R1/rootfs/etc/network/interfaces
Normal file
24
bgp-intro/lxc/R1/rootfs/etc/network/interfaces
Normal file
@ -0,0 +1,24 @@
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
up ip addr add 10.40.217.1/32 dev lo
|
||||
up ip addr add 2001:db8:40::1 dev lo
|
||||
down ip addr del 2001:db8:40::1 dev lo
|
||||
down ip addr del 10.40.217.1/32 dev lo
|
||||
|
||||
auto vlan3
|
||||
iface vlan3 inet manual
|
||||
up ip link set up dev vlan3
|
||||
up ip addr add 10.40.3.1/24 brd + dev vlan3
|
||||
up ip addr add 2001:db8:40:3::1/120 dev vlan3
|
||||
down ip addr del 2001:db8:40:3::1/120 dev vlan3
|
||||
down ip addr del 10.40.3.1/24 dev vlan3
|
||||
down up link set down dev vlan3
|
||||
|
||||
auto vlan216
|
||||
iface vlan216 inet manual
|
||||
up ip link set up dev vlan216
|
||||
up ip addr add 10.40.216.3/28 brd + dev vlan216
|
||||
up ip addr add 2001:db8:40:d8::3/120 dev vlan216
|
||||
down ip addr del 2001:db8:40:d8::3/120 dev vlan216
|
||||
down ip addr del 10.40.216.3/28 dev vlan216
|
||||
down up link set down dev vlan216
|
26
bgp-intro/lxc/R10/rootfs/etc/bird/bird.conf
Normal file
26
bgp-intro/lxc/R10/rootfs/etc/bird/bird.conf
Normal file
@ -0,0 +1,26 @@
|
||||
router id 10.40.32.10;
|
||||
|
||||
log "/var/log/bird/bird.log" all;
|
||||
debug protocols { states, routes, filters, interfaces }
|
||||
|
||||
protocol kernel {
|
||||
import none;
|
||||
export all;
|
||||
}
|
||||
|
||||
protocol device {
|
||||
# defaults...
|
||||
}
|
||||
|
||||
protocol ospf {
|
||||
area 0 {
|
||||
interface "lo" {
|
||||
stub;
|
||||
};
|
||||
interface "vlan33" {
|
||||
};
|
||||
interface "vlan217" {
|
||||
stub;
|
||||
};
|
||||
};
|
||||
}
|
25
bgp-intro/lxc/R10/rootfs/etc/bird/bird6.conf
Normal file
25
bgp-intro/lxc/R10/rootfs/etc/bird/bird6.conf
Normal file
@ -0,0 +1,25 @@
|
||||
router id 10.40.32.10;
|
||||
|
||||
log "/var/log/bird/bird6.log" all;
|
||||
debug protocols { states, routes, filters, interfaces }
|
||||
|
||||
protocol kernel {
|
||||
import none;
|
||||
export all;
|
||||
}
|
||||
|
||||
protocol device {
|
||||
# defaults...
|
||||
}
|
||||
|
||||
protocol ospf {
|
||||
area 0 {
|
||||
# BIRD ignores the IPv6 lo because it has no link local address
|
||||
stubnet 2001:db8:10:6::a/128;
|
||||
interface "vlan33" {
|
||||
};
|
||||
interface "vlan217" {
|
||||
stub;
|
||||
};
|
||||
};
|
||||
}
|
24
bgp-intro/lxc/R10/rootfs/etc/network/interfaces
Normal file
24
bgp-intro/lxc/R10/rootfs/etc/network/interfaces
Normal file
@ -0,0 +1,24 @@
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
up ip addr add 10.40.32.10/32 dev lo
|
||||
up ip addr add 2001:db8:10:6::a dev lo
|
||||
down ip addr del 2001:db8:10:6::a dev lo
|
||||
down ip addr del 10.40.32.10/32 dev lo
|
||||
|
||||
auto vlan33
|
||||
iface vlan33 inet manual
|
||||
up ip link set up dev vlan33
|
||||
up ip addr add 10.40.33.1/26 brd + dev vlan33
|
||||
up ip addr add 2001:db8:10:21::1/120 dev vlan33
|
||||
down ip addr del 2001:db8:10:21::1/120 dev vlan33
|
||||
down ip addr del 10.40.33.1/26 dev vlan33
|
||||
down up link set down dev vlan33
|
||||
|
||||
auto vlan217
|
||||
iface vlan217 inet manual
|
||||
up ip link set up dev vlan217
|
||||
up ip addr add 10.40.217.18/30 brd + dev vlan217
|
||||
up ip addr add 2001:db8:40:d910::2/120 dev vlan217
|
||||
down ip addr del 2001:db8:40:d910::2/120 dev vlan217
|
||||
down ip addr del 10.40.217.18/30 dev vlan217
|
||||
down up link set down dev vlan217
|
26
bgp-intro/lxc/R11/rootfs/etc/bird/bird.conf
Normal file
26
bgp-intro/lxc/R11/rootfs/etc/bird/bird.conf
Normal file
@ -0,0 +1,26 @@
|
||||
router id 10.40.32.11;
|
||||
|
||||
log "/var/log/bird/bird.log" all;
|
||||
debug protocols { states, routes, filters, interfaces }
|
||||
|
||||
protocol kernel {
|
||||
import none;
|
||||
export all;
|
||||
}
|
||||
|
||||
protocol device {
|
||||
# defaults...
|
||||
}
|
||||
|
||||
protocol ospf {
|
||||
area 0 {
|
||||
interface "lo" {
|
||||
stub;
|
||||
};
|
||||
interface "vlan33" {
|
||||
};
|
||||
interface "vlan48" {
|
||||
stub;
|
||||
};
|
||||
};
|
||||
}
|
25
bgp-intro/lxc/R11/rootfs/etc/bird/bird6.conf
Normal file
25
bgp-intro/lxc/R11/rootfs/etc/bird/bird6.conf
Normal file
@ -0,0 +1,25 @@
|
||||
router id 10.40.32.11;
|
||||
|
||||
log "/var/log/bird/bird6.log" all;
|
||||
debug protocols { states, routes, filters, interfaces }
|
||||
|
||||
protocol kernel {
|
||||
import none;
|
||||
export all;
|
||||
}
|
||||
|
||||
protocol device {
|
||||
# defaults...
|
||||
}
|
||||
|
||||
protocol ospf {
|
||||
area 0 {
|
||||
# BIRD ignores the IPv6 lo because it has no link local address
|
||||
stubnet 2001:db8:10:6::b/128;
|
||||
interface "vlan33" {
|
||||
};
|
||||
interface "vlan48" {
|
||||
stub;
|
||||
};
|
||||
};
|
||||
}
|
24
bgp-intro/lxc/R11/rootfs/etc/network/interfaces
Normal file
24
bgp-intro/lxc/R11/rootfs/etc/network/interfaces
Normal file
@ -0,0 +1,24 @@
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
up ip addr add 10.40.32.11/32 dev lo
|
||||
up ip addr add 2001:db8:10:6::b dev lo
|
||||
down ip addr del 2001:db8:10:6::b dev lo
|
||||
down ip addr del 10.40.32.11/32 dev lo
|
||||
|
||||
auto vlan48
|
||||
iface vlan48 inet manual
|
||||
up ip link set up dev vlan48
|
||||
up ip addr add 10.40.48.1/21 brd + dev vlan48
|
||||
up ip addr add 2001:db8:10:30::1/117 dev vlan48
|
||||
down ip addr del 2001:db8:10:30::1/117 dev vlan48
|
||||
down ip addr del 10.40.48.1/21 dev vlan48
|
||||
down up link set down dev vlan48
|
||||
|
||||
auto vlan33
|
||||
iface vlan33 inet manual
|
||||
up ip link set up dev vlan33
|
||||
up ip addr add 10.40.33.2/26 brd + dev vlan33
|
||||
up ip addr add 2001:db8:10:21::2/120 dev vlan33
|
||||
down ip addr del 2001:db8:10:21::2/120 dev vlan33
|
||||
down ip addr del 10.40.33.2/26 dev vlan33
|
||||
down up link set down dev vlan33
|
26
bgp-intro/lxc/R12/rootfs/etc/bird/bird.conf
Normal file
26
bgp-intro/lxc/R12/rootfs/etc/bird/bird.conf
Normal file
@ -0,0 +1,26 @@
|
||||
router id 10.40.32.12;
|
||||
|
||||
log "/var/log/bird/bird.log" all;
|
||||
debug protocols { states, routes, filters, interfaces }
|
||||
|
||||
protocol kernel {
|
||||
import none;
|
||||
export all;
|
||||
}
|
||||
|
||||
protocol device {
|
||||
# defaults...
|
||||
}
|
||||
|
||||
protocol ospf {
|
||||
area 0 {
|
||||
interface "lo" {
|
||||
stub;
|
||||
};
|
||||
interface "vlan33" {
|
||||
};
|
||||
interface "vlan36" {
|
||||
stub;
|
||||
};
|
||||
};
|
||||
}
|
25
bgp-intro/lxc/R12/rootfs/etc/bird/bird6.conf
Normal file
25
bgp-intro/lxc/R12/rootfs/etc/bird/bird6.conf
Normal file
@ -0,0 +1,25 @@
|
||||
router id 10.40.32.12;
|
||||
|
||||
log "/var/log/bird/bird6.log" all;
|
||||
debug protocols { states, routes, filters, interfaces }
|
||||
|
||||
protocol kernel {
|
||||
import none;
|
||||
export all;
|
||||
}
|
||||
|
||||
protocol device {
|
||||
# defaults...
|
||||
}
|
||||
|
||||
protocol ospf {
|
||||
area 0 {
|
||||
# BIRD ignores the IPv6 lo because it has no link local address
|
||||
stubnet 2001:db8:10:6::c/128;
|
||||
interface "vlan33" {
|
||||
};
|
||||
interface "vlan36" {
|
||||
stub;
|
||||
};
|
||||
};
|
||||
}
|
24
bgp-intro/lxc/R12/rootfs/etc/network/interfaces
Normal file
24
bgp-intro/lxc/R12/rootfs/etc/network/interfaces
Normal file
@ -0,0 +1,24 @@
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
up ip addr add 10.40.32.12/32 dev lo
|
||||
up ip addr add 2001:db8:10:6::c dev lo
|
||||
down ip addr del 2001:db8:10:6::c dev lo
|
||||
down ip addr del 10.40.32.12/32 dev lo
|
||||
|
||||
auto vlan36
|
||||
iface vlan36 inet manual
|
||||
up ip link set up dev vlan36
|
||||
up ip addr add 10.40.36.1/24 brd + dev vlan36
|
||||
up ip addr add 2001:db8:10:24::1/120 dev vlan36
|
||||
down ip addr del 2001:db8:10:24::1/120 dev vlan36
|
||||
down ip addr del 10.40.36.1/24 dev vlan36
|
||||
down up link set down dev vlan36
|
||||
|
||||
auto vlan33
|
||||
iface vlan33 inet manual
|
||||
up ip link set up dev vlan33
|
||||
up ip addr add 10.40.33.3/26 brd + dev vlan33
|
||||
up ip addr add 2001:db8:10:21::3/120 dev vlan33
|
||||
down ip addr del 2001:db8:10:21::3/120 dev vlan33
|
||||
down ip addr del 10.40.33.3/26 dev vlan33
|
||||
down up link set down dev vlan33
|
26
bgp-intro/lxc/R3/rootfs/etc/bird/bird.conf
Normal file
26
bgp-intro/lxc/R3/rootfs/etc/bird/bird.conf
Normal file
@ -0,0 +1,26 @@
|
||||
router id 10.40.217.3;
|
||||
|
||||
log "/var/log/bird/bird.log" all;
|
||||
debug protocols { states, routes, filters, interfaces }
|
||||
|
||||
protocol kernel {
|
||||
import none;
|
||||
export all;
|
||||
}
|
||||
|
||||
protocol device {
|
||||
# defaults...
|
||||
}
|
||||
|
||||
protocol ospf {
|
||||
area 0 {
|
||||
interface "lo" {
|
||||
stub;
|
||||
};
|
||||
interface "vlan216" {
|
||||
};
|
||||
interface "vlan217" {
|
||||
stub;
|
||||
};
|
||||
};
|
||||
}
|
25
bgp-intro/lxc/R3/rootfs/etc/bird/bird6.conf
Normal file
25
bgp-intro/lxc/R3/rootfs/etc/bird/bird6.conf
Normal file
@ -0,0 +1,25 @@
|
||||
router id 10.40.217.3;
|
||||
|
||||
log "/var/log/bird/bird6.log" all;
|
||||
debug protocols { states, routes, filters, interfaces }
|
||||
|
||||
protocol kernel {
|
||||
import none;
|
||||
export all;
|
||||
}
|
||||
|
||||
protocol device {
|
||||
# defaults...
|
||||
}
|
||||
|
||||
protocol ospf {
|
||||
area 0 {
|
||||
# BIRD ignores the IPv6 lo because it has no link local address
|
||||
stubnet 2001:db8:40::3/128;
|
||||
interface "vlan216" {
|
||||
};
|
||||
interface "vlan217" {
|
||||
stub;
|
||||
};
|
||||
};
|
||||
}
|
24
bgp-intro/lxc/R3/rootfs/etc/network/interfaces
Normal file
24
bgp-intro/lxc/R3/rootfs/etc/network/interfaces
Normal file
@ -0,0 +1,24 @@
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
up ip addr add 10.40.217.3/32 dev lo
|
||||
up ip addr add 2001:db8:40::3 dev lo
|
||||
down ip addr del 2001:db8:40::3 dev lo
|
||||
down ip addr del 10.40.217.3/32 dev lo
|
||||
|
||||
auto vlan216
|
||||
iface vlan216 inet manual
|
||||
up ip link set up dev vlan216
|
||||
up ip addr add 10.40.216.1/28 brd + dev vlan216
|
||||
up ip addr add 2001:db8:40:d8::1/120 dev vlan216
|
||||
down ip addr del 2001:db8:40:d8::1/120 dev vlan216
|
||||
down ip addr del 10.40.216.1/28 dev vlan216
|
||||
down up link set down dev vlan216
|
||||
|
||||
auto vlan217
|
||||
iface vlan217 inet manual
|
||||
up ip link set up dev vlan217
|
||||
up ip addr add 10.40.217.17/30 brd + dev vlan217
|
||||
up ip addr add 2001:db8:40:d910::1/120 dev vlan217
|
||||
down ip addr del 2001:db8:40:d910::1/120 dev vlan217
|
||||
down ip addr del 10.40.217.17/30 dev vlan217
|
||||
down up link set down dev vlan217
|
161
bgp-intro/lxc/fixnetwork.sh
Normal file
161
bgp-intro/lxc/fixnetwork.sh
Normal file
@ -0,0 +1,161 @@
|
||||
#!/bin/sh
|
||||
|
||||
sed -i '/lxc.network/d' R*/config H*/config
|
||||
|
||||
cat <<EOF >> H6/config
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan2
|
||||
lxc.network.veth.pair = h6.2
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:02:06
|
||||
EOF
|
||||
|
||||
cat <<EOF >> R0/config
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan216
|
||||
lxc.network.veth.pair = r0.216
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:d8:02
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan2
|
||||
lxc.network.veth.pair = r0.2
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:02:01
|
||||
EOF
|
||||
|
||||
cat <<EOF >> H7/config
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan3
|
||||
lxc.network.veth.pair = h7.3
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:03:07
|
||||
EOF
|
||||
|
||||
cat <<EOF >> R1/config
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan216
|
||||
lxc.network.veth.pair = r1.216
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:d8:03
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan3
|
||||
lxc.network.veth.pair = r1.3
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:03:01
|
||||
EOF
|
||||
|
||||
cat <<EOF >> R3/config
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan216
|
||||
lxc.network.veth.pair = r3.216
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:d8:01
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan217
|
||||
lxc.network.veth.pair = r3.217
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:d9:10
|
||||
EOF
|
||||
|
||||
cat <<EOF >> R10/config
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan33
|
||||
lxc.network.veth.pair = r10.33
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:21:01
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan217
|
||||
lxc.network.veth.pair = r10.217
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:d9:11
|
||||
EOF
|
||||
|
||||
cat <<EOF >> R11/config
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan33
|
||||
lxc.network.veth.pair = r11.33
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:21:02
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan48
|
||||
lxc.network.veth.pair = r11.48
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:30:01
|
||||
EOF
|
||||
|
||||
cat <<EOF >> H19/config
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan48
|
||||
lxc.network.veth.pair = h19.48
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:34:13
|
||||
EOF
|
||||
|
||||
cat <<EOF >> R12/config
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan33
|
||||
lxc.network.veth.pair = r12.33
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:21:03
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan36
|
||||
lxc.network.veth.pair = r12.36
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:24:01
|
||||
EOF
|
||||
|
||||
cat <<EOF >> H34/config
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.name = vlan36
|
||||
lxc.network.veth.pair = h34.36
|
||||
lxc.network.script.up = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.script.down = /etc/lxc/lxc-openvswitch
|
||||
lxc.network.hwaddr = 02:00:0a:28:24:22
|
||||
EOF
|
Loading…
x
Reference in New Issue
Block a user