@@ -14,6 +14,7 @@ protocol direct {
14
14
ipv6 {
15
15
table bgp6;
16
16
};
17
+ interface "-me0", "<%= node.dig(:plat, :interfaces).fetch(:outside).fetch(:name) %>", "<%= node.dig(:plat, :interfaces).fetch(:inside).fetch(:name) %>", "lo";
17
18
}
18
19
19
20
protocol kernel kernel_bgp4 {
@@ -142,21 +143,23 @@ protocol bgp bgp_outside {
142
143
143
144
ipv4 {
144
145
table bgp4;
145
- import filter {
146
- if net = 0.0.0.0/0 then accept;
147
- reject;
148
- };
146
+ import all;
149
147
export filter {
150
148
if dest = RTD_UNREACHABLE then reject; # static recursive route can be RTD_UNREACHABLE when unresolvable
149
+ if proto = "direct1" then accept;
151
150
if net = <%= node.dig(:plat, :nat64).fetch(:outer_public) %>/32 then accept;
152
151
if net = <%= node.dig(:plat, :nat64).fetch(:outer_private) %>/32 then accept;
153
152
reject;
154
153
};
155
154
};
156
155
ipv6 {
157
156
table bgp6;
158
- import none;
159
- export none;
157
+ import all;
158
+ export filter {
159
+ if dest = RTD_UNREACHABLE then reject; # static recursive route can be RTD_UNREACHABLE when unresolvable
160
+ if proto = "direct1" then accept;
161
+ reject;
162
+ };
160
163
};
161
164
}
162
165
@@ -169,23 +172,30 @@ protocol bgp bgp_inside {
169
172
ipv4 {
170
173
table bgp4;
171
174
import filter {
172
- if net ~ [10.33.0.0/16+ ] then accept;
175
+ if bgp_path ~ [= * <%= inside.fetch(:peer_as) %> = ] then accept; # accept only direct path
173
176
reject;
174
177
};
175
178
export filter {
176
179
if dest = RTD_UNREACHABLE then reject; # static recursive route can be RTD_UNREACHABLE when unresolvable
177
- if net ~ [10.33.0.0/16+] then accept;
180
+ if proto = "direct1" then accept;
181
+ if net !~ [10.33.0.0/16+] then reject;
182
+ if proto = "static1" then accept;
183
+ if proto = "static_bgp4" then accept;
178
184
reject;
179
185
};
180
186
};
181
187
ipv6 {
182
188
table bgp6;
183
189
import filter {
184
- if net ~ [2001:df0:8500:ca00::/56+] then accept;
190
+ if bgp_path ~ [= * <%= inside.fetch(:peer_as) %> =] then accept; # accept only direct path
191
+ reject;
185
192
};
186
193
export filter {
187
194
if dest = RTD_UNREACHABLE then reject; # static recursive route can be RTD_UNREACHABLE when unresolvable
188
- if net ~ [2001:df0:8500:ca00::/56{56,64}] then accept;
195
+ if proto = "direct1" then accept;
196
+ if net !~ [2001:df0:8500:ca00::/56{56,64}] then reject;
197
+ if proto = "static1" then accept;
198
+ if proto = "static_bgp6" then accept;
189
199
};
190
200
};
191
201
}
0 commit comments