在JUNOS中啓用OSPF

        最近在學習JUNOS,剛剛起步,感覺從IOS過渡還是蠻快的,畢竟原理性的東西相通,今天特意做了一下OSPF,實驗環境是ITAA的JUNOS虛擬機(哈哈打一下小廣告),從以前不能識別Intel網卡到不支持組播再到現在的基本OK,虛擬機的發展還是挺迅速的,這對我們來講無疑是莫大的幫助,好,不說這個,我們來看看如何在JUNOS中配置OSPF。
 
       實驗中利用JUNOS的邏輯路由器特性起了3臺Router,分別爲R1,R2,R3 ,拓撲爲(lo0.0 1.1.1.1)R1---12.1.1.0---R2(lo0.1 2.2.2.2)---23.1.1.0----R3(lo0.2 3.3.3.3),由於是邏輯上的路由器,實際的物理接口只有FXP0到FXP3,所以要打上Vlan-tagging,事實上就是每臺邏輯路由器的單臂路由。
 
具體配置如下:(大家不要以爲是C++ , JUNOS的show可讀性還是很強的)
 
[edit]
root@Router1# show
## Last changed: 2008-06-02 21:52:49 UTC
version 8.5R1.14;
system {
    host-name Router1;
    domain-name mynetwork.com;
    backup-router 192.168.15.2;
    root-authentication {
        encrypted-password "$1$rJIo5b.H$JOjbMEuowTG/IE1lh4Upo0"; ## SECRET-DATA
    }
    name-server {
        192.168.15.3;
    }
    services {
        web-management {
            http {
                port 80;
            }
        }
    }
    syslog {
        user * {
            any emergency;
        }
        file messages {
            any notice;
            authorization info;
        }
        file interactive-commands {
            interactive-commands any;
        }
    }
}
logical-routers {
    R1 {
        interfaces {
            fxp1 {
                unit 10 {
                    vlan-id 10;
                    family inet {
                        address 12.1.1.1/30;
                    }
                }
            }
            lo0 {
                unit 0 {
                    family inet {
                        address 1.1.1.1/32;
                    }
                }
            }
        }
        protocols {
            ospf {
                area 0.0.0.0 {
                    interface fxp1.10;
                    interface lo0.0;
                }
            }
        }
        routing-options {
            router-id 1.1.1.1;
        }
    }
    R2 {
        interfaces {
            fxp2 {
                unit 20 {
                    vlan-id 10;
                    family inet {
                        address 12.1.1.2/30;
                    }
                }
                unit 30 {
                    vlan-id 20;
                    family inet {
                        address 23.1.1.2/24;
                    }
                }
            }
            lo0 {
                unit 1 {
                    family inet {
                        address 2.2.2.2/32;
                    }
                }
            }
        }
        protocols {
            ospf {
                area 0.0.0.0 {
                    interface fxp2.20;
                    interface lo0.1;
                    interface fxp2.30;
                }
            }
        }
        routing-options {
            router-id 2.2.2.2;
        }
    }
    R3 {
        interfaces {
            fxp3 {
                unit 30 {
                    vlan-id 20;
                    family inet {
                        address 23.1.1.3/24;
                    }
                }
            }
            lo0 {
                unit 2 {
                    family inet {
                        address 3.3.3.3/32;
                    }
                }  
            }
        }
        protocols {
            ospf {
                area 0.0.0.0 {
                    interface lo0.2;
                    interface fxp3.30;
                }
            }
        }
        routing-options {
            router-id 3.3.3.3;
        }
    }
}
interfaces {
    fxp0 {
        unit 0 {
            family inet {
                address 192.168.200.205/24;
            }
        }
    }              
    fxp1 {
        vlan-tagging;
    }
    fxp2 {
        vlan-tagging;
    }
    fxp3 {
        vlan-tagging;
    }
}
routing-options {
    static {
        route 192.168.0.0/16 {
            next-hop 192.168.200.1;
            active;
        }
    }
}
 
然後在R1上查看路由表看是否學習到OSPF路由:
 
[edit]
root@Router1# run show route logical-router R1
inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
1.1.1.1/32         *[Direct/0] 00:27:16
                    > via lo0.0
2.2.2.2/32         *[OSPF/10] 00:26:27, metric 10
                    > to 12.1.1.2 via fxp1.10
3.3.3.3/32         *[OSPF/10] 00:13:33, metric 20
                    > to 12.1.1.2 via fxp1.10
12.1.1.0/30        *[Direct/0] 00:27:16
                    > via fxp1.10
12.1.1.1/32        *[Local/0] 00:27:16
                      Local via fxp1.10
23.1.1.0/24        *[OSPF/10] 00:13:38, metric 20
                    > to 12.1.1.2 via fxp1.10
224.0.0.5/32       *[OSPF/10] 00:27:21, metric 1
                      MultiRecv
 
通過ping在R3上測試連通性:
 
root@Router1> ping 1.1.1.1 logical-router R3
PING 1.1.1.1 (1.1.1.1): 56 data bytes
64 bytes from 1.1.1.1: icmp_seq=0 ttl=63 time=3.499 ms
64 bytes from 1.1.1.1: icmp_seq=1 ttl=63 time=4.611 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=63 time=4.507 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=63 time=4.489 ms

^C
--- 1.1.1.1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 3.499/4.276/4.611/0.451 ms
 
JUNOS的ping個人感覺比較詭異,就是不按Ctrl+C就不會停止,和IOS反差好大,一開始不知道這個鍵的時候,真是鬱悶,ping死了給...
 
通過show在R2上查看OSPF鄰居是否建立:
 
root@Router1> show ospf neighbor logical-router R2
Address          Interface              State     ID               Pri  Dead
12.1.1.1         fxp2.20                Full      1.1.1.1          128    39
23.1.1.3         fxp2.30                Full      3.3.3.3          128    37
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章