1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ネットワーク実機学習記録5.スタティックルートとデフォルトゲート

Posted at

概要

練習5.png
スタティックルートとデフォルトゲートを使用し、PCAからPCBへの通信が可能になったことを確認する。

補足:パケットは宛先IPアドレスを基にルーティングテーブルの情報から最適な経路を選択し転送されます。
これをルーティングといいます。
ルーティングテーブルに宛先までの経路情報がなければ、宛先までの通信は行えません。

設定操作ログ

RT1(config)#
RT1(config)#
RT1(config)#ip route 172.16.0.0 255.255.0.0 10.0.0.2
RT1(config)#
RT1(config)#
RT1(config)#do sh run
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
interface FastEthernet0
 ip address 192.168.0.254 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet1
 ip address 10.0.0.1 255.0.0.0
 duplex auto
 speed auto
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ip route 172.16.0.0 255.255.0.0 10.0.0.2
!
!
!
!
!
!
!
control-plane
!
!
!
line con 0
line aux 0
line vty 0 4
 login
 transport input all
!
end

RT1(config)#
RT1(config)#
--------------------------------------------------------------------------------------
RT2(config)#
RT2(config)#
RT2(config)#ip route 0.0.0.0 0.0.0.0 fa1
%Default route without gateway, if not a point-to-point interface, may impact 

performance
RT2(config)#
RT2(config)#
RT2(config)#do sh run
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
interface FastEthernet0
 ip address 172.16.0.254 255.255.0.0
 duplex auto
 speed auto
!
interface FastEthernet1
 ip address 10.0.0.2 255.0.0.0
 duplex auto
 speed auto
!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ip route 0.0.0.0 0.0.0.0 FastEthernet1
!
!
!
!
!
!
!
control-plane
!
!
!
line con 0
line aux 0
line vty 0 4
 login
 transport input all
!
end

RT2(config)#
RT2(config)#
RT2(config)#exi
RT2#
Jan  2 12:55:42.595: %SYS-5-CONFIG_I: Configured from console by console
RT2#
RT2#
RT2#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
       + - replicated route, % - next hop override

Gateway of last resort is 0.0.0.0 to network 0.0.0.0

S*    0.0.0.0/0 is directly connected, FastEthernet1
      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        10.0.0.0/8 is directly connected, FastEthernet1
L        10.0.0.2/32 is directly connected, FastEthernet1
      172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C        172.16.0.0/16 is directly connected, FastEthernet0
L        172.16.0.254/32 is directly connected, FastEthernet0
RT2#
RT2#
--------------------------------------------------------------------------------
RT1#
RT1#
RT1#show ip t 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
       + - replicated route, % - next hop override

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        10.0.0.0/8 is directly connected, FastEthernet1
L        10.0.0.1/32 is directly connected, FastEthernet1
S     172.16.0.0/16 [1/0] via 10.0.0.2
      192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.0.0/24 is directly connected, FastEthernet0
L        192.168.0.254/32 is directly connected, FastEthernet0
RT1#
RT1#
RT1#exi

スタティックルートの設定と確認

RT1(config)#ip route 172.16.0.0 255.255.0.0 10.0.0.2

ip routeコマンドで宛先のネットワークアドレス、宛先のサブネットマスク、宛先の手前のIPアドレス(ネクストホップアドレス)またはネクストホップルーターへ中継するための出力インターフェイスを入力することで、スタティックルートを設定します。

RT1#show ip t route
~~~~~~~~~~~~~~~~~~~~~~~~~~
S     172.16.0.0/16 [1/0] via 10.0.0.2

show ip routeコマンドでルーティングテーブルを確認すると、スタティックルートで設定した経路がルーティングテーブルに学習されたことが確認できます。

補足:スタティックルートは手動で具体的な経路情報をルーティングテーブルに学習させることができます。

デフォルトゲートの設定と確認

ip route 0.0.0.0 0.0.0.0 FastEthernet1

ip routeコマンドで宛先のネットワークアドレスとサブネットマスクに0(全てという意味)、宛先の手前のIPアドレス(ネクストホップアドレス)またはネクストホップルーターへ中継するための出力インターフェイスを入力することで、デフォルトゲートを設定します。

RT2#show ip route
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gateway of last resort is 0.0.0.0 to network 0.0.0.0

S*    0.0.0.0/0 is directly connected, FastEthernet1

show ip routeコマンドでルーティングテーブルを確認すると、fa1がデフォルトルートとして学習されたことが確認できます。

補足:デフォルトルートはルーティングテーブルにない宛先への経路として使用されます。

参考

ICND1:第8章

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?