Hi,
Do you want the return traffic from this source range only to go via AS200?
If not, you can do this with BGP import and export policies and as-path prepend.
I tested this in a lab. Config below:
AS100:
ge-0/0/0 {
unit 0 {
family inet {
address 10.0.0.1/24;
}
}
}
ge-0/0/2 {
unit 0 {
family inet {
address 172.16.0.1/30;
}
}
}
ge-0/0/3 {
unit 0 {
family inet {
address 172.16.0.9/30;
}
}
}
}
routing-options {
autonomous-system 100;
}
protocols {
bgp {
group AS200 {
type external;
local-address 172.16.0.1;
export EXPORT-AS200;
peer-as 200;
neighbor 172.16.0.2;
}
group AS300 {
type external;
local-address 172.16.0.9;
import IMPORT-AS300;
export EXPORT-AS300;
peer-as 300;
neighbor 172.16.0.10;
}
}
}
policy-options {
policy-statement EXPORT-AS200 {
from {
protocol direct;
route-filter 10.0.0.0/24 exact;
}
then accept;
}
policy-statement EXPORT-AS300 {
from {
protocol direct;
route-filter 10.0.0.0/24 exact;
}
then {
community set AS100:300;
as-path-prepend "100 100 100";
accept;
}
}
policy-statement IMPORT-AS300 {
term AS300 {
from {
protocol bgp;
as-path AS300;
route-filter 192.168.1.0/30 exact;
}
then {
as-path-expand last-as count 2;
accept;
}
}
}
community AS100:300 members 300:100;
as-path AS300 "300 .*";
}
AS200:
ge-0/0/2 {
unit 0 {
family inet {
address 172.16.0.2/30;
}
}
}
ge-0/0/3 {
unit 0 {
family inet {
address 172.16.0.5/30;
}
}
}
}
routing-options {
autonomous-system 200;
}
protocols {
bgp {
group AS100 {
type external;
local-address 172.16.0.2;
peer-as 100;
neighbor 172.16.0.1;
}
group AS300 {
type external;
local-address 172.16.0.5;
peer-as 300;
neighbor 172.16.0.6;
}
}
}
AS300:
ge-0/0/0 {
unit 0 {
family inet {
address 192.168.1.1/30;
}
}
}
ge-0/0/2 {
unit 0 {
family inet {
address 172.16.0.6/30;
}
}
}
ge-0/0/3 {
unit 0 {
family inet {
address 172.16.0.10/30;
}
}
}
}
routing-options {
autonomous-system 300;
}
protocols {
bgp {
export EXPORT;
group AS100 {
type external;
local-address 172.16.0.10;
peer-as 100;
neighbor 172.16.0.9;
}
group AS200 {
type external;
local-address 172.16.0.6;
peer-as 200;
neighbor 172.16.0.5;
}
}
}
policy-options {
policy-statement EXPORT {
from {
protocol direct;
route-filter 192.168.1.0/30 exact;
}
then accept;
}
}
Traceroute shows traffic going via AS200:
root@AS100# run traceroute 192.168.1.1 source 10.0.0.1 traceroute to 192.168.1.1 (192.168.1.1) from 10.0.0.1, 30 hops max, 40 byte packets 1 172.16.0.2 (172.16.0.2) 2.753 ms 1.926 ms 1.190 ms 2 192.168.1.1 (192.168.1.1) 2.288 ms 2.564 ms 2.017 ms
root@AS300# run traceroute 10.0.0.1 source 192.168.1.1
traceroute to 10.0.0.1 (10.0.0.1) from 192.168.1.1, 30 hops max, 40 byte packets
1 172.16.0.5 (172.16.0.5) 1.398 ms 1.100 ms 1.638 ms
2 10.0.0.1 (10.0.0.1) 2.210 ms 1.863 ms 1.983 ms
BGP Routes:
root@AS100# run show route table inet.0 192.168.1.0 inet.0: 7 destinations, 8 routes (7 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 192.168.1.0/30 *[BGP/170] 00:18:13, localpref 100 AS path: 200 300 I, validation-state: unverified > to 172.16.0.2 via ge-0/0/2.0 [BGP/170] 00:18:13, localpref 100 AS path: 300 300 300 I, validation-state: unverified> to 172.16.0.10 via ge-0/0/3.0 root@AS300# run show route table inet.0 10.0.0.0 inet.0: 7 destinations, 8 routes (7 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.0.0/24 *[BGP/170] 00:20:54, localpref 100 AS path: 200 100 I, validation-state: unverified > to 172.16.0.5 via ge-0/0/2.0 [BGP/170] 00:20:54, localpref 100 AS path: 100 100 100 100 I, validation-state: unverified> to 172.16.0.9 via ge-0/0/3.0
The AS-PATH prepend or expand can be done at either end and can match communities as well.
Did not need a static route on AS200 as the 192.168.1.0/30 was exported in BGP.
Not sure if this helps.
I believe if only default route is available, then FBF is the solution.
Cheers,
Ashvin