Herzlichen Glückwunsch! Sie dürfen ein Netzwerk mit mehr als 2 Routern administrieren. Dieser Vortrag erläutert, warum statisches Routing keine Lösung ist und schneller als einem lieb ist zum Problem werden kann. Als Einführung in dynamisches Routing und OSPF, erklärt dieser Vortrag wie sich Router gegenseitig finden, Routen austauschen, was eine Area ist und wie die Link-State Datenbank funktioniert.
OSPF wird praktisch am Beispiel des Bird Internet Routing Daemons und in Zusammenspiel mit klassischen Herstellern gezeigt.
Dynamische Routingprotokolle Aufzucht und Pflege - OSPF
1. Open Shortest Path First
FrOSCon 13 Network Track
Falk Stern, Maximilian Wilhelm
1 / 39
2. Agenda
1. Who's who
2. Static Routing
3. Dynamic Routing
1. RIP - Distance Vector
2. OSPF - Link State Routing
4. OSPF on Linux (Bird)
5. OSPF on Vendor Hardware
6. Summary
2 / 39
3. Who's who Falk Stern
Full Stack Infrastructure Engineer
IPv6 fanboy
Runs his own Kubernetes cluster in his basement
Consultant @ Profi Engineering Systems AG
Contact
@wrf42
falk@fourecks.de
3 / 39
4. Who's who Maximilian Wilhelm
Networker
OpenSource Hacker
Fanboy of
(Debian) Linux
ifupdown2
Occupation:
By day: Senior Infrastructure Architect, Uni Paderborn
By night: Infrastructure Archmage, Freifunk Hochstift
In between: Freelance Solution Architect for hire
Contact
@BarbarossaTM
max@sdn.clinic
4 / 39
6. Who's who
Theory
Static Routing
Every host on the network has to be told how to reach different subnets
Everything has to be configured by hand
Work scales exponentially
If you miss a system, it doesn't work
Don't do this
6 / 39
7. Who's who
Theory
Dynamic Routing
Systems propagate their routing information to other systems
Paths to new networks are added automatically
Only initial configuration required when adding a router
Two types of routing protocols
Interior Gateway Protocols (IGP)
RIP
OSPF
IS-IS
EIGRP
Exterior Gateway Protocols (EGP)
BGP
7 / 39
8. Who's who
Theory
Distance Vector
Routers always send their complete routing table with increased metrics
Metrics are counted to infinity where infinity = 15
Example: Routing Information Protocol (RIP)
8 / 39
9. Who's who
Theory
Link State Routing
In a hierarchical area, routers only send their linkstates
Between areas, linkstates are summarized
Every router calculates its own routing table, based on received LSAs*
LSAs include metrics, bandwidth or other information
Metrics are calculated based on interface costs
Examples:
Open Shortest Path First Protocol (OSPF)
Intermediate System to Intermediate System (IS-IS)
Paths are calculated with the Dijkstra algorithm
https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
*Link State Advertisments 9 / 39
11. Who's who
Theory
OSPF
What is OSPF?
Open Source implementation of a Link State Routing Protocol
OSPF v2
Defined in RFC1247
Supports only IPv4
OSPF v3
Defined in RFC5838 and RFC6969
Supports IPv4 and IPv6 but requires IPv6 to work
Implemented in all major routing suites and vendors
Interoperable
Uses fixed multicast addresses
224.0.0.5 (ospf-all.mcast.net)
224.0.0.6 (ospf-dsig.mcast.net)
11 / 39
13. Who's who
Theory
OSPF
Roles
Designated Router (DR) / Backup Designated Router (BDR)
The DR synchronizes all LSAs in a broadcast network, the BDR is it's backup
BDR takes over when DR fails and a new BDR is elected
Originates LSAs to other areas on behalf of the network
13 / 39
14. Who's who
Theory
OSPF
Roles
Area Border Router (ABR)
Has interfaces in at least 2 areas
Autonomous System Boundary Router (ASBR)
Has interfaces outside the AS
14 / 39
15. Who's who
Theory
OSPF
Link State Advertisements
Type 1 - Represents a router
Type 2 - Represents the pseudonode (designated router) for a multiaccess link
Type 3 - A network link summary (internal route)
Type 4 - Represents an ASBR
Type 5 - A route external to the OSPF domain
Type 7 - Used in NSSA in place of a type 5 LSA
15 / 39
16. Who's who
Theory
OSPF
Areas
OSPF Networks can be split into multiple areas
Area 0 defined as backbone area
Each area has to be connected to area 0
If it can't be connected to area 0, you have to define virtual links
Traffic between areas always traverses area 0
Keep it simple: no need for multiple areas with less than 60 routers
Area 0
CoreBorder
Internet
br-01 cr-E cr-A
cr-D cr-B
cr-C
ASBR
dr-02
16 / 39
21. Who's who
Theory
OSPF
Route Types
1. Intra-Area (O)
2. Inter-Area (O IA)
3. External Type 1 (E1)
4. NSSA External Type 1 (N1)
5. External Type 2 (E2)
6. NSSA External Type 2 (N2)
Routes are preferred in this order as of RFC3101
21 / 39
24. Who's who
Theory
OSPF
Linux
OSPF on Linux / Bird
Some Routing Daemon required
We'll use Bird Internet Routing Daemon (Bird)
Implements OSPF & BGP
One daemon for IPv4, one for IPv6
Configured via /etc/bird/bird{,6}.conf
Controlled by birdc / birdc6 CLI tool
http://bird.network.cz/
Use version >= 1.6.3
24 / 39
25. Who's who
Theory
OSPF
Linux
Bird con guration (common)
# /etc/bird/bird6.conf
# ID of this router (32bit value) - usually it's the loopback Legacy-IP
router id 194.107.207.0;
# This pseudo-protocol watches all interface up/down events.
protocol device {
scan time 10; # Scan interfaces every 10 seconds
}
protocol kernel {
# learn; # Learn all alien routes from the kernel
# persist; # Don't remove routes on bird shutdown
import none; # Don't import any route from the kernel into bird
export all; # Export all routers from bird into kernel routing table
# kernel table 5; # Kernel table to synchronize with (default: main)
}
# Read further config snippets for IPv6 daemon
include "/etc/bird/bird6.d/*.conf";
25 / 39
26. Who's who
Theory
OSPF
Linux
Bird con guration (OSPF IPv4)
#
# /etc/bird/bird.d/ospf.conf
#
protocol ospf IGP {
import all;
export none;
# Backbone Area
area 0 {
# Use Loopback as passive interface
interface "lo" {
stub yes;
};
# X-Link cr-E
interface "eth1";
};
}
26 / 39
27. Who's who
Theory
OSPF
Linux
Bird con guration (OSPF IPv6/simple)
#
# /etc/bird/bird6.d/ospf.conf
#
protocol direct lo_v6 {
interface "lo";
}
protocol ospf IGP {
import all;
export where proto = "lo_v6";
area 0 {
interface "lo" {
stub yes;
};
# X-Link cr-E
interface "eth1";
};
}
27 / 39
28. Who's who
Theory
OSPF
Linux
Bird con guration (OSPF IPv6/Adv.)
#
# /etc/bird/bird6.d/ospf.conf
#
protocol direct lo_v6 {
interface "lo";
}
protocol ospf IGP {
import all;
export filter {
if proto = "lo_v6" then {
ospf_metric1 = 100;
accept;
}
};
area 0 {
interface "lo" {
stub yes;
};
# X-Link cr-E
interface "eth1";
};
}
28 / 39
29. Who's who
Theory
OSPF
Linux
Bird con guration management
Bird daemon can be controlled by birdc6 (or birdc respectivly)
br-01.in.fc13.sdn.clinic:~# birdc6
BIRD 1.6.3 ready.
bird>
Interactive shell allows shortcuts and TAB completion
Use ? for help
Commands can be given on shell command line, too
br-01.in.fc13.sdn.clinic:~# birdc6 "show route ::/0"
BIRD 1.6.3 ready.
bird> show route ::/0
::/0 via 2a03:2260:0:1aa::1 on ... [as201701_a 2018-08-17] * (100) [AS201701i]
via 2a03:2260:0:1ab::1 on ... [as201701_b 2018-08-19] (100) [AS201701i]
29 / 39
30. Who's who
Theory
OSPF
Linux
Bird con guration management
Useful commands
# Reload configuration from disk
configure
# Show interfaces configured for OSPF
show ospf interfaces
# Show OSPF neighbors and their state
show ospf neighbors
# Show OSPF link state database
show ospf lsadb
30 / 39
31. Who's who
Theory
OSPF
Linux
Bird con guration management
# Display route(s)
show route [all] [primary]
show route for <prefix> all
# Show configured protocols with their state (OSPF, direct, static, kernel...)
show protocols
# Show routes of a specific protocol
show route protocol <protocol>
# Count number of prefixes
show route [protocol <protocol>] count [primary]
31 / 39
33. Who's who
Theory
OSPF
Linux
Vendors
And now about vendor OSPF con g (Cisco IOS)
! Legacy-IP
router ospf 1
! Log if things happen
log-adjacency-changes
! By default we don't talk OSPF to neighbors
passive-interface default
! On these interfaces we do
no passive-interface GigabitEthernet1/0/1
no passive-interface GigabitEthernet1/0/2
! IP
! Explicitly enable IPv6 routing
ipv6 unicast-routing
ipv6 router ospf 1
log-adjacency-changes
passive-interface default
no passive-interface GigabitEthernet1/0/1
no passive-interface GigabitEthernet1/0/2
33 / 39
34. Who's who
Theory
OSPF
Linux
Vendors
And now about vendor OSPF con g (Cisco IOS)
interface Loopback0
ip address 194.107.207.7 255.255.255.255
ip ospf 1 area 0
ipv6 enable
ipv6 address 2A07:ED07:FC13:FFFF::7/128
ipv6 ospf 1 area 0
!
interface GigabitEthernet1/0/1
description -> cr-A
no switchport
ip address 194.107.207.37 255.255.255.254
ip ospf 1 area 0
ipv6 enable
ipv6 address 2A07:ED07:FC13:FE05::2/126
ipv6 ospf 1 area 0
!
interface GigabitEthernet1/0/2
description cr-B
no switchport
ip address 194.107.207.35 255.255.255.254
ip ospf 1 area 0
ipv6 enable
ipv6 ospf 1 area 0
34 / 39
35. Who's who
Theory
OSPF
Linux
Vendors
And now about vendor OSPF con g (Cisco IOS)
IPv6, the second class citizen...
dr-02.in.fc13.sdn.cl(config)#sdm prefer dual-ipv4-and-ipv6 routing
Changes to the running SDM preferences have been stored, but cannot take effect
until the next reload.
Use 'show sdm prefer' to see what SDM preference is currently active.
dr-02.in.fc13.sdn.cl(config)#ipv6 router ospf 1
% IPv6 routing not enabled
dr-02.in.fc13.sdn.cl(config)#ipv6 unicast-routing
dr-02.in.fc13.sdn.cl(config)#ipv6 router ospf 1
dr-02.in.fc13.sdn.cl(config-rtr)#
dr-02.in.fc13.sdn.cl(config-if)#ipv6 ospf 1 area 0
OSPFv3: No IPV6 enabled on this interface
dr-02.in.fc13.sdn.cl(config-if)#ipv6 enable
dr-02.in.fc13.sdn.cl(config-if)#ipv6 ospf 1 area 0
dr-02.in.fc13.sdn.cl(config-if)#
35 / 39
37. Who's who
Theory
OSPF
Linux
Takeaways
Key takeaways
Don't do static routing
OSPF is a go-to IGP
It's interoperable and platform independent
Use only Area 0 unless you REALLY need more
Bird is a versatile multi platform routing daemon
37 / 39