发新话题
打印

[技术分享] 路由的重分布简单配置

路由的重分布简单配置

r1、r2、r4运行rip协议,r2、r3运行ospf协议,r2为ASBR,在r2上向rip域重发布ospf,向ospf域重发布静态汇总。
root@lab-text# show
r1 {
    interfaces {
        fxp1 {
            unit 12 {
                vlan-id 12;
                family inet {
                    address 10.0.1.1/30;
                }
            }
            unit 14 {
                vlan-id 14;
                family inet {
                    address 172.16.1.1/30;
                }
            }
        }
    }
    protocols {
        rip {
            authentication-type md5;
            authentication-key "$9$AaC6uBElK8db2cyb24aiHtuO"; ## SECRET-DATA
            group rip {
                export rip;
                neighbor fxp1.12;
                neighbor fxp1.14;
            }
        }
    }
    policy-options {
        policy-statement rip {
            term 1 {
                from protocol [ rip direct ];
                then accept;
            }
        }
    }
}
r2 {
    interfaces {
        fxp2 {
            unit 12 {
                vlan-id 12;
                family inet {
                    address 10.0.1.2/30;
                }
            }
            unit 23 {
                vlan-id 23;
                family inet {
                    address 10.0.2.1/30;
                }
            }
        }
        lo0 {
            unit 2 {
                family inet {
                    address 2.2.2.2/32;
                }
            }
        }
    }
    protocols {
        ospf {
            export st-ospf;
            area 0.0.0.1 {
                authentication-type simple;
                interface fxp2.23 {
                    interface-type p2p;
                }
                interface lo0.0 {
                    passive;
                }
            }
        }
        rip {
            authentication-type md5;
            authentication-key "$9$5znCO1hKMXtuMX7-2gTz3"; ## SECRET-DATA
            group rip {
                export rip;
                neighbor fxp2.12;
            }
        }
    }
    policy-options {
        policy-statement rip {
            term 1 {
                from protocol [ direct ospf rip ];
                then accept;
            }
        }
        policy-statement st-ospf {
            term 2 {
                from protocol static;
                then accept;
            }
        }
    }
    routing-options {
        static {
            route 172.16.1.0/24 discard;
        }
    }
}
r3 {
    interfaces {
        fxp3 {
            unit 23 {
                vlan-id 23;
                family inet {
                    address 10.0.2.2/30;
                }
            }
        }
        lo0 {
            unit 3 {
                family inet {
                    address 192.168.1.1/32;
                    address 192.168.2.1/32;
                    address 192.168.3.1/32;
                    address 192.168.4.1/32;
                    address 192.168.5.1/32;
                    address 192.168.6.1/32;
                }
            }
        }
    }
    protocols {
        ospf {
            area 0.0.0.1 {
                authentication-type simple;
                interface fxp3.23 {
                    interface-type p2p;
                }
                interface lo0.0 {
                    passive;
                }
            }
        }
    }               
}
r4 {
    interfaces {
        fxp4 {
            unit 14 {
                vlan-id 14;
                family inet {
                    address 172.16.1.2/30;
                }
            }
        }
    }
    protocols {
        rip {
            authentication-type md5;
            authentication-key "$9$8xdx-woJDmfzYgfz36u0LxN"; ## SECRET-DATA
            group rip {
                export rip;
                neighbor fxp4.14;
            }
        }
    }
    policy-options {
        policy-statement rip {
            term 1 {
                from protocol [ direct rip ];
                then accept;
            }
        }
    }
}

                                                                 [edit logical-routers]

root@lab-text# run show route logical-router all

logical-router: r1

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

2.2.2.2/32         *[RIP/100] 02:14:11, metric 2, tag 0
                    > to 10.0.1.2 via fxp1.12
10.0.1.0/30        *[Direct/0] 03:36:57
                    > via fxp1.12
10.0.1.1/32        *[Local/0] 03:36:57
                      Local via fxp1.12
10.0.2.0/30        *[RIP/100] 02:14:11, metric 2, tag 0
                    > to 10.0.1.2 via fxp1.12
172.16.1.0/30      *[Direct/0] 02:54:24
                    > via fxp1.14
172.16.1.1/32      *[Local/0] 02:54:24
                      Local via fxp1.14
192.168.1.1/32     *[RIP/100] 00:29:27, metric 2, tag 0
                    > to 10.0.1.2 via fxp1.12
224.0.0.9/32       *[RIP/100] 00:13:11, metric 1
                      MultiRecv
-----

