Basic OSPF Configuration
Target:
Master how to configure the OSPF single area on the router.
Tutorial principle:
OSPFOpen Shortest Path First (Open Shortest Path First) protocol is one of the most widely used routing protocols in the network. It is an internal gateway routing protocol that can adapt to network environments of various scales and is a typical link-state protocol.
By spreading the link status information of the device to the entire network, each device in the network is synchronized to a database LSDB in the full network link state.) then, the router uses the SPF algorithm, take yourself as the root, calculate the shortest path to reach other networks, and finally form the information of the entire network.
OSPF belongs to the classless routing protocol and supports VLSM variable-length subnet mask ). OSPF advertise the link status in the form of multicast.
In a network environment with a large model, OSPF supports the division of regions to reasonably plan the network. The area0 backbone area must exist when dividing the area ). Other regions are directly connected to the backbone areas or through virtual links.
Lab Device
One layer-3 Switch
2 Routers
3 crossover or direct connections
Experiment topology:
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/05205C914-0.png "title =" 004.png"/>
Step:
Step 1: configure the IP address in the vro and layer-3 Switch
Switch # configure terminal
Switch (config) # hostname S3750
S3750 (config) # vlan 10
S3750 (config-vlan) # exit
S3750 (config) # vlan 50
S3750 (config-vlan) # exit
S3750 (config) # interface f0/1
S3750 (config-if) # switchport access vlan 10
S3750 (config-if) # exit
S3750 (config) # interface f0/2
S3750 (config-if) # switchport access vlan 50
S3750 (config-if) # exit
S3750 (config) # interface vlan 10
S3750 (config-if) # ip address 172.16.1.2 255.255.255.0
S3750 (config-if) # no shutdown
S3750 (config-if) # exit
S3750 (config) # interface vlan 50
S3750 (config-if) # ip address 172.16.5.1 255.255.255.0
S3750 (config-if) # no shutdown
S3750 (config-if) # exit
Routeconfig # interface fastethernet 0/1
Routeconfig-if # ip address 172.16.1.1 255.255.255.0
Routeconfig-if # no shutdown
Roupid (config-if) # exit
Routeconfig # interface fastethernet 0/0
Routeconfig-if # ip address 172.16.2.1 255.255.255.0
RouterB (config-if) # no shutdown
RouterB (config) # interface fastethernet 0/1
RouterB (config-if) # ip address 172.16.3.1 255.255.255.0
RouterB (config-if) # no shutdown
RouterB (config-if) # exit
RouterB (config) # interface fastethernet 0/0
RouterB (config-if) # ip address 172.16.2.2 255.255.255.0
RouterB (config-if) # no shutdown
Step 2: configure the OSPF Routing Protocol
S3750 (config) # router ospf
S3750 (config-router) # network 172.16.5.0 0.0.255 area 0
S3750 (config-router) # network 172.16.1.0 0.0.255 area 0
S3750 (config-router) # end
Routeconfig # router ospf
Routeconfig-router # network 172.16.1.0 0.0.0.255 area 0
Routeconfig-router # network 172.16.2.0 0.0.0.255 area 0
Routeconfig-router # end
RouterB (config) # router ospf
RouterB (config-router) # network 172.16.2.0 0.0.255 area 0
RouterB (config-router) # network 172.16.3.0 0.0.255 area 0
RouterB (config-router) # end
Step 3: Verify and Test
S3750 # show vlan
VLAN Name Status Ports
--------------------------------------------------------------------------------
1 VLAN0001 STATIC Fa0/3, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13,
Fa0/14 Fa0/15, Fa0/16,
Fa0/17, Fa0/18, Fa0/22
Fa0/19, Fa0/20, Fa0/21,
Fa0/23, Fa0/24, Gi0/25,
Gi0/26, Gi0/27, Gi0/28
10 VLAN0010 STATIC Fa0/1
50 VLAN0050 STATIC Fa0/2
S3750 # show ip interface brief
Interface IP-Address (Pri) OK? Status
VLAN 10 172.16.1.2/24 YES UP
VLAN 50 172.16.5.1/24 YES UP
RA # show ip interface brief
Interface IP-Address (Pri) OK? Status
FastEthernet 0/0 172.16.2.1/24 YES UP
FastEthernet 0/1 172.16.1.1/24 YES UP
RB # show ip interface brief
Interface IP-Address (Pri) OK? Status
FastEthernet 0/0 172.16.2.2/24 YES UP
FastEthernet 0/1 172.16.1.3/24 YES UP
Loopback 0 no address YES DOWN
S3750 # show ip route
Codes: C-connected, S-static, R-rip B-BGP
O-OSPF, IA-OSPF inter area
N1-ospf nssa external type 1, N2-ospf nssa external type 2
E1-OSPF external type 1, E2-OSPF external type 2
I-IS, L1-IS level-1, L2-IS level-2, ia-IS inter area
*-Candidate default
Gateway of last resort is no set
C 172.16.1.0/24 is directly connected, VLAN 10
C 172.16.1.2/32 is local host.
O 172.16.2.0/24 [110/2] via 172.16.1.1, 00:14:09, VLAN 10
O 172.16.3.0/24 [110/3] via 172.16.1.1, 00:04:39, VLAN 10
C 172.16.5.0/24 is directly connected, VLAN 50
C 172.16.5.1/32 is local host.
RA # show ip route
Codes: C-connected, S-static, R-rip B-BGP
O-OSPF, IA-OSPF inter area
N1-ospf nssa external type 1, N2-ospf nssa external type 2
E1-OSPF external type 1, E2-OSPF external type 2
I-IS, L1-IS level-1, L2-IS level-2, ia-IS inter area
*-Candidate default
Gateway of last resort is no set
C 172.16.1.0/24 is directly connected, FastEthernet 0/1
C 172.16.1.1/32 is local host.
C 172.16.2.0/24 is directly connected, FastEthernet 0/0
C 172.16.2.1/32 is local host.
O 172.16.3.0/24 [110/2] via 172.16.2.2, 00:05:21, FastEthernet 0/0
O 172.16.5.0/24 [110/2] via 172.16.1.2, 00:14:51, FastEthernet 0/1
RB # show ip route
Codes: C-connected, S-static, R-rip B-BGP
O-OSPF, IA-OSPF inter area
N1-ospf nssa external type 1, N2-ospf nssa external type 2
E1-OSPF external type 1, E2-OSPF external type 2
I-IS, L1-IS level-1, L2-IS level-2, ia-IS inter area
*-Candidate default
Gateway of last resort is no set
O 172.16.1.0/24 [110/2] via 172.16.2.1, 00:05:58, FastEthernet 0/0
C 172.16.2.0/24 is directly connected, FastEthernet 0/0
C 172.16.2.2/32 is local host.
C 172.16.3.0/24 is directly connected, FastEthernet 0/1
C 172.16.3.1/32 is local host.
O 172.16.5.0/24 [110/3] via 172.16.2.1, 00:15:22, FastEthernet 0/0
RA # show ip ospf neighbor
OSPF process 1:
Neighbor ID Pri State Dead Time Address Interface
172.16.5.1 1 Full/DR 00:00:38 172.16.1.2 FastEthernet 0/1
172.16.2.2 1 Full/DR 00:00:36 172.16.2.2 FastEthernet 0/0
RA # show ip ospf interface fastEthernet 0/0
FastEthernet 0/0 is up, line protocol is up
IP Address 172.16.2.1/24, Ifindex 1, Area 0.0.0.0, MTU 1500
Matching network config: 172.16.2.0/24
Process ID 1, Router ID 172.167.1.1, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 172.16.2.2, Interface Address 172.16.2.2
Backup Designated Router (ID) 172.167.1.1, Interface Address 172.16.2.1
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:05
Neighbor Count is 1, Adjacent neighbor count is 1
Crypt Sequence Number is 82589
Hello received 114 sent 115, DD received 4 sent 5
LS-Req received 1 sent 1, LS-Upd received 5 sent 9
LS-Ack received 6 sent 4, Discarded 0
Note]
1. When declaring a direct connection CIDR Block, be sure to write the anti-mask of the CIDR block.
2. When declaring a direct connection CIDR block, you must specify the region to which it belongs.
Reference Configuration]
S3750 # show running-config
Building configuration...
Current configuration: 1399 bytes
!
Version RGNOS 10.1.00 (4), Release (18443) (Tue Jul 17 19:51:54 CST 2007-ubu6server)
Hostname S3750
!
Vlan 1
!
Vlan 10
!
Vlan 50
!
Interface FastEthernet 0/1
Switchport access vlan 10
!
Interface FastEthernet 0/2
Switchport access vlan 50
!
Interface FastEthernet 0/3
!
Interface FastEthernet 0/4
!
Interface FastEthernet 0/5
!
Interface FastEthernet 0/6
!
Interface FastEthernet 0/7
!
Interface FastEthernet 0/8
!
Interface FastEthernet 0/9
!
Interface FastEthernet 0/10
!
Interface FastEthernet 0/11
!
Interface FastEthernet 0/12
!
Interface FastEthernet 0/13
!
Interface FastEthernet 0/14
!
Interface FastEthernet 0/15
!
Interface FastEthernet 0/16
!
Interface FastEthernet 0/17
!
Interface FastEthernet 0/18
!
Interface FastEthernet 0/19
!
Interface FastEthernet 0/20
!
Interface FastEthernet 0/21
!
Interface FastEthernet 0/22
!
Interface FastEthernet 0/23
!
Interface FastEthernet 0/24
!
Interface GigabitEthernet 0/25
!
Interface GigabitEthernet 0/26
!
Interface GigabitEthernet 0/27
!
Interface GigabitEthernet 0/28
!
Interface VLAN 10
Ip address 172.16.1.2 255.255.255.0
!
Interface VLAN 50
Ip address 172.16.5.1 255.255.255.0
!
Router ospf 1
Network 172.16.1.0 0.0.0.255 area 0
Network 172.16.5.0 0.0.0.255 area 0
!
Line con 0
Line vty 0 4
Login
!
End
RB # show running-config
Building configuration...
Current configuration: 579 bytes
!
Version RGNOS 10.1.00 (4), Release (18443) (Tue Jul 17 20:50:30 CST 2007-ubu1server)
Hostname RB
!
Interface FastEthernet 0/0
Ip address 172.16.2.2 255.255.255.0
Duplex auto
Speed auto
!
Interface FastEthernet 0/1
Ip address 172.16.3.1 255.255.255.0
Duplex auto
Speed auto
!
Interface Loopback 0
!
Router ospf 1
Network 172.16.2.0 0.0.0.255 area 0
Network 172.16.3.0 0.0.0.255 area 0
!
Line con 0
Line aux 0
Line vty 0 4
Login
!
End
RA # show running-config
Building configuration...
Current configuration: 554 bytes
!
Version RGNOS 10.1.00 (4), Release (18443) (Tue Jul 17 20:50:30 CST 2007-ubu1server)
Hostname RA
!
Interface FastEthernet 0/0
Ip address 172.16.2.1 255.255.255.0
Duplex auto
Speed auto
!
Interface FastEthernet 0/1
Ip address 172.16.1.1 255.255.255.0
Duplex auto
Speed auto
!
Router ospf 1
Network 172.16.1.0 0.0.0.255 area 0
Network 172.16.2.0 0.0.0.255 area 0
!
Line con 0
Line aux 0
Line vty 0 4
Login
!
End
This article is from the "Security_net" blog, please be sure to keep this http://yxh1157686920.blog.51cto.com/7743046/1286642