labunix's blog

labunixのラボUnix

GNS3でRIPv2/OSPFv2/EIGRP環境を作成してみる。

■GNS3でRIPv2/OSPFv2/EIGRP環境を作成してみる。
 単純に最小構成で設定していくだけ。
 途中で分けた方が良いプロトコルも今回は一緒にしてしまう。
 ルーティング再配布等はしていないので端から端まで疎通がとれる分けではない。

 RIPv2についてはc2600で、ルータをR1/R2として、クライアントをC1/C2として使用する。
 OSPFv2についてはc3600でR1/R3/R4を使用する。
 EIGRPについてはc3600で、ルータをR3/R4/R5として使用する。

■RIPv2環境は単純に下記のようにする。

[C1(fa0/1)] -- [R1(fa0/1-fa0/0)] -- [R2(fa0/0-fa0/1)] -- [C2(fa0/1)]
[192.168.1.1/24] -- [192.168.1.254/24-192.168.100.1/24] -- [192.168.100.2/24-192.168.2.254/24] -- [192.168.2.1/24]

■単純に上記環境にするためのC1とC2の設定

! C1 fa0/1 192.168.1.1/24
enable
configure terminal
  no cdp run 
  hostname C1
  interface fastEthernet 0/1
  ip address 192.168.1.1 255.255.255.0
  no shutdown
  ip route 0.0.0.0 0.0.0.0 192.168.1.254
  end
write memory
!C2 fa0/1 192.168.2.1/24
enable
configure terminal
  no cdp run
  hostname C2
  interface fastEthernet 0/1
  ip address 192.168.2.1 255.255.255.0
  no shutdown
  ip route 0.0.0.0 0.0.0.0 192.168.2.254
  end
write memory

■C1/C2のgatewayの確認

C1#show ip route | begin Gateway
Gateway of last resort is 192.168.1.254 to network 0.0.0.0

C    192.168.1.0/24 is directly connected, FastEthernet0/1
S*   0.0.0.0/0 [1/0] via 192.168.1.254

C2#show ip route | begin Gateway
Gateway of last resort is 192.168.2.254 to network 0.0.0.0

C    192.168.2.0/24 is directly connected, FastEthernet0/1
S*   0.0.0.0/0 [1/0] via 192.168.2.254

■単純に上記環境にするためのR1とR2の設定

! R1
! fa0/0 192.168.100.1/24
! fa0/1 192.168.1.254/24
enable
configure terminal
  hostname R1
  interface fastEthernet 0/0
  ip address 192.168.100.1 255.255.255.0
  no shutdown
  interface fastEthernet 0/1
  ip address 192.168.1.254 255.255.255.0
  no shutdown
  end
write memory

! R2
! fa0/1 192.168.100.2/24
! fa0/0 192.168.2.254/24
enable
configure terminal
  hostname R2
  interface fastEthernet 0/0
  ip address 192.168.100.2 255.255.255.0
  no shutdown
  interface fastEthernet 0/1
  ip address 192.168.2.254 255.255.255.0
  no shutdown
  end
write memory

■R1とR2のping疎通確認が出来る状態にする。

R2#show ip route | begin Gateway
Gateway of last resort is not set

C    192.168.2.0/24 is directly connected, FastEthernet0/1
C    192.168.100.0/24 is directly connected, FastEthernet0/0

R1#show ip route | begin Gateway
Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, FastEthernet0/1
C    192.168.100.0/24 is directly connected, FastEthernet0/0

■RIPv2の設定

! R1
configure terminal 
  router rip
  version 2
  network 192.168.1.0
  network 192.168.100.0
  end
write memory
! R2
configure terminal
  router rip
  version 2
  network 192.168.2.0
  network 192.168.100.0
  end 
write memory

■交換したルーティング情報を確認

R1#show ip route | begin Gateway
Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, FastEthernet0/1
R    192.168.2.0/24 [120/1] via 192.168.100.2, 00:00:12, FastEthernet0/0
C    192.168.100.0/24 is directly connected, FastEthernet0/0

R2#show ip route | begin Gateway
Gateway of last resort is not set

R    192.168.1.0/24 [120/1] via 192.168.100.1, 00:00:10, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/1
C    192.168.100.0/24 is directly connected, FastEthernet0/0

■ルーティングプロトコルの情報を確認

