# config router bgpBGP Routing table:
set as 64540
set router-id 10.120.0.2
# config neighbor
edit "10.120.0.1"
set remote-as 64540
next
end
# config redistribute "connected"
set status enable
end
end
FGT_test # get router info bgp network
BGP table version is 1, local router ID is 10.120.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,In the above output, we can see that 10.1.10.0/24 is part of the BGP network.
S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight RouteTag Path
*> 10.0.0.0/20 0.0.0.0 32768 0 ? <-/1>
*> 10.1.10.0/24 0.0.0.0 32768 0 ? <-/1>
*> 10.5.16.0/20 0.0.0.0 32768 0 ? <-/1>
Total number of prefixes 3
# config system interfaceHere, the configuration is implemented to block this loopback1 network to be advertised to BGP peer.
edit "loopback1"
set vdom "root"
set ip 10.1.10.1 255.255.255.0
set allowaccess ping
set type loopback
set snmp-index 7
next
end
# config router prefix-list2) Create a route map with the first entry deny on a specific interface and second entry allow all IPs.
edit "all_prefixes"
# config rule
edit 1
set prefix any
unset ge
unset le
next
end
next
end
# config router route-map3) Apply the route map to redistribute connected.
edit "Filter_route"
# config rule
edit 1
set action deny
set match-interface "loopback1"
next
edit 2
set match-ip-address "all_prefixes"
next
end
next
end
# config router bgp4) The IP subnet of that interface will not be appearing in the BGP routing table afterward.
set as 64540
set router-id 10.120.0.2
# config neighbor
edit "10.120.0.1"
set remote-as 64540
next
end
# config redistribute "connected"
set status enable
set route-map "Filter_route"
next
end
end
FGT_test # get router info bgp network5) The same can be implemented in a scenario where you want to advertise only a single connected route to BGP peer and not all the connected route.
BGP table version is 1, local router ID is 10.120.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight RouteTag Path
*> 10.0.0.0/20 0.0.0.0 32768 0 ? <-/1>
*> 10.5.16.0/20 0.0.0.0 32768 0 ? <-/1>
# config router route-mapRelated articles.
edit "Filter_route"
# config rule
edit 1
set action allow
set match-interface "loopback1"
next
edit 2
set action deny
set match-ip-address "all_prefixes"
next
end
next
end
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.