|
| 1 | +# |
| 2 | +# Bird AS112 configuration generated by IXP Manager |
| 3 | +# |
| 4 | +# Do not edit this file, it will be overwritten. |
| 5 | +# |
| 6 | +# Generated: 2025-08-30 11:54:58 |
| 7 | +# |
| 8 | + |
| 9 | +# For VLAN: Peering LAN 1 (Tag: 1, Database ID: 1) |
| 10 | + |
| 11 | +# standardise time formats: |
| 12 | +timeformat base iso long; |
| 13 | +timeformat log iso long; |
| 14 | +timeformat protocol iso long; |
| 15 | +timeformat route iso long; |
| 16 | + |
| 17 | + |
| 18 | +log "/var/log/bird/b2-as112-lan1-ipv4.log" all; |
| 19 | +log syslog name "bird-b2-as112-lan1-ipv4" all; |
| 20 | + |
| 21 | +define routerasn = 112; |
| 22 | +define routeraddress = 192.0.2.6; |
| 23 | + |
| 24 | +router id 192.0.2.6; |
| 25 | + |
| 26 | +protocol kernel { |
| 27 | + ipv4 { |
| 28 | + export all; |
| 29 | + }; |
| 30 | + scan time 60; |
| 31 | +} |
| 32 | + |
| 33 | +protocol device { |
| 34 | + scan time 10; |
| 35 | +} |
| 36 | + |
| 37 | +# These function excludes weird networks |
| 38 | +# rfc1918, class D, class E, too long and too short prefixes |
| 39 | +function avoid_martians() -> bool |
| 40 | +prefix set martians; |
| 41 | +{ |
| 42 | + |
| 43 | + martians = [ |
| 44 | + 0.0.0.0/32-, # rfc5735 Special Use IPv4 Addresses |
| 45 | + 0.0.0.0/0{25,32}, # Filter small prefixes |
| 46 | + 0.0.0.0/0{0,7}, # rfc1122 Requirements for Internet Hosts -- Communication Layers 3.2.1.3 |
| 47 | + 10.0.0.0/8+, # rfc1918 Address Allocation for Private Internets |
| 48 | + 100.64.0.0/10+, # rfc6598 IANA-Reserved IPv4 Prefix for Shared Address Space |
| 49 | + 127.0.0.0/8+, # rfc1122 Requirements for Internet Hosts -- Communication Layers 3.2.1.3 |
| 50 | + 169.254.0.0/16+, # rfc3927 Dynamic Configuration of IPv4 Link-Local Addresses |
| 51 | + 172.16.0.0/12+, # rfc1918 Address Allocation for Private Internets |
| 52 | + 192.0.0.0/24+, # rfc6890 Special-Purpose Address Registries |
| 53 | + 192.0.2.0/24+, # rfc5737 IPv4 Address Blocks Reserved for Documentation |
| 54 | + 192.168.0.0/16+, # rfc1918 Address Allocation for Private Internets |
| 55 | + 198.18.0.0/15+, # rfc2544 Benchmarking Methodology for Network Interconnect Devices |
| 56 | + 198.51.100.0/24+, # rfc5737 IPv4 Address Blocks Reserved for Documentation |
| 57 | + 203.0.113.0/24+, # rfc5737 IPv4 Address Blocks Reserved for Documentation |
| 58 | + 224.0.0.0/4+, # rfc1112 Host Extensions for IP Multicasting |
| 59 | + 240.0.0.0/4+ # rfc6890 Special-Purpose Address Registries |
| 60 | + ]; |
| 61 | + |
| 62 | + |
| 63 | + # Avoid RFC1918 and similar networks |
| 64 | + if ( net ~ martians ) then { |
| 65 | + return false; |
| 66 | + } |
| 67 | + |
| 68 | + return true; |
| 69 | +} |
| 70 | + |
| 71 | + |
| 72 | +# This protocol defines the routes we want to export for AS112 |
| 73 | + |
| 74 | +protocol static static_as112 { |
| 75 | + |
| 76 | + |
| 77 | + ipv4; |
| 78 | + route 192.175.48.0/24 blackhole; |
| 79 | + route 192.31.196.0/24 blackhole; |
| 80 | + |
| 81 | + |
| 82 | +} |
| 83 | + |
| 84 | +## |
| 85 | +## AS112 client configuration |
| 86 | +## |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +######################################################################################## |
| 91 | +######################################################################################## |
| 92 | +# |
| 93 | +# RPKI protocol configuration |
| 94 | +# |
| 95 | +######################################################################################## |
| 96 | +######################################################################################## |
| 97 | + |
| 98 | + |
| 99 | +roa4 table t_roa; |
| 100 | + |
| 101 | +protocol rpki rpki1 { |
| 102 | + |
| 103 | + roa4 { table t_roa; }; |
| 104 | + |
| 105 | + remote "10.39.5.123" port 3323; |
| 106 | + |
| 107 | + retry keep 90; |
| 108 | + refresh keep 900; |
| 109 | + expire keep 172800; |
| 110 | +} |
| 111 | + |
| 112 | + |
| 113 | +protocol rpki rpki2 { |
| 114 | + |
| 115 | + roa4 { table t_roa; }; |
| 116 | + |
| 117 | + remote "10.39.5.124" port 3323; |
| 118 | + |
| 119 | + retry keep 90; |
| 120 | + refresh keep 900; |
| 121 | + expire keep 172800; |
| 122 | +} |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | +function fn_import ( int remote_as ) |
| 129 | +{ |
| 130 | + if !(avoid_martians()) then { |
| 131 | + return false; |
| 132 | + } |
| 133 | + |
| 134 | + # Belt and braces: must have at least one ASN in the path |
| 135 | + if( bgp_path.len < 1 ) then { |
| 136 | + return false; |
| 137 | + } |
| 138 | + |
| 139 | + # Belt and braces: no one needs an ASN path with > 64 hops, that's just broken |
| 140 | + if( bgp_path.len > 64 ) then { |
| 141 | + return false; |
| 142 | + } |
| 143 | + |
| 144 | + |
| 145 | + # RPKI check |
| 146 | + if( roa_check( t_roa, net, bgp_path.last_nonaggregated ) = ROA_INVALID ) then { |
| 147 | + return false; |
| 148 | + } else if( roa_check( t_roa, net, bgp_path.last_nonaggregated ) = ROA_VALID ) then { |
| 149 | + return true; |
| 150 | + } |
| 151 | + |
| 152 | + |
| 153 | + return true; |
| 154 | +} |
| 155 | + |
| 156 | + |
| 157 | +protocol bgp pb_as42_vli3_ipv4 { |
| 158 | + description "AS42 - PCH DNS"; |
| 159 | + local as routerasn; |
| 160 | + source address routeraddress; |
| 161 | + neighbor 10.1.0.36 as 42; |
| 162 | + strict bind yes; |
| 163 | + ipv4 { |
| 164 | + import where fn_import( 42 ); |
| 165 | + import limit 2000 action restart; |
| 166 | + export where proto = "static_as112"; |
| 167 | + }; |
| 168 | + |
| 169 | +} |
| 170 | + |
| 171 | + |
| 172 | +protocol bgp pb_as1213_vli1_ipv4 { |
| 173 | + description "AS1213 - HEAnet"; |
| 174 | + local as routerasn; |
| 175 | + source address routeraddress; |
| 176 | + neighbor 10.1.0.10 as 1213; |
| 177 | + strict bind yes; |
| 178 | + ipv4 { |
| 179 | + import where fn_import( 1213 ); |
| 180 | + import limit 1000 action restart; |
| 181 | + export where proto = "static_as112"; |
| 182 | + }; |
| 183 | + |
| 184 | +} |
| 185 | + |
| 186 | + |
| 187 | +protocol bgp pb_as65501_vli9_ipv4 { |
| 188 | + description "AS65501 - SCIX Route Servers"; |
| 189 | + local as routerasn; |
| 190 | + source address routeraddress; |
| 191 | + neighbor 10.1.0.8 as 65501; |
| 192 | + strict bind yes; |
| 193 | + ipv4 { |
| 194 | + # peer is route server at own IXP => prefixes already validated by route server |
| 195 | + import all; |
| 196 | + export where proto = "static_as112"; |
| 197 | + }; |
| 198 | + |
| 199 | +} |
| 200 | + |
| 201 | + |
0 commit comments