ネットワーク実機学習記録1.ルーター基礎ホストネームとipアドレスの設定

##概要

![練習1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/529636/71c7e756-2eef-b2b3-098d-ddbe0aae08a1.png)
ルーターにホストネームとipアドレスを設定し、ホストAとルーター1間の通信が可能となったことを確認する。


##設定操作ログ

```
program load complete, entry point: 0x80012000, size: 0x1d2a974
Self decompressing the image : ########################################################################################################################################################################################################################################################################################## [OK]

              Restricted Rights Legend

Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.

           cisco Systems, Inc.
           170 West Tasman Drive
           San Jose, California 95134-1706



Cisco IOS Software, C181X Software (C181X-ADVENTERPRISEK9-M), Version 15.1(4)M9, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2014 by Cisco Systems, Inc.
Compiled Fri 12-Sep-14 10:09 by prod_rel_team


This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

Installed image archive
Cisco 1812-J (MPC8500) processor (revision 0x400) with 354304K/38912K bytes of memory.
Processor board ID FHK111413WD, with hardware revision 0000

10 FastEthernet interfaces
1 ISDN Basic Rate interface
1 Virtual Private Network (VPN) Module
31360K bytes of ATA CompactFlash (Read/Write)


         --- System Configuration Dialog ---
Would you like to enter the initial configuration dialog? [yes/no]: no


Press RETURN to get started!


各インターフェイスのステータス＜省略＞
Router>
Router>
Router>enable 
Router#
Router#
Router#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#
Router(config)#
Router(config)#hostname RT1
RT1(config)#
RT1(config)#
RT1(config)#interface fastEthernet 0
RT1(config-if)#
RT1(config-if)#ip address 192.168.0.254 255.255.255.0
RT1(config-if)#  
RT1(config-if)#no shutdown 
RT1(config-if)#
*Nov 11 07:53:03.647: %LINK-3-UPDOWN: Interface FastEthernet0, changed state to 

down
*Nov 11 07:53:06.363: %LINK-3-UPDOWN: Interface FastEthernet0, changed state to 

up
*Nov 11 07:53:07.363: %LINEPROTO-5-UPDOWN: Line protocol on Interface 

FastEthernet0, changed state to up
RT1(config-if)#
RT1(config-if)#end
RT1#
*Nov 11 07:53:32.199: %SYS-5-CONFIG_I: Configured from console by console
RT1#
RT1#show running-config 
Building configuration...

Current configuration : 1239 bytes
!
! Last configuration change at 07:53:32 UTC Mon Nov 11 2019
version 15.1
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname RT1
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
!
crypto pki token default removal timeout 0
!
!
dot11 syslog
ip source-route
 --More--         !
!
!
!
!
ip cef
no ipv6 cef
!
multilink bundle-name authenticated
!
!
!
license udi pid CISCO1812-J/K9 sn FHK111413WD
!
!
! 
!
!
!
!
!
!
interface BRI0
 --More--          no ip address
 encapsulation hdlc
 shutdown
!
interface FastEthernet0
 ip address 192.168.0.254 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet1
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface FastEthernet2
 no ip address
!
interface FastEthernet3
 no ip address
!
interface FastEthernet4
 no ip address
 --More--         !
interface FastEthernet5
 no ip address
!
interface FastEthernet6
 no ip address
!
interface FastEthernet7
 no ip address
!
interface FastEthernet8
 no ip address
!
interface FastEthernet9
 no ip address
!
interface Vlan1
 no ip address
!
ip forward-protocol nd
no ip http server
no ip http secure-server
!
 --More--         !
!
!
!
!
!
!
!
control-plane
!
!
!
line con 0
line aux 0
line vty 0 4
 login
 transport input all
!
end

RT1#
RT1#
RT1#ping 192.168.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
RT1#
RT1#
RT1#exit

































Router con0 is now available





Press RETURN to get started.













RT1>
RT1>
RT1>en
RT1#
RT1#
RT1#disable 
RT1>
RT1>
RT1>exit
```


##起動からホストネームの設定まで

```
Would you like to enter the initial configuration dialog? [yes/no]: no
```
初期起動時にはダイアログ形式での初期設定行うかを問われます。
noを入力することで、コマンドを入力するCLI(Command Line Interface)が選択されます。
各インターフェイスのステータスが表示された後エンターを押すと、ユーザーモードにて入力が開始可能となります。

```
Router>enable 
Router#configure terminal 
Router(config)#hostname RT1
```
ユーザーモードからenableコマンドで特権モード、
特権モードからconfigure terminalでグローバルコンフィギュレーションモードへ入り、
hostnameでホスト名RouterをRT1に変更します。


##ipアドレスの設定

```
RT1(config)#interface fastEthernet 0
RT1(config-if)#ip address 192.168.0.254 255.255.255.0
RT1(config-if)#no shutdown 
```

interface fastEthernet 0コマンドでFa0のインターフェイスコンフィギュレーションモードに入り、
ip addressコマンドでipアドレスとサブネットマスクを設定し、
no shutdownコマンドでインターフェイスの有効化を行います。

補足：ルーターのインターフェイスはデフォルトで全て無効化（shutdown）に設定されており、使用するインターフェイスには有効化（no shutdown）を実行する必要があります。


##設定の確認と通信の確認

```
RT1#show running-config 
～～～～～～～～～～～～～～～～～～～～～～～～
interface FastEthernet0
 ip address 192.168.0.254 255.255.255.0
 duplex auto
 speed auto
～～～～～～～～～～～～～～～～～～～～～～～～
RT1#ping 192.168.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
```
show running-configコマンドでFa0にipアドレスが設定されたことを確認、
pingコマンドでホストAへの通信が可能となったことを確認します。


##参考
ICND1：第5章、第7章