R1#show ip protocols 
Routing Protocol is "rip"
  Sending updates every 30 seconds, next due in 21 seconds
  Invalid after 180 seconds, hold down 180, flushed after 240
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Redistributing: rip
  Default version control: send version 2, receive version 2
    Interface             Send  Recv  Triggered RIP  Key-chain
    FastEthernet0/0       2     2                                    
    FastEthernet0/1       2     2                                    
  Automatic network summarization is in effect
  Maximum path: 4
  Routing for Networks:
    192.168.1.0
    192.168.100.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.100.2        120      00:00:10
  Distance: (default is 120)

R2#show ip protocols 
Routing Protocol is "rip"
  Sending updates every 30 seconds, next due in 25 seconds
  Invalid after 180 seconds, hold down 180, flushed after 240
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Redistributing: rip
  Default version control: send version 2, receive version 2
    Interface             Send  Recv  Triggered RIP  Key-chain
    FastEthernet0/0       2     2                                    
    FastEthernet0/1       2     2                                    
  Automatic network summarization is in effect
  Maximum path: 4
  Routing for Networks:
    192.168.2.0
    192.168.100.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.100.1        120      00:00:29
  Distance: (default is 120)

■R1とR3、R4を追加し、OSPFv2環境を作成する。
 C1/C2はリソース64MBx2+ホスト管理分の節約のために電源OFFしても問題ない。
 R1にはNM-1FE-TXをスロットに追加。
 R3/R4はc3600とし、NM-4Tをスロットに追加。
 各ルータでping疎通確認がとれる環境を作成。

[R1(fa1/0)] -- [R3(fa0/0-s1/0)] -- [R4(s1/0)]
[192.168.200.1/30] -- [192.168.200.2/30-172.16.0.3/24] -- [172.16.0.4/24]

!R1 fa1/0 192.168.200.1/30
configure terminal
  interface fa1/0
  ip address 192.168.200.1 255.255.255.252
  no shutdown
  end
write memory
!R3 fa1/0 192.168.200.2/30
!   s1/0 172.16.0.3/24
configure terminal
  hostname R3
  interface fa0/0
  ip address 192.168.200.2 255.255.255.252
  no shutdown
  interface s1/0
  ip address 172.16.0.3 255.255.255.0
  clock rate 64000
  no shutdown
  no ip http server
  end
write memory
!R4
!   s1/0 172.16.0.4/24
configure terminal
  hostname R4
  interface s1/0
  ip address 172.16.0.4 255.255.255.0
  clock rate 64000
  no shutdown
  no ip http server
  end
write memory

■R1とR3、R3とR4のping疎通がとれる環境を確認。

R1#show ip route | begin Gateway
Gateway of last resort is not set

     192.168.200.0/30 is subnetted, 1 subnets
C       192.168.200.0 is directly connected, FastEthernet1/0
C    192.168.1.0/24 is directly connected, FastEthernet0/1
R    192.168.2.0/24 [120/1] via 192.168.100.2, 00:00:02, FastEthernet0/0
C    192.168.100.0/24 is directly connected, FastEthernet0/0

R3#show ip route | begin Gateway
Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.0.0 is directly connected, Serial1/0
     192.168.200.0/30 is subnetted, 1 subnets
C       192.168.200.0 is directly connected, FastEthernet0/0

R4#show ip route | begin Gateway
Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.0.0 is directly connected, Serial1/0

■R1/R3間をOSPFv2のエリア1、R3/R4間をOSPFv2エリア0に設定

!R3
configure terminal 
  router ospf 1
  network 192.168.200.0 0.0.0.3 area 1
  network 172.16.0.0 0.0.0.255 area 0
  end
write memory

!R1
configure terminal
  router ospf 1
  network 192.168.200.0 0.0.0.3 area 1
  end
write memory
!R4
configure terminal
  router ospf 1
  network 172.16.0.0 0.0.0.255 area 0
  end
write memory

■R1->R3->R4にping疎通確認が出来ることを確認。
 ルーティング経路の無い逆方向は不可。

R1#show ip route | begin Gateway
Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
O IA    172.16.0.0 [110/65] via 192.168.200.2, 00:01:19, FastEthernet1/0
     192.168.200.0/30 is subnetted, 1 subnets
C       192.168.200.0 is directly connected, FastEthernet1/0
C    192.168.1.0/24 is directly connected, FastEthernet0/1
R    192.168.2.0/24 [120/1] via 192.168.100.2, 00:00:10, FastEthernet0/0
C    192.168.100.0/24 is directly connected, FastEthernet0/0

R3#show ip route | begin Gateway
Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.0.0 is directly connected, Serial1/0
     192.168.200.0/30 is subnetted, 1 subnets