logical-router: r2  

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

2.2.2.2/32         *[Direct/0] 02:14:15
                    > via lo0.2
10.0.1.0/30        *[Direct/0] 02:14:15
                    > via fxp2.12
10.0.1.2/32        *[Local/0] 02:14:15
                      Local via fxp2.12
10.0.2.0/30        *[Direct/0] 02:14:15
                    > via fxp2.23
                    [OSPF/10] 00:13:11, metric 1
                    > via fxp2.23
10.0.2.1/32        *[Local/0] 02:14:15
                      Local via fxp2.23
172.16.1.0/24      *[Static/5] 02:02:58
                      Discard
172.16.1.0/30      *[RIP/100] 02:14:11, metric 2, tag 0
                    > to 10.0.1.1 via fxp2.12
192.168.1.1/32     *[OSPF/10] 00:13:11, metric 1
                    > to 10.0.2.2 via fxp2.23
224.0.0.5/32       *[OSPF/10] 02:14:15, metric 1
                      MultiRecv
224.0.0.9/32       *[RIP/100] 00:13:11, metric 1
                      MultiRecv
-----

logical-router: r3

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

2.2.2.2/32         *[OSPF/10] 00:13:11, metric 1
                    > to 10.0.2.1 via fxp3.23
10.0.2.0/30        *[Direct/0] 03:36:57
                    > via fxp3.23
                    [OSPF/10] 00:13:11, metric 1
                    > via fxp3.23
10.0.2.2/32        *[Local/0] 03:36:57
                      Local via fxp3.23
172.16.1.0/24      *[OSPF/150] 00:13:11, metric 0, tag 0
                    > to 10.0.2.1 via fxp3.23
192.168.1.1/32     *[Direct/0] 03:36:57
                    > via lo0.3
192.168.2.1/32     *[Direct/0] 03:36:57
                    > via lo0.3
192.168.3.1/32     *[Direct/0] 03:36:57
                    > via lo0.3
192.168.4.1/32     *[Direct/0] 03:36:57
                    > via lo0.3
192.168.5.1/32     *[Direct/0] 03:36:57
                    > via lo0.3
192.168.6.1/32     *[Direct/0] 03:36:57
                    > via lo0.3
224.0.0.5/32       *[OSPF/10] 03:33:06, metric 1
                      MultiRecv
-----

logical-router: r4

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

2.2.2.2/32         *[RIP/100] 01:52:11, metric 3, tag 0
                    > to 172.16.1.1 via fxp4.14
10.0.1.0/30        *[RIP/100] 01:52:11, metric 2, tag 0
                    > to 172.16.1.1 via fxp4.14
10.0.2.0/30        *[RIP/100] 01:52:11, metric 3, tag 0
                    > to 172.16.1.1 via fxp4.14
172.16.1.0/30      *[Direct/0] 01:52:40
                    > via fxp4.14
172.16.1.2/32      *[Local/0] 01:52:40
                      Local via fxp4.14
192.168.1.1/32     *[RIP/100] 00:29:23, metric 3, tag 0
                    > to 172.16.1.1 via fxp4.14
224.0.0.9/32       *[RIP/100] 00:13:12, metric 1
                      MultiRecv
-----

logical-router: default

__juniper_private1__.inet6.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

fe80::250:8bff:fe12:7a2f/128
                   *[Direct/0] 06:48:53
                    > via lo0.16385

                                                                          [edit logical-routers]
root@lab-text# run show ospf route logical-router all

logical-router: r1
OSPF instance is not running
-----

logical-router: r2
Prefix               Path   Route       NH   Metric  NextHop       Nexthop      
                     Type   Type        Type         Interface     addr/label
192.168.1.1          Intra  Router      IP   1       fxp2.23       10.0.2.2
10.0.2.0/30          Intra  Network     IP   1       fxp2.23
192.168.1.1/32       Intra  Network     IP   1       fxp2.23       10.0.2.2
-----

logical-router: r3
2.2.2.2              Intra  AS BR       IP   1       fxp3.23       10.0.2.1
2.2.2.2/32           Intra  Network     IP   1       fxp3.23       10.0.2.1
10.0.2.0/30          Intra  Network     IP   1       fxp3.23
172.16.1.0/24        Ext2   Network     IP   0       fxp3.23       10.0.2.1
-----

logical-router: r4
OSPF instance is not running
-----
                    
logical-router: default
OSPF instance is not running

[edit logical-routers]

root@lab-text# run show rip statistics logical-router all

