■GNS3でOSPF(ネットワークタイプ:ブロードキャスト)の検証環境を構築してみる。 $ echo "[R1],[R2] -- [R3] -- [R4] -- [R5],[R6]" | \ graph-easy --dot | \ sed -e 's/^}/ {rank=same;R1;R2}\n {rank=same;R5;R6}\n&/' | \ dot -T png -o ospf_sample.png
■最初と最後はいつもと同じ !start enable configure terminal !end end write memory ■インターフェイスの設定 ! R1 hostname R1 int s0/0 ip address 192.168.1.1 255.255.255.0 no shut exit int lo0 ip address 1.1.1.1 255.255.255.255 no shut exit ! R2 hostname R2 int s0/0 ip address 192.168.2.2 255.255.255.0 no shut exit int lo0 ip address 2.2.2.2 255.255.255.255 no shut exit ! R3 hostname R3 int s1/0 ip address 192.168.2.3 255.255.255.0 no shut exit int s1/1 ip address 192.168.1.3 255.255.255.0 no shut exit int lo0 ip address 3.3.3.3 255.255.255.255 no shut exit int e0/0 ip address 192.168.4.3 255.255.255.0 no shut exit ! R4 hostname R4 int e0/0 ip address 192.168.4.4 255.255.255.0 no shut exit int e0/1 ip address 192.168.5.4 255.255.255.0 no shut exit int e0/2 ip address 192.168.6.4 255.255.255.0 no shut exit int lo0 ip address 4.4.4.4 255.255.255.255 no shut exit ! R5 hostname R5 int e0/0 ip address 192.168.5.5 255.255.255.0 no shut exit int lo0 ip address 5.5.5.5 255.255.255.255 no shut exit ! R6 hostname R6 int e0/0 ip address 192.168.6.6 255.255.255.0 no shut exit int lo0 ip address 6.6.6.6 255.255.255.255 no shut exit ■OSPFルーティング設定 ノンブロードキャストをインターフェイスに設定して、 対向のR3にneighborコマンドを投入(R1/R2に投入しても良い) ! R1 router ospf 1 network 192.168.1.0 0.0.0.255 area 0 network 1.1.1.1 0.0.0.0 area 0 int s0/0 ip ospf network non-broadcast exit ! R2 router ospf 1 network 192.168.2.0 0.0.0.255 area 0 network 2.2.2.2 0.0.0.0 area 0 int s0/0 ip ospf network non-broadcast exit ! R3 router ospf 1 network 192.168.1.0 0.0.0.255 area 0 network 192.168.2.0 0.0.0.255 area 0 network 192.168.4.0 0.0.0.255 area 1 network 3.3.3.3 0.0.0.0 area 0 area 1 virtual-link 4.4.4.4 neighbor 192.168.2.2 neighbor 192.168.1.1 int s1/0 ip ospf network non-broadcast exit int s1/1 ip ospf network non-broadcast exit ! R4 router ospf 1 network 192.168.4.0 0.0.0.255 area 1 network 192.168.5.0 0.0.0.255 area 2 network 192.168.6.0 0.0.0.255 area 3 network 4.4.4.4 0.0.0.0 area 1 area 1 virtual-link 3.3.3.3 area 2 nssa area 3 stub no-summary ! R5 router ospf 1 network 192.168.5.0 0.0.0.255 area 2 network 5.5.5.5 0.0.0.0 area 2 area 2 nssa ! R6 router ospf 1 network 192.168.6.0 0.0.0.255 area 3 network 6.6.6.6 0.0.0.0 area 3 area 3 stub ■エリアの種類の確認 R3#show ip protocols | include It It is an area border router R4#show ip protocols | include It It is an area border and autonomous system boundary router R3#show ip ospf | include It It is an area border router R4#show ip ospf | include It It is an area border and autonomous system boundary router It is a NSSA area It is a stub area, no summary LSA in this area R5#show ip ospf | include It It is a NSSA area R6#show ip ospf | include It It is a stub area ■ネイバーの検証 R1#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 1 FULL/DR 00:01:57 192.168.1.3 Serial0/0 R2#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 1 FULL/DR 00:01:59 192.168.2.3 Serial0/0 R3#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 4.4.4.4 0 FULL/ - - 192.168.4.4 OSPF_VL0 1.1.1.1 1 FULL/BDR 00:01:57 192.168.1.1 Serial1/1 2.2.2.2 1 FULL/BDR 00:01:55 192.168.2.2 Serial1/0 4.4.4.4 1 FULL/DR 00:00:33 192.168.4.4 Ethernet0/0 R4#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 0 FULL/ - - 192.168.4.3 OSPF_VL0 3.3.3.3 1 FULL/BDR 00:00:31 192.168.4.3 Ethernet0/0 5.5.5.5 1 FULL/BDR 00:00:36 192.168.5.5 Ethernet0/1 6.6.6.6 1 FULL/BDR 00:00:34 192.168.6.6 Ethernet0/2 R5#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 4.4.4.4 1 FULL/DR 00:00:38 192.168.5.4 Ethernet0/0 R6#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 4.4.4.4 1 FULL/DR 00:00:36 192.168.6.4 Ethernet0/0 ■バーチャルリンクの確認 R3#show ip ospf virtual-links Virtual Link OSPF_VL0 to router 4.4.4.4 is up Run as demand circuit DoNotAge LSA allowed. Transit area 1, via interface Ethernet0/0, Cost of using 10 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:05 Adjacency State FULL (Hello suppressed) Index 2/3, retransmission queue length 0, number of retransmission 1 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 1, maximum is 1 Last retransmission scan time is 0 msec, maximum is 0 msec R4# show ip ospf virtual-links Virtual Link OSPF_VL0 to router 3.3.3.3 is up Run as demand circuit DoNotAge LSA allowed. Transit area 1, via interface Ethernet0/0, Cost of using 10 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:04 Adjacency State FULL (Hello suppressed) Index 1/4, retransmission queue length 0, number of retransmission 1 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 1, maximum is 1 Last retransmission scan time is 0 msec, maximum is 0 msec ■以降はR5に注目して詳細を確認 R5#show ip ospf neighbor detail Neighbor 4.4.4.4, interface address 192.168.5.4 In the area 2 via interface Ethernet0/0 Neighbor priority is 1, State is FULL, 6 state changes DR is 192.168.5.4 BDR is 192.168.5.5 Options is 0x58 LLS Options is 0x1 (LR) Dead timer due in 00:00:36 Neighbor is up for 01:05:40 Index 1/1, retransmission queue length 0, number of retransmission 1 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 1, maximum is 1 Last retransmission scan time is 0 msec, maximum is 0 msec R5#show ip ospf database OSPF Router with ID (5.5.5.5) (Process ID 1) Router Link States (Area 2) Link ID ADV Router Age Seq# Checksum Link count 4.4.4.4 4.4.4.4 1209 0x80000004 0x008F89 1 5.5.5.5 5.5.5.5 992 0x80000003 0x00A945 2 Net Link States (Area 2) Link ID ADV Router Age Seq# Checksum 192.168.5.4 4.4.4.4 1209 0x80000002 0x003D4F Summary Net Link States (Area 2) Link ID ADV Router Age Seq# Checksum 1.1.1.1 4.4.4.4 836 0x80000001 0x00795E 2.2.2.2 4.4.4.4 1492 0x80000001 0x004B88 3.3.3.3 4.4.4.4 1492 0x80000001 0x009A75 4.4.4.4 4.4.4.4 1527 0x80000001 0x00080E 6.6.6.6 4.4.4.4 1527 0x80000001 0x0010F3 192.168.1.0 4.4.4.4 831 0x80000003 0x00DC93 192.168.2.0 4.4.4.4 1492 0x80000001 0x00D59B 192.168.4.0 4.4.4.4 1529 0x80000001 0x003D72 192.168.6.0 4.4.4.4 1529 0x80000001 0x002786 R5#show ip ospf database router OSPF Router with ID (5.5.5.5) (Process ID 1) Router Link States (Area 2) Routing Bit Set on this LSA LS age: 157 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 4.4.4.4 Advertising Router: 4.4.4.4 LS Seq Number: 80000005 Checksum: 0x8D8A Length: 36 Area Border Router AS Boundary Router Number of Links: 1 Link connected to: a Transit Network (Link ID) Designated Router address: 192.168.5.4 (Link Data) Router Interface address: 192.168.5.4 Number of TOS metrics: 0 TOS 0 Metrics: 10 LS age: 1943 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 5.5.5.5 Advertising Router: 5.5.5.5 LS Seq Number: 80000003 Checksum: 0xA945 Length: 48 Number of Links: 2 Link connected to: a Stub Network (Link ID) Network/subnet number: 5.5.5.5 (Link Data) Network Mask: 255.255.255.255 Number of TOS metrics: 0 TOS 0 Metrics: 1 Link connected to: a Transit Network (Link ID) Designated Router address: 192.168.5.4 (Link Data) Router Interface address: 192.168.5.5 Number of TOS metrics: 0 TOS 0 Metrics: 10 R5# show ip ospf interface lo0 Loopback0 is up, line protocol is up Internet Address 5.5.5.5/32, Area 2 Process ID 1, Router ID 5.5.5.5, Network Type LOOPBACK, Cost: 1 Loopback interface is treated as a stub Host R5# show ip ospf interface e0/0 Ethernet0/0 is up, line protocol is up Internet Address 192.168.5.5/24, Area 2 Process ID 1, Router ID 5.5.5.5, Network Type BROADCAST, Cost: 10 Transmit Delay is 1 sec, State BDR, Priority 1 Designated Router (ID) 4.4.4.4, Interface address 192.168.5.4 Backup Designated router (ID) 5.5.5.5, Interface address 192.168.5.5 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:08 Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 4.4.4.4 (Designated Router) Suppress hello for 0 neighbor(s) R5#show ip protocols Routing Protocol is "ospf 1" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 5.5.5.5 Number of areas in this router is 1. 0 normal 0 stub 1 nssa Maximum path: 4 Routing for Networks: 5.5.5.5 0.0.0.0 area 2 192.168.5.0 0.0.0.255 area 2 Routing Information Sources: Gateway Distance Last Update 4.4.4.4 110 00:31:52 5.5.5.5 110 00:43:23 Distance: (default is 110) R5#show ip route Codes: C - connected, S - static, 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 external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, 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 1.0.0.0/32 is subnetted, 1 subnets O IA 1.1.1.1 [110/85] via 192.168.5.4, 00:33:28, Ethernet0/0 2.0.0.0/32 is subnetted, 1 subnets O IA 2.2.2.2 [110/85] via 192.168.5.4, 00:44:25, Ethernet0/0 3.0.0.0/32 is subnetted, 1 subnets O IA 3.3.3.3 [110/21] via 192.168.5.4, 00:44:25, Ethernet0/0 4.0.0.0/32 is subnetted, 1 subnets O IA 4.4.4.4 [110/11] via 192.168.5.4, 00:44:54, Ethernet0/0 5.0.0.0/32 is subnetted, 1 subnets C 5.5.5.5 is directly connected, Loopback0 6.0.0.0/32 is subnetted, 1 subnets O IA 6.6.6.6 [110/21] via 192.168.5.4, 00:45:00, Ethernet0/0 O IA 192.168.4.0/24 [110/20] via 192.168.5.4, 00:45:00, Ethernet0/0 C 192.168.5.0/24 is directly connected, Ethernet0/0 O IA 192.168.6.0/24 [110/20] via 192.168.5.4, 00:45:01, Ethernet0/0 O IA 192.168.1.0/24 [110/84] via 192.168.5.4, 00:33:30, Ethernet0/0 O IA 192.168.2.0/24 [110/84] via 192.168.5.4, 00:44:32, Ethernet0/0 R5#show ip route ospf 1.0.0.0/32 is subnetted, 1 subnets O IA 1.1.1.1 [110/85] via 192.168.5.4, 00:33:55, Ethernet0/0 2.0.0.0/32 is subnetted, 1 subnets O IA 2.2.2.2 [110/85] via 192.168.5.4, 00:44:51, Ethernet0/0 3.0.0.0/32 is subnetted, 1 subnets O IA 3.3.3.3 [110/21] via 192.168.5.4, 00:44:51, Ethernet0/0 4.0.0.0/32 is subnetted, 1 subnets O IA 4.4.4.4 [110/11] via 192.168.5.4, 00:45:20, Ethernet0/0 6.0.0.0/32 is subnetted, 1 subnets O IA 6.6.6.6 [110/21] via 192.168.5.4, 00:45:20, Ethernet0/0 O IA 192.168.4.0/24 [110/20] via 192.168.5.4, 00:45:20, Ethernet0/0 O IA 192.168.6.0/24 [110/20] via 192.168.5.4, 00:45:20, Ethernet0/0 O IA 192.168.1.0/24 [110/84] via 192.168.5.4, 00:33:49, Ethernet0/0 O IA 192.168.2.0/24 [110/84] via 192.168.5.4, 00:44:51, Ethernet0/0 ■LSAタイプ1 R5#show ip ospf database router OSPF Router with ID (5.5.5.5) (Process ID 1) Router Link States (Area 2) Routing Bit Set on this LSA LS age: 800 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 4.4.4.4 Advertising Router: 4.4.4.4 LS Seq Number: 80000005 Checksum: 0x8D8A Length: 36 Area Border Router AS Boundary Router Number of Links: 1 Link connected to: a Transit Network (Link ID) Designated Router address: 192.168.5.4 (Link Data) Router Interface address: 192.168.5.4 Number of TOS metrics: 0 TOS 0 Metrics: 10 LS age: 570 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 5.5.5.5 Advertising Router: 5.5.5.5 LS Seq Number: 80000004 Checksum: 0xA746 Length: 48 Number of Links: 2 Link connected to: a Stub Network (Link ID) Network/subnet number: 5.5.5.5 (Link Data) Network Mask: 255.255.255.255 Number of TOS metrics: 0 TOS 0 Metrics: 1 Link connected to: a Transit Network (Link ID) Designated Router address: 192.168.5.4 (Link Data) Router Interface address: 192.168.5.5 Number of TOS metrics: 0 TOS 0 Metrics: 10 ■LSAタイプ2 R5#show ip ospf database network OSPF Router with ID (5.5.5.5) (Process ID 1) Net Link States (Area 2) Routing Bit Set on this LSA LS age: 468 Options: (No TOS-capability, DC) LS Type: Network Links Link State ID: 192.168.5.4 (address of Designated Router) Advertising Router: 4.4.4.4 LS Seq Number: 80000003 Checksum: 0x3B50 Length: 32 Network Mask: /24 Attached Router: 4.4.4.4 Attached Router: 5.5.5.5 ■LSAタイプ3 R5#show ip ospf database summary OSPF Router with ID (5.5.5.5) (Process ID 1) Summary Net Link States (Area 2) Routing Bit Set on this LSA LS age: 254 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 1.1.1.1 (summary Network Number) Advertising Router: 4.4.4.4 LS Seq Number: 80000002 Checksum: 0x775F Length: 28 Network Mask: /32 TOS: 0 Metric: 75 Routing Bit Set on this LSA LS age: 1011 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 2.2.2.2 (summary Network Number) Advertising Router: 4.4.4.4 LS Seq Number: 80000002 Checksum: 0x4989 Length: 28 Network Mask: /32 TOS: 0 Metric: 75 Routing Bit Set on this LSA LS age: 1013 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 3.3.3.3 (summary Network Number) Advertising Router: 4.4.4.4 LS Seq Number: 80000002 Checksum: 0x9876 Length: 28 Network Mask: /32 TOS: 0 Metric: 11 Routing Bit Set on this LSA LS age: 1014 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 4.4.4.4 (summary Network Number) Advertising Router: 4.4.4.4 LS Seq Number: 80000002 Checksum: 0x60F Length: 28 Network Mask: /32 TOS: 0 Metric: 1 Routing Bit Set on this LSA LS age: 1016 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 6.6.6.6 (summary Network Number) Advertising Router: 4.4.4.4 LS Seq Number: 80000002 Checksum: 0xEF4 Length: 28 Network Mask: /32 TOS: 0 Metric: 11 Routing Bit Set on this LSA LS age: 260 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 192.168.1.0 (summary Network Number) Advertising Router: 4.4.4.4 LS Seq Number: 80000004 Checksum: 0xDA94 Length: 28 Network Mask: /24 TOS: 0 Metric: 74 Routing Bit Set on this LSA LS age: 1018 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 192.168.2.0 (summary Network Number) Advertising Router: 4.4.4.4 LS Seq Number: 80000002 Checksum: 0xD39C Length: 28 Network Mask: /24 TOS: 0 Metric: 74 Routing Bit Set on this LSA LS age: 1019 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 192.168.4.0 (summary Network Number) Advertising Router: 4.4.4.4 LS Seq Number: 80000002 Checksum: 0x3B73 Length: 28 Network Mask: /24 TOS: 0 Metric: 10 Routing Bit Set on this LSA LS age: 1020 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 192.168.6.0 (summary Network Number) Advertising Router: 4.4.4.4 LS Seq Number: 80000002 Checksum: 0x2587 Length: 28 Network Mask: /24 TOS: 0 Metric: 10 ■LSAタイプ4 R5#show ip ospf database asbr-summary OSPF Router with ID (5.5.5.5) (Process ID 1) ■LSAタイプ5 R5#show ip ospf database external OSPF Router with ID (5.5.5.5) (Process ID 1) ■LSAタイプ7 R5#show ip ospf database nssa-external OSPF Router with ID (5.5.5.5) (Process ID 1) ■GNS3のトポロジー autostart = False version = 0.8.7 [127.0.0.1:7200] workingdir = /tmp udp = 10001 [[3620]] image = /ios/c3620-is-mz.123-1.image idlepc = 0x603d5308 sparsemem = True ghostios = True chassis = 3620 [[ROUTER R4]] model = 3620 console = 2104 slot0 = NM-4E e0/ios/0 e0/ios/0 e0/ios/0 slot1 = NM-4T cnfg = configs/R4.cfg [[ROUTER R5]] model = 3620 console = 2105 slot0 = NM-4E e0/ios/1 cnfg = configs/R5.cfg [[ROUTER R6]] model = 3620 console = 2106 slot0 = NM-4E e0/ios/2 cnfg = configs/R6.cfg [[ROUTER R1]] model = 3620 console = 2101 slot0 = NM-4T s0/ios/1 cnfg = configs/R1.cfg [[ROUTER R2]] model = 3620 console = 2102 slot0 = NM-4T s0/ios/0 cnfg = configs/R2.cfg [[ROUTER R3]] model = 3620 console = 2103 slot0 = NM-4E e0/ios/0 slot1 = NM-4T s1/ios/0 s1/ios/0 cnfg = configs/R3.cfg [GNS3-DATA] configs = configs [[NOTE 1]] text = "lo0\n6.6.6.6/32" [[NOTE 2]] text = "lo0\n5.5.5.5/32" [[NOTE 3]] text = "lo0\n4.4.4.4/32" [[NOTE 4]] text = "lo0\n3.3.3.3/32" [[NOTE 5]] text = "lo0\n1.1.1.1/32" [[NOTE 6]] text = "lo0\n2.2.2.2/32" [[NOTE 7]] text = "Area 3" [[NOTE 8]] text = "Area 2" [[NOTE 9]] text = "Area 1" [[NOTE 10]] text = "Area 0" [[NOTE 11]] text = "e0/ios/24" [[NOTE 12]] text = "e0/ios/24" [[NOTE 13]] text = "e0/ios/24" [[NOTE 14]] text = "e0/ios/24" [[NOTE 15]] text = "e0/ios/24" [[NOTE 16]] text = "e0/ios/24" [[NOTE 17]] text = "s1/ios/24" [[NOTE 18]] text = "s1/ios/24" [[NOTE 19]] text = "s0/ios/24" [[NOTE 20]] text = "s0/ios/24" [[SHAPE 1]] [[SHAPE 2]] [[SHAPE 3]] [[SHAPE 4]]