前提
CCNAの学習のため、毎日書籍やUdemyなどで学習している。しかしエンジニアはやはり手を動かさないとダメだと思い、GNS3を使い始めた。職場のIOSを使って、とりあえず簡単なものから少しずつやっていく。
下記の構成が今回取り組んでいくNW構成。これまでルータ一台構成、二台構成とかなりシンプルであった。ここから多少複雑になってくる。
これまでやったこと
GNS3でシンプルなNW構成を作ってみた。
GNS3でシンプルなNW構成を作ってみた。②
今回の構成
ルータ4台構成で、赤と水色それぞれのルートを通ってpingで疎通確認を行う。
これもスタティックで設定していく。
今回から、PCとルータへのIPアドレスはすでに済んだところからスタート。
各ルータの現在のインターフェース
R1#sh ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.1.1 YES manual up up
FastEthernet0/1 192.168.2.1 YES manual up up
FastEthernet1/0 192.168.4.1 YES manual up up
R2#sh ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.3.1 YES manual up up
FastEthernet0/1 192.168.2.2 YES manual up up
FastEthernet1/0 192.168.5.1 YES manual up up
R3#sh ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.6.1 YES manual up up
FastEthernet0/1 192.168.7.1 YES manual up up
FastEthernet1/0 192.168.4.2 YES manual up up
R4#sh ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.8.1 YES manual up up
FastEthernet0/1 192.168.7.2 YES manual up up
FastEthernet1/0 192.168.5.2 YES manual up up
各ルータの現在のルーティングテーブル(不要な部分は省略)
R1#sh ip route
Gateway of last resort is not set
C 192.168.4.0/24 is directly connected, FastEthernet1/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
R2#sh ip route
Gateway of last resort is not set
C 192.168.5.0/24 is directly connected, FastEthernet1/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
R3#sh ip route
Gateway of last resort is not set
C 192.168.4.0/24 is directly connected, FastEthernet1/0
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.7.0/24 is directly connected, FastEthernet0/1
R4#sh ip route
Gateway of last resort is not set
C 192.168.8.0/24 is directly connected, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet1/0
C 192.168.7.0/24 is directly connected, FastEthernet0/1
設定すべきことは、これまで通り「ルータが知らないネットワークまでデータを届けるには、どこに転送すればいいのか」ということを一つずつスタティックで設定していく。
まずはRT4に対して、192.168.6.0に転送したいなら、どのインターフェースに送るかを設定する。図の黄色部分の方へ転送させる。
R4(config)#ip route 192.168.6.0 255.255.255.0 192.168.5.1
R4#sh ip route
Gateway of last resort is not set
C 192.168.8.0/24 is directly connected, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet1/0
S 192.168.6.0/24 [1/0] via 192.168.5.1
C 192.168.7.0/24 is directly connected, FastEthernet0/1
R4#
同じことをRT2→RT1と設定していく。RT3は宛先のネットワークと直接接続のため不要。
R2(config)#ip route 192.168.6.0 255.255.255.0 192.168.2.1
R2#sh ip route
Gateway of last resort is not set
C 192.168.5.0/24 is directly connected, FastEthernet1/0
S 192.168.6.0/24 [1/0] via 192.168.2.1
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
R1(config)#ip route 192.168.6.0 255.255.255.0 192.168.4.2
R1#sh ip route
Gateway of last resort is not set
C 192.168.4.0/24 is directly connected, FastEthernet1/0
S 192.168.6.0/24 [1/0] via 192.168.4.2
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
ここまでの設定でpingを送りつけることは可能。ただし、通信は双方向のため、これだけでは不十分。通信が返ってこれない。したがって、今度は戻りのルートもスタティックで設定してあげる必要がある。RT3→RT1→RT2の順に,
今度は宛先を192.168.8.0のネットワークで設定していく。
R3(config)#ip route 192.168.8.0 255.255.255.0 192.168.4.1
R3#sh ip route
Gateway of last resort is not set
S 192.168.8.0/24 [1/0] via 192.168.4.1
C 192.168.4.0/24 is directly connected, FastEthernet1/0
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.7.0/24 is directly connected, FastEthernet0/1
R1(config)#ip route 192.168.8.0 255.255.255.0 192.168.2.2
R1#sh ip route
Gateway of last resort is not set
S 192.168.8.0/24 [1/0] via 192.168.2.2
C 192.168.4.0/24 is directly connected, FastEthernet1/0
S 192.168.6.0/24 [1/0] via 192.168.4.2
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
R2(config)#ip route 192.168.8.0 255.255.255.0 192.168.5.2
R2#sh ip route
Gateway of last resort is not set
S 192.168.8.0/24 [1/0] via 192.168.5.2
C 192.168.5.0/24 is directly connected, FastEthernet1/0
S 192.168.6.0/24 [1/0] via 192.168.2.1
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
これで行き帰りのルータのルーティングテーブルに192.168.6.0と192.168.8.0のネットワークを登録できた。これでまずPC4からPC3へping疎通確認してみるとちゃんと通る。
PC4> ping 192.168.6.100
84 bytes from 192.168.6.100 icmp_seq=1 ttl=60 time=125.067 ms
84 bytes from 192.168.6.100 icmp_seq=2 ttl=60 time=110.068 ms
84 bytes from 192.168.6.100 icmp_seq=3 ttl=60 time=80.745 ms
84 bytes from 192.168.6.100 icmp_seq=4 ttl=60 time=112.630 ms
84 bytes from 192.168.6.100 icmp_seq=5 ttl=60 time=124.874 ms
PC3からPC4へのPingも当然通る。
PC3> ping 192.168.8.100
84 bytes from 192.168.8.100 icmp_seq=1 ttl=60 time=110.183 ms
84 bytes from 192.168.8.100 icmp_seq=2 ttl=60 time=111.311 ms
84 bytes from 192.168.8.100 icmp_seq=3 ttl=60 time=125.743 ms
84 bytes from 192.168.8.100 icmp_seq=4 ttl=60 time=99.810 ms
84 bytes from 192.168.8.100 icmp_seq=5 ttl=60 time=109.807 ms
今度は水色の矢印部分のルーティングをスタティックで設定して、PC1からPC2へpingを飛ばせるようにする。
各ルータに行きと戻りのためのネットワークを下記のようにルーティングテーブルに登録。
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.4.2
R1#sh ip route
Gateway of last resort is not set
S 192.168.8.0/24 [1/0] via 192.168.2.2
C 192.168.4.0/24 is directly connected, FastEthernet1/0
S 192.168.6.0/24 [1/0] via 192.168.4.2
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
S 192.168.3.0/24 [1/0] via 192.168.4.2
R3(config)#ip route 192.168.1.0 255.255.255.0 192.168.4.1
R3#sh ip route
Gateway of last resort is not set
S 192.168.8.0/24 [1/0] via 192.168.4.1
C 192.168.4.0/24 is directly connected, FastEthernet1/0
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.7.0/24 is directly connected, FastEthernet0/1
S 192.168.1.0/24 [1/0] via 192.168.4.1
S 192.168.3.0/24 [1/0] via 192.168.7.2
R4(config)#ip route 192.168.1.0 255.255.255.0 192.168.7.1
R4#sh ip route
Gateway of last resort is not set
C 192.168.8.0/24 is directly connected, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet1/0
S 192.168.6.0/24 [1/0] via 192.168.5.1
C 192.168.7.0/24 is directly connected, FastEthernet0/1
S 192.168.1.0/24 [1/0] via 192.168.7.1
S 192.168.3.0/24 [1/0] via 192.168.5.1
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.5.2
R2#sh ip route
Gateway of last resort is not set
S 192.168.8.0/24 [1/0] via 192.168.5.2
C 192.168.5.0/24 is directly connected, FastEthernet1/0
S 192.168.6.0/24 [1/0] via 192.168.2.1
S 192.168.1.0/24 [1/0] via 192.168.5.2
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
ここまでやってやっとルータ4台構成で、遠回りのルートを確立できた。
ちゃんとpingでの疎通確認もできた。
PC1> ping 192.168.3.100
84 bytes from 192.168.3.100 icmp_seq=1 ttl=60 time=70.675 ms
84 bytes from 192.168.3.100 icmp_seq=2 ttl=60 time=125.760 ms
84 bytes from 192.168.3.100 icmp_seq=3 ttl=60 time=87.914 ms
84 bytes from 192.168.3.100 icmp_seq=4 ttl=60 time=109.838 ms
84 bytes from 192.168.3.100 icmp_seq=5 ttl=60 time=125.086 ms
PC2> ping 192.168.1.100
84 bytes from 192.168.1.100 icmp_seq=1 ttl=60 time=109.872 ms
84 bytes from 192.168.1.100 icmp_seq=2 ttl=60 time=125.696 ms
84 bytes from 192.168.1.100 icmp_seq=3 ttl=60 time=125.780 ms
84 bytes from 192.168.1.100 icmp_seq=4 ttl=60 time=110.425 ms
84 bytes from 192.168.1.100 icmp_seq=5 ttl=60 time=125.421 ms
つまったところ
pingを飛ばすPCから近いルータからスタティックルートを設定していった。そして、できているかの検証のpingも近くから遠くのルータへと順番に飛ばしていたのだが、途中のルータへのpingがタイムアウトになってしまっていた。ルーティングテーブルをみてもちゃんと宛先(ネクストホップ)はしっかり設定しており、pingは飛んでいるはずなのに。。。なぜ??と頭を抱えていたが、なんてことはない話だった。
結論から言えば、ただの勘違いでpingはちゃんと最終の宛先ネットワークまで飛んでいました。自分の勘違いは「宛先ネットワークを、ルーティングテーブルに登録したら、経由するルータへのpingもちゃんと通る」と思っていたところ。各ルータはただ単に「宛先のネットワークに行くためにはこっちのルータへ!」という情報しか持っていない。そのため、今の構成はでは戻ってこれないのだった。手を動かしてみたことで、また少しは理解が深まった。
一言
次はこれに少し手を加えてみる。そしたらスタティックルーティングはおしまい。早くダイナミックルーティングにレベルアップしたい。