Browse code

Adding BIRD

Veselin Kolev authored on 16/12/2019 08:02:06
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,281 @@
1
+# This is a basic configuration file, which contains boilerplate options and
2
+# some basic examples. It allows the BIRD daemon to start but will not cause
3
+# anything else to happen.
4
+#
5
+# Please refer to the BIRD User's Guide documentation, which is also available
6
+# online at http://bird.network.cz/ in HTML format, for more information on
7
+# configuring BIRD and adding routing protocols.
8
+
9
+# Configure logging
10
+log syslog all;
11
+# log "/var/log/bird.log" { debug, trace, info, remote, warning, error, auth, fatal, bug };
12
+
13
+# Set router ID. It is a unique identification of your router, usually one of
14
+# IPv4 addresses of the router. It is recommended to configure it explicitly.
15
+router id 62.44.96.202;
16
+
17
+# Turn on global debugging of all protocols (all messages or just selected classes)
18
+# debug protocols all;
19
+# debug protocols { events, states };
20
+
21
+# Turn on internal watchdog
22
+# watchdog warning 5 s;
23
+# watchdog timeout 30 s;
24
+
25
+# You can define your own constants
26
+# define my_asn = 65000;
27
+# define my_addr = 198.51.100.1;
28
+
29
+# Tables master4 and master6 are defined by default
30
+# ipv4 table master4;
31
+# ipv6 table master6;
32
+
33
+# Define more tables, e.g. for policy routing or as MRIB
34
+# ipv4 table mrib4;
35
+# ipv6 table mrib6;
36
+
37
+# The Device protocol is not a real routing protocol. It does not generate any
38
+# routes and it only serves as a module for getting information about network
39
+# interfaces from the kernel. It is necessary in almost any configuration.
40
+protocol device {
41
+}
42
+
43
+# The direct protocol is not a real routing protocol. It automatically generates
44
+# direct routes to all network interfaces. Can exist in as many instances as you
45
+# wish if you want to populate multiple routing tables with direct routes.
46
+protocol direct {
47
+#	disabled;		# Disable by default
48
+	ipv4;			# Connect to default IPv4 table
49
+	ipv6;			# ... and to default IPv6 table
50
+}
51
+
52
+# The Kernel protocol is not a real routing protocol. Instead of communicating
53
+# with other routers in the network, it performs synchronization of BIRD
54
+# routing tables with the OS kernel. One instance per table.
55
+protocol kernel {
56
+	ipv4 {			# Connect protocol to IPv4 table by channel
57
+#	      table master4;	# Default IPv4 table is master4
58
+#	      import all;	# Import to table, default is import all
59
+	      export all;	# Export to protocol. default is export none
60
+	};
61
+#	learn;			# Learn alien routes from the kernel
62
+#	kernel table 10;	# Kernel table to synchronize with (default: main)
63
+}
64
+
65
+# Another instance for IPv6, skipping default options
66
+protocol kernel {
67
+	ipv6 { export all; };
68
+}
69
+
70
+# Static routes (Again, there can be multiple instances, for different address
71
+# families and to disable/enable various groups of static routes on the fly).
72
+protocol static {
73
+	ipv4;			# Again, IPv4 channel with default options
74
+
75
+#	route 0.0.0.0/0 via 198.51.100.10;
76
+#	route 192.0.2.0/24 blackhole;
77
+#	route 10.0.0.0/8 unreachable;
78
+#	route 10.2.0.0/24 via "eth0";
79
+#	# Static routes can be defined with optional attributes
80
+#	route 10.1.1.0/24 via 198.51.100.3 { rip_metric = 3; };
81
+#	route 10.1.2.0/24 via 198.51.100.3 { ospf_metric1 = 100; };
82
+#	route 10.1.3.0/24 via 198.51.100.4 { ospf_metric2 = 100; };
83
+}
84
+
85
+# Pipe protocol connects two routing tables. Beware of loops.
86
+# protocol pipe {
87
+#	table master4;		# No ipv4/ipv6 channel definition like in other protocols
88
+#	peer table mrib4;
89
+#	import all;		# Direction peer table -> table
90
+#	export all;		# Direction table -> peer table
91
+# }
92
+
93
+# RIP example, both RIP and RIPng are supported
94
+# protocol rip {
95
+#	ipv4 {
96
+#		# Export direct, static routes and ones from RIP itself
97
+#		import all;
98
+#		export where source ~ [ RTS_DEVICE, RTS_STATIC, RTS_RIP ];
99
+#	};
100
+#	interface "eth*" {
101
+#	  	update time 10;			# Default period is 30
102
+#		timeout time 60;		# Default timeout is 180
103
+#		authentication cryptographic;	# No authentication by default
104
+#		password "hello" { algorithm hmac sha256; }; # Default is MD5
105
+#	};
106
+# }
107
+
108
+# OSPF example, both OSPFv2 and OSPFv3 are supported
109
+# protocol ospf v3 {
110
+#  	ipv6 {
111
+#		import all;
112
+#		export where source = RTS_STATIC;
113
+#	};
114
+#	area 0 {
115
+#		interface "eth*" {
116
+#			type broadcast;		# Detected by default
117
+#			cost 10;		# Interface metric
118
+#			hello 5;		# Default hello perid 10 is too long
119
+#		};
120
+#		interface "tun*" {
121
+#			type ptp;		# PtP mode, avoids DR selection
122
+#			cost 100;		# Interface metric
123
+#			hello 5;		# Default hello perid 10 is too long
124
+#		};
125
+#		interface "dummy0" {
126
+#			stub;			# Stub interface, just propagate it
127
+#		};
128
+#	};
129
+#}
130
+
131
+# Define simple filter as an example for BGP import filter
132
+# See https://gitlab.labs.nic.cz/labs/bird/wikis/BGP_filtering for more examples
133
+# filter rt_import
134
+# {
135
+#	if bgp_path.first != 64496 then accept;
136
+#	if bgp_path.len > 64 then accept;
137
+#	if bgp_next_hop != from then accept;
138
+#	reject;
139
+# }
140
+
141
+function is_distributable_ipv4_network() {
142
+  return net ~ [
143
+     192.175.48.0/24
144
+#    172.20.0.0/14{21,29}, # dn42
145
+#    172.20.0.0/24{28,32}, # dn42 Anycast
146
+#    172.21.0.0/24{28,32}, # dn42 Anycast
147
+#    172.22.0.0/24{28,32}, # dn42 Anycast
148
+#    172.23.0.0/24{28,32}, # dn42 Anycast
149
+#    172.31.0.0/16+,       # ChaosVPN
150
+#    10.100.0.0/14+,       # ChaosVPN
151
+#    10.0.0.0/8{15,24}     # Freifunk.net
152
+  ];
153
+}
154
+
155
+function is_distributable_ipv6_network() {
156
+  return net ~ [
157
+     2620:4f:8000::/64
158
+#    172.20.0.0/14{21,29}, # dn42
159
+#    172.20.0.0/24{28,32}, # dn42 Anycast
160
+#    172.21.0.0/24{28,32}, # dn42 Anycast
161
+#    172.22.0.0/24{28,32}, # dn42 Anycast
162
+#    172.23.0.0/24{28,32}, # dn42 Anycast
163
+#    172.31.0.0/16+,       # ChaosVPN
164
+#    10.100.0.0/14+,       # ChaosVPN
165
+#    10.0.0.0/8{15,24}     # Freifunk.net
166
+  ];
167
+}
168
+
169
+
170
+filter export_ospf_v2
171
+{
172
+       if (is_distributable_ipv4_network()) && (source = RTS_DEVICE) then accept; else reject;
173
+}
174
+
175
+filter export_ospf_v3
176
+{
177
+       if (is_distributable_ipv6_network()) && (source = RTS_DEVICE) then accept; else reject;
178
+}
179
+
180
+
181
+protocol ospf v2 {
182
+        ipv4 {
183
+           import filter {
184
+              ospf_metric1 = 50;
185
+              accept;
186
+           };
187
+           export filter export_ospf_v2;
188
+        };
189
+        area 62.44.96.200 {
190
+                interface "virbr1" {
191
+                        type broadcast;         # Detected by default
192
+                        cost 10;                # Interface metric
193
+                        hello 5;                # Default hello perid 10 is too long
194
+                };
195
+        };
196
+}
197
+
198
+protocol ospf v3 {
199
+        ipv6 {
200
+           import filter {
201
+              ospf_metric1 = 50;
202
+              accept;
203
+           };
204
+           export filter export_ospf_v3;
205
+        };
206
+	area 62.44.96.200 {
207
+		interface "virbr1" {
208
+			type broadcast;		# Detected by default
209
+			cost 10;		# Interface metric
210
+			hello 5;		# Default hello perid 10 is too long
211
+		};
212
+	};
213
+}
214
+
215
+
216
+
217
+# BGP example, explicit name 'uplink1' is used instead of default 'bgp1'
218
+# protocol bgp uplink1 {
219
+#	description "My BGP uplink";
220
+#	local 198.51.100.1 as 65000;
221
+#	neighbor 198.51.100.10 as 64496;
222
+#	hold time 90;		# Default is 240
223
+#	password "secret";	# Password used for MD5 authentication
224
+#
225
+#	ipv4 {			# regular IPv4 unicast (1/1)
226
+#		import filter rt_import;
227
+#		export where source ~ [ RTS_STATIC, RTS_BGP ];
228
+#	};
229
+#
230
+#	ipv6 {			# regular IPv6 unicast (2/1)
231
+#		import filter rt_import;
232
+#		export filter {	# The same as 'where' expression above
233
+#			if source ~ [ RTS_STATIC, RTS_BGP ]
234
+#			then accept;
235
+#			else reject;
236
+#		};
237
+#	};
238
+#
239
+#	ipv4 multicast {	# IPv4 multicast topology (1/2)
240
+#		table mrib4;	# explicit IPv4 table
241
+#		import filter rt_import;
242
+#		export all;
243
+#	};
244
+#
245
+#	ipv6 multicast {	# IPv6 multicast topology (2/2)
246
+#		table mrib6;	# explicit IPv6 table
247
+#		import filter rt_import;
248
+#		export all;
249
+#	};
250
+#}
251
+
252
+# Template example. Using templates to define IBGP route reflector clients.
253
+# template bgp rr_clients {
254
+#	local 10.0.0.1 as 65000;
255
+#	neighbor as 65000;
256
+#	rr client;
257
+#	rr cluster id 1.0.0.1;
258
+#
259
+#	ipv4 {
260
+#		import all;
261
+#		export where source = RTS_BGP;
262
+#	};
263
+#
264
+#	ipv6 {
265
+#		import all;
266
+#		export where source = RTS_BGP;
267
+#	};
268
+# }
269
+#
270
+# protocol bgp client1 from rr_clients {
271
+#	neighbor 10.0.1.1;
272
+# }
273
+#
274
+# protocol bgp client2 from rr_clients {
275
+#	neighbor 10.0.2.1;
276
+# }
277
+#
278
+# protocol bgp client3 from rr_clients {
279
+#	neighbor 10.0.3.1;
280
+# }
281
+