IHANet Home‎ > ‎samples‎ > ‎

JUNOSでのBGP接続方法

chassis {
    /* MX/vMXでは、Inline Tunnelを有効にすることにより、GREを終端する。SRX/vSRXでは必要なし */
    fpc 0 {
        pic 0 {
            tunnel-services {
                bandwidth 10g;
            }
        }
    }
}
interfaces {
    ge-0/0/0 {
        description Internal;
        unit 0 {
            family inet {
                address 192.0.2.128/24
            }
            family inet6 {
                /* インタフェースへIPv6アドレスを設定 */
                address 2001:db8:1234:5678::1/64;
            }
        }
    }
    ge-0/0/1 {
        description Distributed-L2IX;
        unit 0 {
            family inet6 {
                address fe80::b:0:fc0c:101/64;
            }
        }
    }
    gr-0/0/0 {
        unit 1 {
            description Tunnel-to-AS64512;
            tunnel {
                source 192.0.2.128;
                destination 198.51.100.254;
            }
            family inet6 {
                mtu 1476;
                address 2001:db8:1234:9876::1/64;
                address fe80::fc1a:1/64;
            }
        }
    }
    lo0 {
        unit 0 {
            family inet6 {
                /* Subnet router anycast */
                address 2001:db8:1234::/128;
            }
        }
    }
}
routing-options {
    rib inet6.0 {
        static {
            /* 広告するPrefixをルーティングテーブルに載せておく */
            route 2001:db8:1234::/48 reject;
        }
    }
    /* 自分のAS番号を設定 */
    autonomous-system 64524;
}
protocols {
    bgp {
        group iBGP-AS64524 {
            /* iBGPの例 */
            type internal;
            local-address 2001:db8:1234:5678::1;
            neighbor 2001:db8:1234:5678::2;
        }
        group IHANet {
            /* eBGPの例 */
            type external;
            advertise-inactive;
            export export-IHANet;
            neighbor fe80::1:0:fc11:10 {
                peer-as 64529;
                /* local-addressにlink-local addressを指定した場合、どのインタフェースかをlocal-interfaceで指定する */
                local-address fe80::b:0:fc0c:101;
                local-interface ge-0/0/0.0;
            }
            neighbor fe80::1:0:fc1e:1 {
                peer-as 64542;
                local-address fe80::b:0:fc0c:101;
                local-interface ge-0/0/0.0;
            }
            neighbor 2001:db8:1234:9876::2 {
                peer-as 64512
            }
        }
    }
}
policy-options {
    policy-statement export-IHANet {
        term advertise-self-prefixes {
            /* 広報するPrefixを指定 */
            from {
                protocol static;
                route-filter 2001:db8:1234::/48 exact;
            }
            then accept;
        }
        term readvertise-bgp-prefixes {
            /* トランジットとして振る舞う設定 */
            from protocol bgp;
            then accept;
        }
        term reject-others {
            then reject;
        }
    }
}