The keywrod ‘Originate’ or ‘transverse’ should indicate that an AS-path access-list should be used. The restriction should also indicate that the prefered solution should be an AS-path access-list. Also this should only apply to R4 and not R2. The filter should be two statements long:
Rack1SW2(config)#ip as-path access-list 4 deny _4_
Rack1SW2(config)#ip as-path access-list 4 permit .
Deny what originate or transverse AS 4 but permit everything else.
Rack1SW2(config)#router bgp 1
Rack1SW2(config-router)#neighbor 183.0.4.4 filter-list 4 out
Before:
Rack1R4>sh ip bgp | beg Network
Network Next Hop Metric LocPrf Weight Path
*>i183.0.20.0/24 183.0.10.10 0 100 0 2 i
*>i183.0.40.0/24 183.0.10.10 0 100 0 2 4 i
After:
Rack1R4>sh ip bgp | beg Network
Network Next Hop Metric LocPrf Weight Path
*>i183.0.20.0/24 183.0.10.10 0 100 0 2 i
From R2
Rack1R2>sh ip bgp | beg Network
Network Next Hop Metric LocPrf Weight Path
*>i183.0.20.0/24 183.0.10.10 0 100 0 2 i
*>i183.0.40.0/24 183.0.10.10 0 100 0 2 4 i