192.168.1.1-路由器设置 | 192.168.0.1-无线路由器设置

Cisco路由器与三层交换机OSPF的基本组网应用

发布时间:2016-11-07 09:00

这次完成的OSPF组网基本配置:
1. 三层交换机
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End withCNTL/Z.
Switch(config)#vlan 10                                      //创建VLAN
Switch(config-vlan)#interface vlan 10                       // 创建VLAN虚接口
%LINK-5-CHANGED: Interface Vlan10, changed state to up
Switch(config-if)#ip address 192.168.10.254255.255.255.0   // 设置VLAN虚接口地址
 
Switch(config-if)#interface fa0/1
Switch(config-if)#switchport access vlan 10             // 设置接口VLAN ID
%LINEPROTO-5-UPDOWN: Line protocol on InterfaceVlan10, changed state to up


 
Switch(config-if)#interface fa0/24                          // 进入接口配置模式
Router(config-if)#no shutdown                               // 启用/打开 接口
Switch(config-if)#no switchport                        // 交换模式改为路由模式
Switch(config-if)#ip address 192.168.20.1255.255.255.0 // 设置接口IP地址
Switch(config-if)#exit
 
Switch(config)#ip routing                                   //启用路由功能

Switch(config)#router ospf 1                                //创建ospf进程1
Switch(config-router)#network192.168.20.0 0.0.0.255 area 1 // 设置子网号与区域ID
Switch(config-router)#redistribute connected            //将直连链路发布到LSDB中
Switch(config-router)#exit
Switch(config)#exit
Switch#write                        // 保存当前配置到系统配置文件,以便下次启动使用
 
2. 路由器R0
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End withCNTL/Z.
Router(config)#hostname R1                              // 修改设备名称
R1(config)#interface fastEthernet 0/0                   // 进入接口配置模式
R1(config-if)#ip address 192.168.20.2 255.255.255.0     // 设置接口IP地址
R1(config-if)#no shutdown                               // 启用/打开 接口
R1(config-if)#interface fastEthernet 0/1
R1(config-if)#ip address 192.168.30.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
 
R1(config)# router ospf 1                                 // 创建ospf进程1
R1(config-router)#network 192.168.20.0 0.0.0.255area 1   // 设置子网号与区域ID
R1(config-router)#network 192.168.30.0 0.0.0.255area 0   // 设置子网号与区域ID


R1(config-router)#exit
Router(config)#exit
Router#write
 
3. 路由器R1
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End withCNTL/Z.
Router(config)#hostname R1
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 192.168.30.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#interface fastEthernet 0/1
R1(config-if)#ip address 192.168.40.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
 
R1(config)#router ospf 1
R1(config-router)#network 192.168.30.0 0.0.0.255area 0
R1(config-router)#network 192.168.40.0 0.0.0.255area 2
R1(config-router)#exit
R1(config)#exit
R1#write
 
4. 路由器R2
Router>enable
Router#confiure terminal
Enter configuration commands, one per line. End withCNTL/Z.
Router(config)#hostname R2
R2(config)#interface fastEthernet 0/0

R2(config-if)#ip address 192.168.40.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface fastEthernet 0/1
R2(config-if)#ip address 192.168.50.254 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
 
R2(config)#router ospf 1
R2(config-router)#network 192.168.40.0 0.0.0.255area 2
R2(config-router)#network 192.168.50.0 0.0.0.255area 2
R2(config-router)#exit
R2(config)#exit
R2#write
 
查看OSPF路由表:
1.三层交换机
Switch#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M- mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA -OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSAexternal type 2
E1 - OSPF external type 1, E2 - OSPF external type 2,E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia- IS-IS inter area
* - candidate default, U - per-user static route, o -ODR
P - periodic downloaded static route


 
Gateway of last resort is not set
 
C 192.168.10.0/24 is directly connected, Vlan10
C 192.168.20.0/24 is directly connected,FastEthernet0/24
O IA 192.168.30.0/24 [110/2] via 192.168.20.2,00:07:08, FastEthernet0/24
O IA 192.168.40.0/24 [110/3] via 192.168.20.2,00:05:31, FastEthernet0/24
OIA 192.168.50.0/24 [110/4] via 192.168.20.2, 00:03:34, FastEthernet0/24
 
2.路由器R2
R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M -mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA -OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA externaltype 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E -EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia -IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
 
Gateway of last resort is not set
 
O E2 192.168.10.0/24 [110/20] via 192.168.40.1,00:00:39, FastEthernet0/0
O IA 192.168.20.0/24 [110/3] via 192.168.40.1,00:03:57, FastEthernet0/0
O IA192.168.30.0/24 [110/2] via 192.168.40.1, 00:03:57, FastEthernet0/0
C 192.168.40.0/24 is directly connected, FastEthernet0/0
C 192.168.50.0/24 is directlyconnected, FastEthernet0/1
 
网络连通性测试:

关于我们 - RSS地图 - 最近更新 - 友情链接 - 网站地图 - 版权声明