C       192.168.200.0 is directly connected, FastEthernet0/0

R4#show ip route | begin Gateway
Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.0.0 is directly connected, Serial1/0
     192.168.200.0/30 is subnetted, 1 subnets
O IA    192.168.200.0 [110/65] via 172.16.0.3, 00:01:27, Serial1/0

■EIGRPのためにc3600のR5を追加。
 スロットにNM-4Tを追加。

[R3(s1/1)] -- [R5(s0/1-s0/2)] -- [R4(s1/2)]
[192.168.201.3/24] -- [192.168.201.5/24-192.168.202.5/24] -- [192.168.202.4/24]

■まずはループしないようにR3とR5を接続して疎通確認がとれる構成にする。

! R5 s0/1 192.168.201.5/24
enable
configure terminal
  hostname R5
  interface s0/1
  ip address 192.168.201.5 255.255.255.0
  clock rate 64000
  no shutdown
  interface s0/2
  ip address 192.168.202.5 255.255.255.0
  clock rate 64000
  no shutdown
  no ip http server
  end
write memory
! R3 s1/1 192.168.201.3 255.255.255.0
configure terminal
  interface s1/1
  ip address 192.168.201.3 255.255.255.0
  clock rate 64000
  no shutdown
  end
write memory

■R3/R5間でのルーティング情報

R3#show ip route | begin Gateway
Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.0.0 is directly connected, Serial1/0
     192.168.200.0/30 is subnetted, 1 subnets
C       192.168.200.0 is directly connected, FastEthernet0/0
C    192.168.201.0/24 is directly connected, Serial1/1

R5#show ip route | begin Gateway
Gateway of last resort is not set

C    192.168.201.0/24 is directly connected, Serial0/1

■EIGRPの設定

!R3 AS番号1
configure terminal
  router eigrp 1
  network 172.16.0.0
  network 192.168.201.0
  end
write memory
!R5 AS番号1
configure terminal
  router eigrp 1
  network 192.168.201.0
  network 192.168.202.0
  end
write memory

■EIGRPの確認

R3#show ip eigrp neighbors 
IP-EIGRP neighbors for process 1
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   192.168.201.5           Se1/1             10 00:00:13    1  4500  0  2

R5#show ip eigrp neighbors 
IP-EIGRP neighbors for process 1
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   192.168.201.3           Se0/1             12 00:00:22  412  2472  0  1

R3#show ip route eigrp 
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
D       172.16.0.0/16 is a summary, 00:01:15, Null0

R5#show ip route eigrp 
D    172.16.0.0/16 [90/2681856] via 192.168.201.3, 00:00:29, Serial0/1

■R4のinterfaceの追加とEIGRPの設定

!R4 AS番号1
!   s1/2 192.168.202.4/24
configure terminal
  interface s1/2
  ip address 192.168.202.4 255.255.255.0
  clock rate 64000
  no shutdown
  router eigrp 1
  network 172.16.0.0
  network 192.168.202.0
  end
write memory

■R3/R4/R5のルーティング情報の確認

R3#show ip route | begin Gateway
Gateway of last resort is not set

     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.0.0/24 is directly connected, Serial1/0
D       172.16.0.0/16 is a summary, 00:03:43, Null0
     192.168.200.0/30 is subnetted, 1 subnets
C       192.168.200.0 is directly connected, FastEthernet0/0
C    192.168.201.0/24 is directly connected, Serial1/1

R4#show ip route | begin Gateway
Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.0.0 is directly connected, Serial1/0
     192.168.200.0/30 is subnetted, 1 subnets
O IA    192.168.200.0 [110/65] via 172.16.0.3, 00:49:32, Serial1/0
D    192.168.201.0/24 [90/2681856] via 172.16.0.3, 00:00:44, Serial1/0

R5#show ip route | begin Gateway
Gateway of last resort is not set

D    172.16.0.0/16 [90/2681856] via 192.168.201.3, 00:02:11, Serial0/1
C    192.168.201.0/24 is directly connected, Serial0/1

R3#show ip eigrp neighbors 
IP-EIGRP neighbors for process 1
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
1   172.16.0.4              Se1/0             14 00:03:38  276  1656  0  3
0   192.168.201.5           Se1/1              8 00:06:40   30   200  0  6

R4#show ip eigrp neighbors 
IP-EIGRP neighbors for process 1
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   172.16.0.3              Se1/0             12 00:03:57  603  3618  0  10

