pqwsa 发表于 2012-11-15 09:09:40

OSPF中stub area配置实例



拓扑图如上所示,配置如下

r1 {
    interfaces {
      em1 {
            unit 12 {
                vlan-id 12;
                family inet {
                  address 10.0.4.5/30;
                }
            }
      }
      lo0 {
            unit 1 {
                family inet {
                  address 10.0.0.1/32;
                }
            }
      }
    }
    protocols {
      ospf {
            area 0.0.0.1 {
                stub//area 1配置为末节区域
                interface em1.12;
            }
      }
    }
}
r2 {
    interfaces {
      em2 {
            unit 21 {
                vlan-id 12;
                family inet {
                  address 10.0.4.6/30;
                }
            }                           
            unit 23 {
                vlan-id 23;
                family inet {
                  address 10.0.4.2/30;
                }
            }
      }
      lo0 {
            unit 2 {
                family inet {
                  address 10.0.0.2/32;
                }
            }
      }
    }
    protocols {
      ospf {
            area 0.0.0.1 {
                stub default-metric 15 no-summaries;//area1配置了no-summaries为完全末节区域,juniper默认不会像stub区域通告一条默认路由,所以只有配上default-metric才能会向末节区域通告一条默认路由
                interface em2.21;
            }
            area 0.0.0.0 {
                interface em2.23;
            }
      }
    }
}
r3 {
    interfaces {
            unit 32 {
                vlan-id 23;
                family inet {
                  address 10.0.4.1/30;
                }
            }
            unit 34 {
                vlan-id 34;
                family inet {
                  address 10.0.2.5/30;
                }
            }
      }
      lo0 {
            unit 3 {
                family inet {
                  address 10.0.0.3/32;
                }
            }
      }
    }
    protocols {
      ospf {
            export rip-to-ospf;
            area 0.0.0.0 {
                interface em3.32;
            }
      }
      rip {
            group RIP {
                export [ rip-to-rip ospf-to-rip ];
                neighbor em3.34;
            }
      }                              
    }
    policy-options {
      policy-statement ospf-to-rip {
            term 1 {
                from protocol ospf;
                then accept;
            }
            term 2 {
                from interface em3.32;//将接口em3.32所在的网段宣告出去
                then accept;
            }
      }
      policy-statement rip-to-ospf {
            term 1 {
                from {
                  route-filter 10.0.2.4/30 exact;//只有在路由表中的路由条目才能被宣告
                }
                then accept;
            }
      }
      policy-statement rip-to-rip {
            term 1 {
                from interface em3.34;
                then accept;
            }
      }
    }
}
r4 {
    interfaces {
            unit 43 {
                vlan-id 34;
                family inet {
                  address 10.0.2.6/30;
                }
            }
      }
      lo0 {
            unit 4 {
                family inet {
                  address 10.0.0.4/32;
                }
            }
      }
    }
    protocols {
      rip {
            group RIP {
                export rip-to-rip;
                neighbor em4.43;
            }
      }
    }
    policy-options {
      policy-statement rip-to-rip {
            term 1 {
                from interface em4.43;
                then accept;
            }
      }
    }
}olive# run show route logical-system r1 protocol ospf   

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

0.0.0.0/0          * 00:07:11, metric 16
                  > to 10.0.4.6 via em1.12
224.0.0.5/32       * 03:47:21, metric 1
                      MultiRecv
此时我们看到r1有一条默认路由,且汇总路由也被屏蔽了

清风听雨 发表于 2013-3-18 10:37:45

花前月下,不如花钱“日”下!*^_^*

qianqianling 发表于 2013-5-16 20:41:25

此地禁止大小便,违者没收工具。

艾辉 发表于 2013-5-19 07:26:03

只要不下流,我们就是主流!

帝王 发表于 2013-5-22 09:10:50

要是我灌水,就骂我“三个代表”没学好吧。

dog1888 发表于 2013-5-26 04:26:58

男人有冲动可能是爱你,也可能是不爱,但没有冲动肯定是不爱!

hao1nan 发表于 2013-5-30 22:53:45

所有的男人生来平等,结婚的除外。
页: [1]
查看完整版本: OSPF中stub area配置实例