logical-router: r1
RIPv2 info: port 520; update interval 30s; holddown 180s; timeout 120s.
    rts learned  rts held down  rqsts dropped  resps dropped
              3              0              0              0

fxp1.14:  0 routes learned; 4 routes advertised
Counter                         Total   Last 5 min  Last minute
-------                   -----------  -----------  -----------
Updates Sent                      284           11            2
Triggered Updates Sent             11            0            0
Responses Sent                      0            0            0
Bad Messages                        3            0            0
RIPv1 Updates Received              0            0            0
RIPv1 Bad Route Entries             0            0            0
RIPv1 Updates Ignored               0            0            0
RIPv2 Updates Received              0            0            0
RIPv2 Bad Route Entries             0            0            0
RIPv2 Updates Ignored               0            0            0
Authentication Failures             0            0            0
RIP Requests Received               0            0            0
RIP Requests Ignored                0            0            0

fxp1.12:  3 routes learned; 1 routes advertised
Counter                         Total   Last 5 min  Last minute
-------                   -----------  -----------  -----------
Updates Sent                      284           11            2
Triggered Updates Sent              2            0            0
Responses Sent                      0            0            0
Bad Messages                        3            0            0
RIPv1 Updates Received              0            0            0
RIPv1 Bad Route Entries             0            0            0
RIPv1 Updates Ignored               0            0            0
RIPv2 Updates Received            320           10            2
RIPv2 Bad Route Entries             0            0            0
RIPv2 Updates Ignored               0            0            0
Authentication Failures             0            0            0
RIP Requests Received               0            0            0
RIP Requests Ignored                0            0            0
-----

logical-router: r2
RIPv2 info: port 520; update interval 30s; holddown 180s; timeout 120s.
    rts learned  rts held down  rqsts dropped  resps dropped
              1              0              0              0


fxp2.12:  1 routes learned; 3 routes advertised
Counter                         Total   Last 5 min  Last minute
-------                   -----------  -----------  -----------
Updates Sent                      284           10            2
Triggered Updates Sent              9            0            0
Responses Sent                      0            0            0
Bad Messages                        0            0            0
RIPv1 Updates Received              0            0            0
RIPv1 Bad Route Entries             0            0            0
RIPv1 Updates Ignored               0            0            0
RIPv2 Updates Received            286           10            2
RIPv2 Bad Route Entries             0            0            0
RIPv2 Updates Ignored               0            0            0
Authentication Failures             0            0            0
RIP Requests Received               0            0            0
RIP Requests Ignored                0            0            0
-----

logical-router: r3
RIPv2 instance is not running
-----
                    
logical-router: r4
RIPv2 info: port 520; update interval 30s; holddown 180s; timeout 120s.
    rts learned  rts held down  rqsts dropped  resps dropped
              4              0              0              0


fxp4.14:  4 routes learned; 0 routes advertised
Counter                         Total   Last 5 min  Last minute
-------                   -----------  -----------  -----------
Updates Sent                        0            0            0
Triggered Updates Sent              0            0            0
Responses Sent                      0            0            0
Bad Messages                        1            0            0
RIPv1 Updates Received              0            0            0
RIPv1 Bad Route Entries             0            0            0
RIPv1 Updates Ignored               0            0            0
RIPv2 Updates Received            247           11            3
RIPv2 Bad Route Entries             0            0            0
RIPv2 Updates Ignored               0            0            0
Authentication Failures             0            0            0
RIP Requests Received               0            0            0
RIP Requests Ignored                0            0            0
-----

logical-router: default
RIPv2 instance is not running

[edit logical-routers]
root@lab-text# run show rip neighbor logical-router
                                                    ^
syntax error, expecting <data>.

[edit logical-routers]
root@lab-text# run show rip neighbor logical-router all

logical-router: r1
                         Source          Destination     Send   Receive   In
Neighbor          State  Address         Address         Mode   Mode     Met
--------          -----  -------         -----------     ----   -------  ---
fxp1.14              Up 172.16.1.1      224.0.0.9       mcast  both       1
fxp1.12              Up 10.0.1.1        224.0.0.9       mcast  both       1
-----

logical-router: r2
fxp2.12              Up 10.0.1.2        224.0.0.9       mcast  both       1
-----

logical-router: r3
RIPv2 instance is not running
-----

logical-router: r4
fxp4.14              Up 172.16.1.2      224.0.0.9       mcast  both       1
-----

logical-router: default
RIPv2 instance is not running
验证成功了!!

TOP

发新话题