动态路由ospf

来源:互联网 发布:淘宝可以寄到日本吗 编辑:程序博客网 时间:2024/03/29 15:09
  ospf进程号本地有效,也就是说不同的路由器进程号多少相互之间无所谓,只有当一台路由器有多个ospf进程时才有区分,一台路由器运行多个ospf进程相当于一个路由器运行多种动态路由协议,协议之间一般不能互通,它是为了把一个物理网络划分成多个虚拟网络。  ospf的区域号是为了划分区域,只能有且只有一个区域0。每个区域可以有自己的DR和BDR。ospf R1接R2接R3R1 ip:192.168.12.1 R2 ip:192.168.12.2,192.168.23.2 R3 ip:192.168.23.3R1(config)#int s0/0R1(config-if)#ip add 192.168.12.1 255.255.255.0R1(config-if)#no shutR1(config)#router ospf 1 (此为进程号,随意)R1(config-router)#network 192.168.12.0 0.0.0.255 area 0 (此为区域号)R1#show ip ospf neighborNeighbor ID     Pri   State           Dead Time   Address         Interface192.168.23.2      0   FULL/  -        00:00:37    192.168.12.2    Serial0/0(show ip ospf neighbor:查看ospf邻居,邻居ID即:邻居router ID,为loopback接口中最大的地址,没有loopback接口则为物理接口中最大的地址,state为full表示完全相邻,address为相邻的邻居接口ip,interface为本路由器接口)R2(config)#int s0/0R2(config-if)#ip add 192.168.12.2 255.255.255.0R2(config-if)#no shutR2(config-if)#int s0/1R2(config-if)#ip add 192.168.23.2 255.255.255.0R2(config-if)#no shutR2(config)#router ospf 1R2(config-router)#network 192.168.12.0 0.0.0.255 area 0   ----rip只能宣告主类地址,ospf可以有子网,后跟网络号和通配符R2(config-router)#network 192.168.23.0 0.0.0.255 area 0R3(config)#int s0/0R3(config-if)#ip add 192.168.23.3 255.255.255.0R3(config-if)#no shutR3(config)#router ospf 1R3(config-router)#network 192.168.23.0 0.0.0.255 area 0R3#ping 192.168.12.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 48/70/80 msR3#show ip ospf neighborNeighbor ID     Pri   State           Dead Time   Address         Interface192.168.23.2      0   FULL/  -        00:00:30    192.168.23.2    Serial0/0

0 0