R5#show ip eigrp neighbors 
IP-EIGRP neighbors for process 1
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   192.168.201.3           Se0/1             13 00:03:55  189  1134  0  7

■EIGRPの設定の確認が出来たので、R4/R5間のシリアルケーブルを接続。
 ルーティングテーブルにある範囲内のIPアドレスであればping疎通確認が出来る。

R3#show ip eigrp neighbors 
IP-EIGRP neighbors for process 1
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
1   172.16.0.4              Se1/0             12 00:05:36  188  1128  0  7
0   192.168.201.5           Se1/1             11 00:08:38   30   200  0  12

R4#show ip eigrp neighbors 
IP-EIGRP neighbors for process 1
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
1   192.168.202.5           Se1/2              7 00:01:00 1102  5000  0  13
0   172.16.0.3              Se1/0             14 00:05:44  389  2334  0  15

R5#show ip eigrp neighbors 
IP-EIGRP neighbors for process 1
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
1   192.168.202.4           Se0/2             12 00:00:39   52   312  0  6
0   192.168.201.3           Se0/1             13 00:04:54   96   576  0  14

R3#show ip route | begin Gateway
Gateway of last resort is not set

     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.0.0/24 is directly connected, Serial1/0
D       172.16.0.0/16 is a summary, 00:09:34, Null0
     192.168.200.0/30 is subnetted, 1 subnets
C       192.168.200.0 is directly connected, FastEthernet0/0
C    192.168.201.0/24 is directly connected, Serial1/1
D    192.168.202.0/24 [90/2681856] via 172.16.0.4, 00:01:37, Serial1/0
                      [90/2681856] via 192.168.201.5, 00:01:37, Serial1/1

R4#show ip route | begin Gateway
Gateway of last resort is not set

     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.0.0/24 is directly connected, Serial1/0
D       172.16.0.0/16 is a summary, 00:01:54, Null0
     192.168.200.0/30 is subnetted, 1 subnets
O IA    192.168.200.0 [110/65] via 172.16.0.3, 00:55:23, Serial1/0
D    192.168.201.0/24 [90/2681856] via 172.16.0.3, 00:01:49, Serial1/0
                      [90/2681856] via 192.168.202.5, 00:01:49, Serial1/2
C    192.168.202.0/24 is directly connected, Serial1/2

R5#show ip route | begin Gateway
Gateway of last resort is not set

D    172.16.0.0/16 [90/2681856] via 192.168.201.3, 00:01:09, Serial0/1
                   [90/2681856] via 192.168.202.4, 00:01:09, Serial0/2
C    192.168.201.0/24 is directly connected, Serial0/1
C    192.168.202.0/24 is directly connected, Serial0/2

■トポロジー

$ awk '!/[xyz] =|idlepc/' topology.net | sed -e 's%/h.*Images%%g'
autostart = False
version = 0.8.7
[127.0.0.1:7202]
    workingdir = /tmp
    udp = 10201
    [[3620]]
        image = /ios/c3620-is-mz.123-1.image
        sparsemem = True
        ghostios = True
        chassis = 3620
    [[ROUTER R4]]
        model = 3620
        console = 2115
        cnfg = configs/R4.recovered.cfg
        slot0 = NM-1FE-TX
        slot1 = NM-4T
        s1/0 = R3 s1/0
        s1/2 = R5 s0/2
    [[ROUTER R3]]
        model = 3620
        console = 2114
        cnfg = configs/R3.recovered.cfg
        slot0 = NM-1FE-TX
        f0/0 = R1 f1/0
        slot1 = NM-4T
        s1/0 = R4 s1/0
        s1/1 = R5 s0/1
[127.0.0.1:7203]
    workingdir = /tmp
    udp = 10301
    [[3620]]
        image = /ios/c3620-is-mz.123-1.image
        sparsemem = True
        ghostios = True
        chassis = 3620
    [[ROUTER R5]]
        model = 3620
        console = 2109
        slot0 = NM-4T
        s0/1 = R3 s1/1
        s0/2 = R4 s1/2
        cnfg = configs/R5.recovered.cfg
