I found it not quite obvious to generate BGP table entries, pretending they originates from other ASes. It would be very useful when we practice BGP peering policy implementation.
This is the easiest solution I found so far:
- Create the desired prefixes by adding static routes, pointing to some non-local reachable next-hop IP address, with Tags.
- Note: If that address is at LAN interface subnet, its ARP entry must exist.
You can use other IGP instead. The point here is the Tag in the route.
- Use a route-map to redistribute static routes into BGP. Add "set as-path tag" action in route-map block.
Here is a sample configuration:
interface Serial1/0
ip address 10.1.1.2 255.255.255.0
ip route 10.0.0.0 255.0.0.0 10.1.1.1 tag 789
route-map Generate-BGP-From-Static permit 10
set as-path tag
set origin igp
router bgp 1
redistribute static route-map Generate-BGP-From-Static
end
Router#show ip bgp
BGP table version is 2, local router ID is 10.1.1.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.0.0.0 10.1.1.1 0 32768 789 i
Router#