原来发在Junipers论坛上的帖子:

现在是CE可以相互学习到对端路由,但是无法ping通,trace表明报文到了PE就无法继续转发
起初用LDP,后来采用RSVP也不行
olive是装在PC的,版本为7.2,后来填加vrf-table-label也不行
按照Juniper的<<Troubleshooting Layer 3 ×××s>>教材一步步检查路由,似乎都没有什么问题

拓扑和配置都是参照一位网友写的文章,不过他是在PEMU上做的,后来添加了vrf-table-label似乎成功了
这个试验我搞了一天多,实在搞不定了,请求版主们的支援,谢谢!


[email=lab@OLIVE]lab@OLIVE[/email]# run ping 1.1.1.3 logical-router r1
PING 1.1.1.3 (1.1.1.3): 56 data bytes
^C
--- 1.1.1.3 ping statistics ---
54 packets transmitted, 0 packets received, 100% packet loss
[edit]
[email=lab@OLIVE]lab@OLIVE[/email]# run traceroute 1.1.1.3 logical-router r1
traceroute to 1.1.1.3 (1.1.1.3), 30 hops max, 40 byte packets
1  168.1.1.2 (168.1.1.2)  0.308 ms  0.285 ms  0.244 ms
2  * * *
^C
[edit]
[email=lab@OLIVE]lab@OLIVE[/email]# run traceroute 1.1.1.4 logical-router r2   
traceroute to 1.1.1.4 (1.1.1.4), 30 hops max, 40 byte packets
1  168.2.1.2 (168.2.1.2)  0.312 ms  0.280 ms  0.246 ms
2  * * *
^C
[edit]
[email=lab@OLIVE]lab@OLIVE[/email]# run ping 1.1.1.4 logical-router r2         
PING 1.1.1.4 (1.1.1.4): 56 data bytes
^C
--- 1.1.1.4 ping statistics ---
14 packets transmitted, 0 packets received, 100% packet loss
[edit]
[email=lab@OLIVE]lab@OLIVE[/email]#

