シンプルなトポロジーで異なるネットワーク間通信を確立するためのコンフィグを設定してみたい。
内容はCCENT、CCNAレベルを想定してます。
GNS3の操作に慣れるというのも兼ねています。
今回のトポロジーはこちら
要件:PC-1 – PC-2間通信を確立する
●Pre-config
Router-1#show running-config
!
interface Ethernet0/0
no ip address
shutdown
!
interface Ethernet0/1
no ip address
shutdownRouter-2
Router-2#show running-config
!
interface Ethernet0/0
no ip address
shutdown
!
interface Ethernet0/1
no ip address
shutdown
PC-1
PC-1> show
NAME IP/MASK GATEWAY
PC-1 0.0.0.0/0 0.0.0.0
PC-2
PC-2> show
NAME IP/MASK GATEWAY
PC-2 0.0.0.0/0 0.0.0.0
●トポロジー図より各機器のインターフェイスのIPアドレスは以下の表になります。
interface | Ipaddress | |
Router-1 | e0/0 | 192.168.1.254 |
e0/1 | 192.168.3.1 | |
Router-2 | e0/0 | 192.168.2.254 |
e0/1 | 192.168.3.2 | |
PC-1 | e0 | 192.168.1.1 |
PC-2 | e0 | 192.168.2.1 |
設定
①PC-1
・interface e0にIPアドレスを設定する
Checking for duplicate address…
PC1 : 192.168.1.1 255.255.255.0 gateway 192.168.1.254
・設定したIPアドレスの確認をする
PC-1> show
NAME IP/MASK GATEWAY
PC-1 192.168.1.1/24 192.168.1.254
②PC-2
・interface e0にIPアドレスを設定する
Checking for duplicate address…
PC1 : 192.168.2.1 255.255.255.0 gateway 192.168.2.254
・設定したIPアドレスの確認をする
PC-2> show
NAME IP/MASK GATEWAY MAC LPORT RHOST:PORT
PC-2 192.168.2.1/24 192.168.2.254
③Router-1
・interface e0/0にIPアドレスを設定する
Router-1#conf t
Router-1(config)#int e0/0
Router-1(config-if)#ip address 192.168.1.254 255.255.255.0
Router-1(config-if)#no shutdown
Router-1(config-if)#exit
・interface e0/1にIPアドレスを設定する
Router-1#conf t
Router-1(config)#int e0/1
Router-1(config-if)#ip address 192.168.3.1 255.255.255.252
Router-1(config-if)#no shutdown
Router-1(config-if)#exit
・スタティックルートを設定する
Router-1#conf t
Router-1(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.2
・ルーティングテーブルを確認する
Router-1#show ip route
Codes: L – local, 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, H – NHRP, l – LISP
a – application route
+ – replicated route, % – next hop override
Gateway of last resort is not set
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, Ethernet0/0
L 192.168.1.254/32 is directly connected, Ethernet0/0
S 192.168.2.0/24 [1/0] via 192.168.3.2
192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.3.0/30 is directly connected, Ethernet0/1
L 192.168.3.1/32 is directly connected, Ethernet0/1
・interfaceを確認する
Router-1#show running-config
!
interface Ethernet0/0
ip address 192.168.1.254 255.255.255.0
!
interface Ethernet0/1
ip address 192.168.3.1 255.255.255.252
・設定を保存する
Router-1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration…
[OK]
Router-1#
④Router-2
・interface e0/0にIPアドレスを設定する
Router-2#conf t
Router-2(config)#int e0/0
Router-2(config-if)#ip address 192.168.2.254 255.255.255.0
Router-2(config-if)#no shutdown
Router-2(config-if)#
・interface e0/1にIPアドレスを設定する
Router-2#conf t
Router-2(config)#int e0/1
Router-2(config-if)#ip address 192.168.3.2 255.255.255.252
Router-2(config-if)#no
Router-2(config-if)#no shutdown
Router-2(config-if)#
・スタティックルートを設定する
Router-2#conf t
Router-2(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1
・ルーティングテーブルを確認する
Router-2#show ip route
Codes: L – local, 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, H – NHRP, l – LISP
a – application route
+ – replicated route, % – next hop override
Gateway of last resort is not set
S 192.168.1.0/24 [1/0] via 192.168.3.1
192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.2.0/24 is directly connected, Ethernet0/0
L 192.168.2.254/32 is directly connected, Ethernet0/0
192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.3.0/30 is directly connected, Ethernet0/1
L 192.168.3.2/32 is directly connected, Ethernet0/1
・interfaceを確認する
Router-2#show running-config
!
interface Ethernet0/0
ip address 192.168.2.254 255.255.255.0
!
interface Ethernet0/1
ip address 192.168.3.2 255.255.255.252
・設定を保存する
Router-2#copy running-config startup-config
Destination filename [startup-config]?
Building configuration…
[OK]
Router-2#
動作確認
設定が終わったのでPC-1のコンソール画面からPC-2に対してpingを飛ばしてみる。
まず、すべての機器の電源が入っているか確認する。
GNS3は結合線が緑なら起動しているので問題はなさそう。
それではpingを実行する。
PC-1> ping 192.168.2.1
192.168.2.1 icmp_seq=1 timeout
84 bytes from 192.168.2.1 icmp_seq=2 ttl=62 time=38.599 ms
84 bytes from 192.168.2.1 icmp_seq=3 ttl=62 time=38.079 ms
84 bytes from 192.168.2.1 icmp_seq=4 ttl=62 time=49.380 ms
84 bytes from 192.168.2.1 icmp_seq=5 ttl=62 time=40.522 ms
よし、通った。
次にPC-2からPC-1に対してpingを飛ばしてみる。
PC-2> ping 192.168.1.1
192.168.1.1 icmp_seq=1 timeout
192.168.1.1 icmp_seq=2 timeout
84 bytes from 192.168.1.1 icmp_seq=3 ttl=62 time=108.323 ms
84 bytes from 192.168.1.1 icmp_seq=4 ttl=62 time=125.317 ms
84 bytes from 192.168.1.1 icmp_seq=5 ttl=62 time=65.281 ms
こちらも問題なし。
どちらも最初の1,2回目で失敗となっているのは異なるネットワークのデバイスと通信するとき、ホスト側でルータのMACアドレス情報が必要になるためまずルータに対してARPを実行しているからです。MACアドレス情報が得られてARPテーブルができるとルータに対してパケットを送出しますがARP処理の間にpingがタイムアウトしてしまうということです。
詳しくは「ARPの仕組みと重要性について考えてみる」を参照してください。
以上です。
コメントを書く