[127.0.0.1:7200]
    workingdir = /tmp
    udp = 10001
    [[2621]]
        image = /ios/c2600-j1s3-mz.123-26.image
        sparsemem = True
        ghostios = True
        chassis = 2621
    [[ROUTER R1]]
        model = 2621
        console = 2104
        cnfg = configs/R1.cfg
        f0/0 = R2 f0/0
        f0/1 = C1 f0/1
        slot1 = NM-1FE-TX
        f1/0 = R3 f0/0
    [[ROUTER R2]]
        model = 2621
        console = 2105
        cnfg = configs/R2.cfg
        f0/0 = R1 f0/0
        f0/1 = C2 f0/1
    [[ROUTER C2]]
        model = 2621
        console = 2113
        cnfg = configs/C2.cfg
        f0/1 = R2 f0/1
        symbol = computer
    [[ROUTER C1]]
        model = 2621
        console = 2112
        cnfg = configs/C1.cfg
        f0/1 = R1 f0/1
        symbol = computer
[GNS3-DATA]
    configs = configs


■C1/C2のconfig

$ awk '!/\!|^line|^boot|^service|^no |^memory|^ login/' C[12].cfg

version 12.3
hostname C1
ip subnet-zero
ip cef
interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
interface FastEthernet0/1
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
ip classless
ip route 0.0.0.0 0.0.0.0 192.168.1.254
end

version 12.3
hostname C2
ip subnet-zero
ip cef
interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
interface FastEthernet0/1
 ip address 192.168.2.1 255.255.255.0
 duplex auto
 speed auto
ip classless
ip route 0.0.0.0 0.0.0.0 192.168.2.254
end

■R1/R2/R3/R4/R5のconfig

$ awk '!/\!|^line|^boot|^service|^no |^memory|^ login/' R[12345].cfg
version 12.3
hostname R1
ip subnet-zero
ip cef
interface FastEthernet0/0
 ip address 192.168.100.1 255.255.255.0
 duplex auto
 speed auto
interface FastEthernet0/1
 ip address 192.168.1.254 255.255.255.0
 duplex auto
 speed auto
interface FastEthernet1/0
 ip address 192.168.200.1 255.255.255.252
 duplex auto
 speed auto
router ospf 1
 log-adjacency-changes
 network 192.168.200.0 0.0.0.3 area 1
router rip
 version 2
 network 192.168.1.0
 network 192.168.100.0
ip classless
end

version 12.3
hostname R2
ip subnet-zero
ip cef
interface FastEthernet0/0
 ip address 192.168.100.2 255.255.255.0
 duplex auto
 speed auto
interface FastEthernet0/1
 ip address 192.168.2.254 255.255.255.0
 duplex auto
 speed auto
router rip
 version 2
 network 192.168.2.0
 network 192.168.100.0
ip classless
end


version 12.3
hostname R3
ip subnet-zero
interface FastEthernet0/0
 ip address 192.168.200.2 255.255.255.252
 duplex auto
 speed auto
interface Serial1/0
 ip address 172.16.0.3 255.255.255.0
 serial restart_delay 0
 clockrate 64000
interface Serial1/1
 ip address 192.168.201.3 255.255.255.0
 serial restart_delay 0
 clockrate 64000
interface Serial1/2
 no ip address
 shutdown
 serial restart_delay 0
interface Serial1/3
 no ip address
 shutdown
 serial restart_delay 0
router eigrp 1
 network 172.16.0.0
 network 192.168.201.0
 auto-summary
router ospf 1
 log-adjacency-changes
 network 172.16.0.0 0.0.0.255 area 0
 network 192.168.200.0 0.0.0.3 area 1
ip classless
end


version 12.3
hostname R4
ip subnet-zero
interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
interface Serial1/0
 ip address 172.16.0.4 255.255.255.0
 serial restart_delay 0
 clockrate 64000
interface Serial1/1
 no ip address
 shutdown
 serial restart_delay 0
interface Serial1/2
 ip address 192.168.202.4 255.255.255.0
 serial restart_delay 0
 clockrate 64000
interface Serial1/3
 no ip address
 shutdown
 serial restart_delay 0
router eigrp 1
 network 172.16.0.0
 network 192.168.202.0
 auto-summary
router ospf 1
 log-adjacency-changes
 network 172.16.0.0 0.0.0.255 area 0
ip classless
end

version 12.3
hostname R5
ip subnet-zero
interface Serial0/0
 no ip address
 shutdown
 serial restart_delay 0
interface Serial0/1
 ip address 192.168.201.5 255.255.255.0
 serial restart_delay 0
 clockrate 64000
interface Serial0/2
 ip address 192.168.202.5 255.255.255.0
 serial restart_delay 0
 clockrate 64000
interface Serial0/3
 no ip address
 shutdown
 serial restart_delay 0
router eigrp 1
 network 192.168.201.0
 network 192.168.202.0
 auto-summary
ip classless
end