[email=lab@OLIVE]lab@OLIVE[/email]# show
version 7.2R4.2;
system {
    host-name OLIVE;
    domain-name juniper.net;
    login {
        user lab {
            uid 2004;
            class super-user;
            authentication {
                encrypted-password "$1$3.3wI39R$7xtJhz6jbDKbfR0.N5bvy1"; ## SECRET-DATA
            }
        }
    }
    services {
        ftp;
        telnet;
    }
}                  
logical-routers {
    r1 {
        interfaces {
            fxp2 {
                unit 1 {
                    vlan-id 1;
                    family inet {
                        address 168.1.1.1/16;
                    }
                }
            }
            lo0 {
                unit 1 {
                    family inet {
                        address 1.1.1.1/32;
                    }
                }   
            }
        }
        routing-options {
            static {
                route 0.0.0.0/0 next-hop 168.1.1.2;
            }
        }
    }
    r2 {
        interfaces {
            fxp2 {
                unit 2 {
                    vlan-id 2;
                    family inet {
                        address 168.2.1.1/16;
                    }
                }   
            }
            lo0 {
                unit 2 {
                    family inet {
                        address 1.1.1.2/32;
                    }
                }
            }
        }
        protocols {
            ospf {
                area 0.0.0.0 {
                    interface fxp2.2 {
                        interface-type p2p;
                    }
                    interface lo0.2 {
                        passive;
                    }
                }
            }
        }
    }
    r3 {
        interfaces {
            fxp2 {
                unit 3 {
                    vlan-id 3;
                    family inet {
                        address 168.3.1.1/16;
                    }
                }
            }
            lo0 {
                unit 3 {
                    family inet {
                        address 1.1.1.3/32;
                    }
                }
            }
        }
        protocols {
            ospf {
                area 0.0.0.0 {
                    interface fxp2.3 {
                        interface-type p2p;
                    }
                    interface lo0.3 {
                        passive;
                    }
                }
            }      
        }
    }
    r4 {
        interfaces {
            fxp2 {
                unit 4 {
                    vlan-id 4;
                    family inet {
                        address 168.4.1.1/16;
                    }
                }
            }
            lo0 {
                unit 4 {
                    family inet {
                        address 1.1.1.4/32;
                    }
                }
            }
        }
        protocols {
            ospf {
                area 0.0.0.0 {
                    interface fxp2.4 {
                        interface-type p2p;
                    }
                    interface lo0.4 {
                        passive;
                    }
                }
            }
        }
    }
    r5 {            
        interfaces {
            fxp1 {
                unit 1 {
                    vlan-id 1;
                    family inet {
                        address 168.1.1.2/16;
                    }
                }
                unit 2 {
                    vlan-id 2;
                    family inet {
                        address 168.2.1.2/16;
                    }
                }
                unit 5 {
                    vlan-id 5;
                    family inet {
                        address 172.1.1.1/16;
                    }
                    family mpls;
                }
            }
            lo0 {
                unit 11 {
                    family inet {
                        address 202.100.1.1/32;
                    }
                }
            }
        }
        protocols {
            rsvp {
                interface all;
            }      
            mpls {
                label-switched-path r5-to-r6 {
                    to 202.100.1.2;
                    no-cspf;
                }
                interface all;
                interface fxp1.5;
            }
            bgp {
                group IBGP {
                    type internal;
                    local-address 202.100.1.1;
                    family inet {
                        unicast;
                    }
                    family inet-*** {
                        unicast;
                    }
                    neighbor 202.100.1.2;
                }
            }
            ospf {
                area 0.0.0.0 {
                    interface fxp1.5;
                    interface lo0.11 {
                        passive;
                    }
                }
            }
        }
        policy-options {
            policy-statement ***a-export {
                term 1 {
                    from protocol static;
                    then {
                        community add ***a;
                        accept;
                    }
                }
                term 2 {
                    then reject;
                }
            }
            policy-statement ***a-import {
                term 1 {
                    from {
                        protocol bgp;
                        community ***a;
                    }
                    then accept;
                }   
                term 2 {
                    then reject;
                }
            }
            policy-statement ***b-export {
                term 1 {
                    from protocol ospf;
                    then {
                        community add ***b;
                        accept;
                    }
                }
                term 2 {
                    then reject;
                }
            }
            policy-statement ***b-import {
                term 1 {
                    from {
                        protocol bgp;
                        community ***b;
                    }
                    then accept;
                }
                term 2 {
                    then reject;
                }
            }
            community ***a members target:100:26;
            community ***b members target:100:27;
        }
        routing-instances {
            ***-a {
                description for_***a;
                instance-type vrf;
                interface fxp1.1;
                route-distinguisher 100:1;
                vrf-import ***a-import;
                vrf-export ***a-export;
                vrf-target {
                    target:100:26;
                    import target:100:26;
                    export target:100:26;
                }
                vrf-table-label;
                routing-options {
                    static {
                        route 1.1.1.1/32 next-hop 168.1.1.1;
                    }
                }
            }      
            ***-b {
                description for_***b;
                instance-type vrf;
                interface fxp1.2;
                route-distinguisher 100:2;
                vrf-import ***b-import;
                vrf-export ***b-export;
                vrf-target {
                    target:100:27;
                    import target:100:27;
                    export target:100:27;
                }
                vrf-table-label;
                protocols {
                    ospf {
                        export ***b-import;
                        area 0.0.0.0 {
                            interface fxp1.2 {
                                interface-type p2p;
                            }
                        }
                    }
                }
            }
        }
        routing-options {
            router-id 202.100.1.1;
            autonomous-system 100;
        }
    }
    r6 {
        interfaces {
            fxp1 {
                unit 3 {
                    vlan-id 3;
                    family inet {
                        address 168.3.1.2/16;
                    }
                }
                unit 4 {
                    vlan-id 4;
                    family inet {
                        address 168.4.1.2/16;
                    }
                }
                unit 6 {
                    vlan-id 6;
                    family inet {
                        address 172.2.1.1/16;
                    }
                    family mpls;
                }
            }
            lo0 {
                unit 12 {
                    family inet {
                        address 202.100.1.2/32;
                    }
                }
            }
        }
        protocols {
            rsvp {
                interface all;
            }
            mpls {
                label-switched-path r6-to-r5 {
                    to 202.100.1.1;
                    no-cspf;
                }
                interface all;
                interface fxp1.6;
            }
            bgp {
                group IBGP {
                    type internal;
                    local-address 202.100.1.2;
                    family inet {
                        any;
                    }
                    family inet-*** {
                        unicast;
                        any;
                    }
                    neighbor 202.100.1.1;
                }
            }
            ospf {
                area 0.0.0.0 {
                    interface fxp1.6;
                    interface lo0.12 {
                        passive;
                    }
                }
            }
        }
        policy-options {
            policy-statement bgp-ospf {
                term 1 {
                    from protocol bgp;
                    then accept;
                }   
                term 2 {
                    then reject;
                }
            }
            policy-statement ***a-export {
                term 1 {
                    from protocol ospf;
                    then {
                        community add ***a;
                        accept;
                    }
                }
                term 2 {
                    then reject;
                }
            }
            policy-statement ***a-import {
                term 1 {
                    from {
                        protocol bgp;
                        community ***a;
                    }
                    then accept;
                }
                term 2 {
                    then reject;
                }
            }
            policy-statement ***b-export {
                term 1 {
                    from protocol ospf;
                    then {
                        community add ***b;
                        accept;
                    }
                }
                term 2 {
                    then reject;
                }
            }
            policy-statement ***b-import {
                term 1 {
                    from {
                        protocol bgp;
                        community ***b;
                    }
                    then accept;
                }
            }
            community ***a members target:100:26;
            community ***b members target:100:27;
        }
        routing-instances {
            ***-a {
                instance-type vrf;
                interface fxp1.3;
                route-distinguisher 100:1;
                vrf-import ***a-import;
                vrf-export ***a-export;
                vrf-target {
                    target:100:26;
                    import target:100:26;
                    export target:100:26;
                }
                vrf-table-label;
                protocols {
                    ospf {
                        export bgp-ospf;
                        area 0.0.0.0 {
                            interface fxp1.3 {
                                interface-type p2p;
                            }
                        }
                    }
                }
            }
            ***-b {
                instance-type vrf;
                interface fxp1.4;
                route-distinguisher 100:2;
                vrf-import ***b-import;
                vrf-export ***b-export;
                vrf-target {
                    target:100:27;
                    import target:100:27;
                    export target:100:27;
                }
                vrf-table-label;
                protocols {
                    ospf {
                        export bgp-ospf;
                        area 0.0.0.0 {
                            interface fxp1.4 {
                                interface-type p2p;
                            }
                        }
                    }
                }
            }
        }
        routing-options {
            router-id 202.100.1.2;
            autonomous-system 100;
        }
    }
    r7 {
        interfaces {
            fxp2 {
                unit 5 {
                    vlan-id 5;
                    family inet {
                        address 172.1.1.2/16;
                    }
                    family mpls;
                }
                unit 6 {
                    vlan-id 6;
                    family inet {
                        address 172.2.1.2/16;
                    }
                    family mpls;
                }
            }
        }
        protocols {
            rsvp {
                interface all;
            }
            mpls {
                interface all;
                interface fxp2.5;
                interface fxp2.6;
            }
            ospf {
                area 0.0.0.0 {
                    interface fxp2.6;
                    interface fxp2.5;
                }
            }
        }
    }
}
interfaces {
    fxp0 {
        unit 0 {
            family inet {
                address 1.1.1.1/24;
            }
        }
    }
    fxp1 {
        vlan-tagging;
    }               
    fxp2 {
        vlan-tagging;
    }
    fxp3 {
        vlan-tagging;
    }
}

