part1に引き続き入門編。2つのノード間で通信を行います。
今回も#1で構築した仮想検証環境でとりあえず遊んでみます。
参考:インフラ実験室#1 検証環境を整える - フルスタックエンジニアを目指して
前回は2つのホスト間にルータを1つ設置してセグメントを2つに分割しました。
参考:インフラ実験室#3 2つのホスト間通信を行うpart1 - フルスタックエンジニアを目指して
今回は、ルータを2つ使ってセグメントを3つに増やします。
3セグメント間の通信
環境は以下のような感じです。
PC1からPC2へpingが通れば成功です。
前回はセグメントが2つでしたので、R1はPC1、PC2どちらのセグメント情報もconnectedで知っていました。
しかし、今回はRT1は192.168.10.0/24と192.168.100.0/24をconnectedで知っていますが、PC2のある192.168.20.0/24のセグメントは知りません。
同様に、RT2は192.168.20.0/24と192.168.100.0/24をconnectedで知っていますが、PC1のある192.168.10.0/24のセグメントは知りません。
このままでは、PCからpingを打ったとしても、宛先ホストのセグメントをRTが知らないため、通信することができません。
そこで、今回は書くルータでスタティックルートを設定してあげる必要があります。
R1の設定ログ
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int eth0/0
R1(config-if)#ip address 192.168.100.253 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#end
R1#
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int eth0/1
R1(config-if)#ip address 192.168.10.100 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#end
R1#
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip route 192.168.20.0 255.255.255.0 192.168.100.254
R1(config)#end
R1#
R1#
*Mar 1 00:03:19.363: %SYS-5-CONFIG_I: Configured from console by console
*Mar 1 00:03:19.563: %SYS-5-CONFIG_I: Configured from console by console
*Mar 1 00:03:19.835: %SYS-5-CONFIG_I: Configured from console by console
R1#
*Mar 1 00:03:21.111: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 1 00:03:21.455: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up
*Mar 1 00:03:22.111: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
R1#
*Mar 1 00:03:22.455: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up
R1#
R1#
R1#
R1#show ip int bri
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.100.253 YES manual up up
Ethernet0/1 192.168.10.100 YES manual up up
Ethernet0/2 unassigned YES unset administratively down down
Ethernet0/3 unassigned YES unset administratively down down
R1#
R1#
R1#
R1#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
C 192.168.10.0/24 is directly connected, Ethernet0/1
S 192.168.20.0/24 [1/0] via 192.168.100.254
C 192.168.100.0/24 is directly connected, Ethernet0/0
R1#
R2の設定ログ
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int eth0/0
R2(config-if)#ip address 192.168.100.254 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#end
R2#
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int eth0/1
R2(config-if)#ip address 192.168.20.100 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#end
R2#
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip route 192.168.10.0 255.255.255.0 192.168.100.253
R2(config)#end
R2#
R2#
*Mar 1 00:02:31.339: %SYS-5-CONFIG_I: Configured from console by console
*Mar 1 00:02:31.539: %SYS-5-CONFIG_I: Configured from console by console
*Mar 1 00:02:31.815: %SYS-5-CONFIG_I: Configured from console by console
R2#
*Mar 1 00:02:33.083: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 1 00:02:33.431: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up
*Mar 1 00:02:34.083: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
R2#
*Mar 1 00:02:34.431: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up
R2#
R2#
R2#
R2#show ip int bri
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.100.254 YES manual up up
Ethernet0/1 192.168.20.100 YES manual up up
Ethernet0/2 unassigned YES unset administratively down down
Ethernet0/3 unassigned YES unset administratively down down
R2#
R2#
R2#
R2#
R2#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
S 192.168.10.0/24 [1/0] via 192.168.100.253
C 192.168.20.0/24 is directly connected, Ethernet0/1
C 192.168.100.0/24 is directly connected, Ethernet0/0
R2#
PC1の設定ログ
PC1> ip 192.168.10.10/24 192.168.10.100
Checking for duplicate address...
PC1 : 192.168.10.10 255.255.255.0 gateway 192.168.10.100
PC1>
PC1>
PC1> save
Saving startup configuration to startup.vpc
. done
PC2の設定ログ
PC2> ip 192.168.20.10/24 192.168.20.100
Checking for duplicate address...
PC1 : 192.168.20.10 255.255.255.0 gateway 192.168.20.100
PC2>
PC2>
PC2> save
Saving startup configuration to startup.vpc
. done
疎通確認
PC1からPC2へpingを打ちます。
成功です。traceもR1>R2>PC2と経由していることがわかります。
PC2からPC1へpingを打ちます。
成功です。traceもR2>R1>PC1と経由していることがわかります。
※traceが宛先ホストに到達できていませんが、これはVPCSのtraceがUDPであるためでした。「-P」オプションでTCPに変更してあげるとちゃんと到達します。
参考:インフラ実験室#3 2つのホスト間通信を行うpart1 - フルスタックエンジニアを目指して
本当はキャプチャをとってパケットを見たかったのですがなぜかWiresharkがGNS3から起動できないので今回はここまで。
このシリーズ、今回のようなものすごく初歩的なところからいろいろやっていきたいと思ってます。