!
router bgp 65001
 no bgp ebgp-requires-policy
 neighbor 192.168.1.2 remote-as external
 neighbor 192.168.1.2 timers 3 10
 address-family ipv4 unicast
  neighbor 192.168.1.2 route-map r2 in
 exit-address-family
!
ip prefix-list p1 seq 5 permit 172.16.255.31/32
ip prefix-list p2 seq 5 permit 172.16.255.32/32
ip prefix-list p3 seq 5 permit 172.16.255.30/32
!
bgp as-path access-list FIRST permit ^65
bgp as-path access-list SECOND permit 2$

route-map r2 permit 6
 match ip address prefix-list p2
 set as-path exclude as-path-access-list SECOND
route-map r2 permit 10
 match ip address prefix-list p1
 set as-path exclude 65003
route-map r2 permit 20
 match ip address prefix-list p3
 set as-path exclude all
!