Tonyblair: 

 

必须用7.2版本, 我看你用的就是7.2R4.2, 很好.
其次, 在routing-instance下, 加vrf-table-label命令.
以上说的是PC Olive(非Qemu), 几个网卡都用HUB连接起来, 并启动logical router的做法.

但很遗憾都不是楼主遇到的问题, 楼主遇到的问题是没有把PE上直接连接CE的link放到×××里去!!!  

        policy-options {
            policy-statement ***a-export {
                term 1 {
                    from protocol static;
                    then {
                        community add ***a;
                        accept;
                    }
                }
                term 2 {
                    then reject;
                }
            }

你光把静态倒进×××了, 你的直连link呢?

你要么把直连放进×××里去, 要么在CE上用source based ping吧 

再有我感觉你在instance里有点儿瞎配, 特别是vrf policy的方面.
 
非常感谢大猫猫的指点!
宣告PE-CE之间的链路,然后修改了一下PE1上的vrf policy,可以ping通了!
老实讲,这个错误很低级,不该完全照搬网上的一些资料,还得独立思考!
不过奇怪的是,<<Part-3_MPLS-×××>>_Basic Layer 3 ××× Configuration with JUNOS Software中并没有提到宣告PE-CE直连链路,但是在TroubleShooting中的确发现CE学到了对端PE-CE直连链路路由
激动啊,终于可以睡个好觉了^_^

下面把成功的配置附在后面,初学者可以参考一下:
lab@FSJ# show
version 7.2R4.2;
system {
    host-name FSJ;
    login {
        user lab {
            uid 2004;
            class super-user;
            authentication {
                encrypted-password "$1$Rmzt55kZ$vEbrKYRv59G0Q1MnYOkTh0"; ## SECRET-DATA
            }
        }
    }
    services {
        ftp;
        telnet;
    }
    syslog {
        user * {
            any emergency;
        }
        file messages {
            any notice;
            authorization info;
        }
        file interactive-commands {
            interactive-commands any;
        }
    }
}                  
logical-routers {
    r1 {
        interfaces {
            fxp2 {
                unit 1 {
                    vlan-id 1;
                    family inet {
                        address 168.1.1.1/16;
                    }
                }
            }
            lo0 {
                unit 1 {
                    family inet {
                        address 1.1.1.1/32;
                    }
                }
            }
        }
        routing-options {
            static {
                route 0.0.0.0/0 next-hop 168.1.1.2;
            }
        }
    }
    r2 {
        interfaces {
            fxp2 {
                unit 2 {
                    vlan-id 2;
                    family inet {
                        address 168.2.1.1/16;
                    }
                }
            }
            lo0 {
                unit 2 {
                    family inet {
                        address 1.1.1.2/32;
                    }
                }
            }
        }
        protocols {
            ospf {
                area 0.0.0.0 {
                    interface all;
                }
            }
        }
    }
    r3 {
        interfaces {
            fxp2 {
                unit 3 {
                    vlan-id 3;
                    family inet {
                        address 168.3.1.1/16;
                    }
                }
            }
            lo0 {
                unit 3 {
                    family inet {
                        address 1.1.1.3/32;
                    }
                }
            }
        }
        protocols {
            ospf {
                area 0.0.0.0 {
                    interface all;
                }
            }
        }
    }
    r4 {
        interfaces {
            fxp2 {
                unit 4 {
                    vlan-id 4;
                    family inet {
                        address 168.4.1.1/16;
                    }
                }
            }      
            lo0 {
                unit 4 {
                    family inet {
                        address 1.1.1.4/32;
                    }
                }
            }
        }
        protocols {
            ospf {
                area 0.0.0.0 {
                    interface all;
                }
            }
        }
    }
    r5 {
        interfaces {
            fxp1 {
                unit 1 {
                    vlan-id 1;
                    family inet {
                        address 168.1.1.2/16;
                    }
                }
                unit 2 {
                    vlan-id 2;
                    family inet {
                        address 168.2.1.2/16;
                    }
                }
                unit 5 {
                    vlan-id 5;
                    family inet {
                        address 172.1.1.1/16;
                    }
                    family mpls;
                }
            }
            lo0 {
                unit 11 {
                    family inet {
                        address 202.100.1.1/32;
                    }
                }
            }
        }
        protocols {
            mpls {
                interface all;
                interface lo0.11 {
                    disable;
                }
            }
            bgp {
                group IBGP {
                    type internal;
                    local-address 202.100.1.1;
                    family inet {
                        unicast;
                    }
                    family inet-*** {
                        unicast;
                        any;
                    }
                    neighbor 202.100.1.2;
                }
            }
            ospf {
                area 0.0.0.0 {
                    interface all;
                }
            }
            ldp {
                interface all;
                interface lo0.11 {
                    disable;
                }
            }
        }
        policy-options {
            policy-statement ***a-export {
                term 1 {
                    from protocol [ static direct ];
                    then {
                        community add ***a;
                        accept;
                    }
                }
                term 2 {
                    then reject;
                }
            }
            policy-statement ***b-export {
                term 1 {
                    from protocol [ ospf direct ];
                    then {
                        community add ***b;
                        accept;
                    }
                }
                term 2 {
                    then reject;
                }
            }
            policy-statement ***a-import {
                term 1 {
                    from {
                        protocol bgp;
                        community ***a;
                    }
                    then accept;
                }
            }
            policy-statement ***b-import {
                from {
                    protocol bgp;
                    community ***b;
                }
                then accept;
            }
            policy-statement bgp-ospf {
                term 1 {
                    from protocol bgp;
                    then accept;
                }
                term 2 {
                    then reject;
                }
            }
            community ***a members target:100:26;
            community ***b members target:100:27;
        }
        routing-instances {
            ***-a {
                description for_***a;
                instance-type vrf;
                interface fxp1.1;
                route-distinguisher 100:1;
                vrf-import ***a-import;
                vrf-export ***a-export;
                vrf-target {
                    target:100:26;
                    import target:100:26;
                    export target:100:26;
                }
                vrf-table-label;
                routing-options {
                    static {
                        route 1.1.1.1/32 next-hop 168.1.1.1;
                    }
                }
            }
            ***-b {
                description for_***b;
                instance-type vrf;
                interface fxp1.2;
                route-distinguisher 100:2;
                vrf-import ***b-import;
                vrf-export ***b-export;
                vrf-target {
                    target:100:27;
                    import target:100:27;
                    export target:100:27;
                }
                vrf-table-label;
                protocols {
                    ospf {
                        export bgp-ospf;
                        area 0.0.0.0 {
                            interface all;
                        }
                    }
                }   
            }
        }
        routing-options {
            route-distinguisher-id 202.100.1.1;
            autonomous-system 100;
        }
    }
    r6 {
        interfaces {
            fxp1 {
                unit 3 {
                    vlan-id 3;
                    family inet {
                        address 168.3.1.2/16;
                    }
                }
                unit 4 {
                    vlan-id 4;
                    family inet {
                        address 168.4.1.2/16;
                    }
                }
                unit 6 {
                    vlan-id 6;
                    family inet {
                        address 172.2.1.1/16;
                    }
                    family mpls;
                }   
            }
            lo0 {
                unit 12 {
                    family inet {
                        address 202.100.1.2/32;
                    }
                }
            }
        }
        protocols {
            mpls {
                interface all;
                interface lo0.12 {
                    disable;
                }
            }
            bgp {
                group IBGP {
                    type internal;
                    local-address 202.100.1.2;
                    family inet {
                        unicast;
                    }
                    family inet-*** {
                        unicast;
                        any;
                    }
                    neighbor 202.100.1.1;
                }   
            }
            ospf {
                area 0.0.0.0 {
                    interface all;
                }
            }
            ldp {
                interface all;
                interface lo0.12 {
                    disable;
                }
            }
        }
        policy-options {
            policy-statement bgp-ospf {
                term 1 {
                    from protocol bgp;
                    then accept;
                }
                term 2 {
                    then reject;
                }
            }
            policy-statement ***a-export {
                term 1 {
                    from protocol [ ospf direct ];
                    then {
                        community add ***a;
                        accept;
                    }
                }
                term 2 {
                    then reject;
                }
            }
            policy-statement ***a-import {
                term 1 {
                    from {
                        protocol bgp;
                        community ***a;
                    }
                    then accept;
                }
                term 2 {
                    then reject;
                }
            }
            policy-statement ***b-export {
                term 1 {
                    from protocol [ ospf direct ];
                    then {
                        community add ***b;
                        accept;
                    }
                }
                term 2 {
                    then reject;
                }   
            }
            policy-statement ***b-import {
                term 1 {
                    from {
                        protocol bgp;
                        community ***b;
                    }
                    then accept;
                }
                term 2 {
                    then reject;
                }
            }
            community ***a members target:100:26;
            community ***b members target:100:27;
        }
        routing-instances {
            ***-a {
                description for_***a;
                instance-type vrf;
                interface fxp1.3;
                route-distinguisher 100:1;
                vrf-import ***a-import;
                vrf-export ***a-export;
                vrf-target {
                    target:100:26;
                    import target:100:26;
                    export target:100:26;
                }   
                vrf-table-label;
                protocols {
                    ospf {
                        export bgp-ospf;
                        area 0.0.0.0 {
                            interface all;
                        }
                    }
                }
            }
            ***-b {
                description ***_b;
                instance-type vrf;
                interface fxp1.4;
                route-distinguisher 100:2;
                vrf-import ***b-import;
                vrf-export ***b-export;
                vrf-target {
                    target:100:27;
                    import target:100:27;
                    export target:100:27;
                }
                vrf-table-label;
                protocols {
                    ospf {
                        export bgp-ospf;
                        area 0.0.0.0 {
                            interface all;
                        }
                    }
                }
            }
        }
        routing-options {
            route-distinguisher-id 202.100.1.2;
            autonomous-system 100;
        }
    }
    r7 {
        interfaces {
            fxp2 {
                unit 5 {
                    vlan-id 5;
                    family inet {
                        address 172.1.1.2/16;
                    }
                    family mpls;
                }
                unit 6 {
                    vlan-id 6;
                    family inet {
                        address 172.2.1.2/16;
                    }
                    family mpls;
                }
            }
        }
        protocols {
            mpls {
                interface all;
            }
            ospf {
                area 0.0.0.0 {
                    interface all;
                }
            }
            ldp {
                interface all;
            }
        }
    }
}
interfaces {
    fxp0 {
        unit 0 {
            family inet {
                address 2.2.2.2/24;
            }
        }
    }
    fxp1 {
        vlan-tagging;
    }
    fxp2 {
        vlan-tagging;
    }
    fxp3 {         
        vlan-tagging;
    }
}

[edit]
lab@FSJ# run ping 1.1.1.3 logical-router r1
PING 1.1.1.3 (1.1.1.3): 56 data bytes
64 bytes from 1.1.1.3: icmp_seq=0 ttl=254 time=0.542 ms
64 bytes from 1.1.1.3: icmp_seq=1 ttl=254 time=0.494 ms
64 bytes from 1.1.1.3: icmp_seq=2 ttl=254 time=0.514 ms
^C
--- 1.1.1.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.494/0.517/0.542/0.020 ms

[edit]
lab@FSJ# run ping 1.1.1.2 logical-router r4   
PING 1.1.1.2 (1.1.1.2): 56 data bytes
64 bytes from 1.1.1.2: icmp_seq=0 ttl=254 time=0.526 ms
64 bytes from 1.1.1.2: icmp_seq=1 ttl=254 time=0.505 ms
64 bytes from 1.1.1.2: icmp_seq=2 ttl=254 time=0.493 ms
^C
--- 1.1.1.2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.493/0.508/0.526/0.014 ms

[edit]
lab@FSJ# run ping 1.1.1.3 logical-router r2   
PING 1.1.1.3 (1.1.1.3): 56 data bytes
^C
--- 1.1.1.3 ping statistics ---
4 packets transmitted, 0 packets received, 100% packet loss

[edit]
lab@FSJ# run ping 1.1.1.4 logical-router r1   
PING 1.1.1.4 (1.1.1.4): 56 data bytes
^C
--- 1.1.1.4 ping statistics ---
2 packets transmitted, 0 packets received, 100% packet loss

[edit]
lab@FSJ# run ping 1.1.1.2 logical-router r1   
PING 1.1.1.2 (1.1.1.2): 56 data bytes
^C
--- 1.1.1.2 ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss

[edit]
lab@FSJ# run ping 1.1.1.4 logical-router r3   
PING 1.1.1.4 (1.1.1.4): 56 data bytes
^C
--- 1.1.1.4 ping statistics ---
2 packets transmitted, 0 packets received, 100% packet loss

[edit]
lab@FSJ#