Lab Data#

BGP ASN topology#

R1-AS17 <—> R2-AS22

R1-AS17 <—> R4-AS22

WAN Subnets#

R1:.1 <- 10.10.10.0/30 -> R2: .2

R1:.9 <- 10.10.10.8/30 -> R4: .10

LAN Subnets#

R1: .69 <- 172.17.99.0 -> LAN1

Purpose#

When R1 advertises the network 172.17.99.0 in BGP, R2 and R4 receive the route with the default AS_PATH attribute value, which is the ASN of R1. I want to make the 172.17.99.0 route received by R2 and R4 a bit ‘unattractive’, by making R1 send it with a longer AS_PATH attribute value. Since the AS_PATH attribute is a BGP non-transitive attribute, this modification will only impact the AS that are immediate neighbors of R1’s AS.

Sample Configuration#


root@R1# show policy-options policy-statement PREPEND-EXPORT
term 1 {
    from {
        protocol direct;
        route-filter 1.1.1.1/32 exact;
    }
    then {
        as-path-prepend "17 17 17";
        accept;
    }
}
term 2 {
    from {
        protocol direct;
        route-filter 172.17.99.0/24 exact;
    }
    then {
        as-path-prepend "17 17 17";
        accept;
    }
}

[edit]

root@R1#

[edit]
root@R1# show protocols bgp
group extGrp-79 {
    type external;
    export DirectroutesAccept;
    peer-as 79;
    neighbor 10.10.7.2;
}
group extGrp-22 {
    type external;
    import ModifyBGPattr;
    export [ PREPEND-EXPORT LAN172.17.99 ];
    peer-as 22;
    neighbor 10.10.10.2;
    neighbor 10.10.10.10;
}

[edit]
root@R1#

Verification#

root@R4> show route 172.17.99

inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

172.17.99.0/24     *[BGP/170] 00:00:00, localpref 100
                      AS path: 17 17 17 17 I, validation-state: unverified
                    >  to 10.10.10.9 via ge-0/0/1.0

root@R4>