0
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?

ccna取得に向けてCiscoPacketTracerで構築練習 ~VLAN~

Posted at

はじめに

CCNAを受験するにあたって、実際にコマンドを打って構築をすることが大切らしい。
Cisco Packet Tracerを使用して構築の練習とその流れ、結果を示して、気づいたことなどをまとめていこうと思う。

目標

  • catalyst上にVLANを作成
  • VTPで複数の複数のswitchを使ったVLANネットワークを構築
  • ルータを使用したVLAN間ルーティングを実装
  • L3スイッチを使用したVLANネットワークを構築

実践

1.catalystでVLANを作る

catalyst一台のシンプルな構成を作る。
VLAN-1-1.png

Switch0
Switch0(config)#vlan 2
Switch0(config-vlan)#exit
Switch0(config)#vlan 3
Switch0(config-vlan)#exit

Switch0(config)#interface range fa 0/1-2
Switch0(config-if-range)#switchport mode access 
Switch0(config-if-range)#switchport access vlan 2
Switch0(config-if-range)#exit
Switch0(config)#interface range fa 0/3-4
Switch0(config-if-range)#switchport mode access 
Switch0(config-if-range)#switchport access vlan 3
Switch0(config-if-range)#exit
Switch0(config)#end

Switch0#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/12
                                                Fa0/13, Fa0/14, Fa0/15, Fa0/16
                                                Fa0/17, Fa0/18, Fa0/19, Fa0/20
                                                Fa0/21, Fa0/22, Fa0/23, Fa0/24
                                                Gig0/1, Gig0/2
2    VLAN0002                         active    Fa0/1, Fa0/2
3    VLAN0003                         active    Fa0/3, Fa0/4
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active 
  • 疎通確認をする
    PC0からPC1にPingを打つ

Cisco Packet Tracer - E__Cisco Packet Tracer 8.2.2_saves_vlanSwitching-qiita.pkt 2024-05-20 21-28-00.gif

2. VTPの設定をしてもう一台switchをつなぐ

VLAN-2-1.png

Switch0
//VTP設定
Switch0(config)#vtp domain ccna
Changing VTP domain name from NULL to ccna
Switch0(config)#vtp mode ser
Switch0(config)#vtp mode server 
Device mode already VTP SERVER.
Switch0(config)#

//VLAN4作成
Switch0(config)#vlan 4
Switch0(config-vlan)#end

//VTP確認
Switch0#show vtp status 
VTP Version capable             : 1 to 2
VTP version running             : 1
VTP Domain Name                 : ccna
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : 0006.2ABB.C300
Configuration last modified by 0.0.0.0 at 3-1-93 02:11:27
Local updater ID is 0.0.0.0 (no valid interface found)

Feature VLAN : 
--------------
VTP Operating Mode                : Server
Maximum VLANs supported locally   : 255
Number of existing VLANs          : 8
Configuration Revision            : 1 //revisonが1になっている
MD5 digest                        : 0xD8 0xAC 0xCC 0x58 0xDE 0x74 0xE9 0x64 
                                    0xA6 0x88 0xAF 0x71 0x58 0xDE 0x59 0x70

//トランクポート作成
Switch0#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch0(config)#interface fa 0/24
Switch0(config-if)#switchport mode trunk 
Switch1
//VTP設定
Switch1(config)#vtp domain ccna
Changing VTP domain name from NULL to ccna
Switch1(config)#vtp mode client 
Setting device to VTP CLIENT mode.
Switch1(config)#end

Switch1#show vtp status 
VTP Version capable             : 1 to 2
VTP version running             : 1
VTP Domain Name                 : ccna
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : 0001.9738.0100
Configuration last modified by 0.0.0.0 at 3-1-93 02:11:27

Feature VLAN : 
--------------
VTP Operating Mode                : Client
Maximum VLANs supported locally   : 255
Number of existing VLANs          : 8
Configuration Revision            : 1 //revisonが同期している
MD5 digest                        : 0xD8 0xAC 0xCC 0x58 0xDE 0x74 0xE9 0x64 
                                    0xA6 0x88 0xAF 0x71 0x58 0xDE 0x59 0x70 

//インターフェースの設定
Switch1#conf t
Switch1(config)#interface fa 0/1
Switch1(config-if)#switchport mode access 
Switch1(config-if)#switchport access vlan 2
Switch1(config-if)#exit 
Switch1(config)#interface fa 0/2
Switch1(config-if)#switchport mode access 
Switch1(config-if)#switchport access vlan 3
Switch1(config-if)#exit 
Switch1(config)#interface fa 0/3
Switch1(config-if)#switchport mode access 
Switch1(config-if)#switchport access vlan 4
Switch1(config-if)#exit 
  • 疎通確認をする
    PC2からPC5にPingを打つ

Cisco Packet Tracer - E__Cisco Packet Tracer 8.2.2_saves_vlanSwitching-qiita.pkt 2024-05-20 21-53-30.gif

3. ルータを使ったVLAN間ルーティング

Switch0にルータを繋いでVLAN間ルーティングができるようにする。
VLAN-3-1.png

Router0
//sub interfaceの作成
Router0(config)#interface gi 0/1.2
Router0(config-subif)#encapsulation dot1Q 2
Router0(config-subif)#ip address 192.168.2.254 255.255.255.0
Router0(config-subif)#exit
Router0(config)#interface gi 0/1.3
Router0(config-subif)#encapsulation dot1Q 3
Router0(config-subif)#ip address 192.168.3.254 255.255.255.0
Router0(config-subif)#exit
Router0(config)#interface gi 0/1.4
Router0(config-subif)#encapsulation dot1Q 4
Router0(config-subif)#ip address 192.168.4.254 255.255.255.0
Router0(config-subif)#exit
Router0(config)#interface gi 0/1
Router0(config-if)#no shutdown
Router0(config)#end

Router0#show ip interface brief 
Interface              IP-Address      OK? Method Status                Protocol 
GigabitEthernet0/0     unassigned      YES unset  administratively down down 
GigabitEthernet0/1     unassigned      YES unset  up                    up 
GigabitEthernet0/1.2   192.168.2.254   YES manual up                    up 
GigabitEthernet0/1.3   192.168.3.254   YES manual up                    up 
GigabitEthernet0/1.4   192.168.4.254   YES manual up                    up 
GigabitEthernet0/2     unassigned      YES unset  administratively down down 
Vlan1                  unassigned      YES unset  administratively down down
Switch0
//トランクポートの設定
Switch0(config)#interface gi 0/1
Switch0(config-if)#switchport mode trunk
Switch0(config-if)#switchport trunk encapsulation dot1Q
Switch0(config-if)#end

Switch0#show interfaces trunk
Port        Mode         Encapsulation  Status        Native vlan
Fa0/24      on           802.1q         trunking      1
Gig0/1      on           802.1q         trunking      1

Port        Vlans allowed on trunk
Fa0/24      1-1005
Gig0/1      1-1005

Port        Vlans allowed and active in management domain
Fa0/24      1,2,3,4
Gig0/1      1,2,3,4

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/24      1,2,3,4
Gig0/1      1,2,3,4
  • 疎通確認をする
    PC2からPC3にPingを打つ
    Cisco Packet Tracer - E__Cisco Packet Tracer 8.2.2_saves_vlanSwitching-qiita.pkt 2024-05-20 22-28-07.gif
    PC2からPC6にPingを打つ
    Cisco Packet Tracer - E__Cisco Packet Tracer 8.2.2_saves_vlanSwitching-qiita.pkt 2024-05-20 22-29-54.gif

4. L3スイッチを使ったVLAN間ルーティング

VLAN-4-1.png

L3Switch0
//VLAN作成
L3Switch0(config)#interface vlan 2
L3Switch0(config-if)#ip address 192.168.2.254 255.255.255.0
L3Switch0(config-if)#no shutdown 
L3Switch0(config-if)#exit
L3Switch0(config)#interface vlan 3
L3Switch0(config-if)#ip address 192.168.3.254 255.255.255.0
L3Switch0(config-if)#no shutdown 
L3Switch0(config-if)#exit
L3Switch0(config)#interface vlan 4
L3Switch0(config-if)#ip address 192.168.4.254 255.255.255.0
L3Switch0(config-if)#no shutdown 
L3Switch0(config-if)#exit
L3Switch0(config)#ip routing

//インターフェース設定
L3Switch0(config)#interface fa 0/1
L3Switch0(config-if)#switchport trunk encapsulation dot1q 
L3Switch0(config-if)#switchport trunk allowed vlan 2-4
L3Switch0(config-if)#switchport mode trunk
L3Switch0(config-if)#exit
L3Switch0(config)#interface fa 0/2
L3Switch0(config-if)#switchport trunk encapsulation dot1q 
L3Switch0(config-if)#switchport trunk allowed vlan 2-4
L3Switch0(config-if)#switchport mode trunk 
L3Switch0(config-if)#exit
L3Switch0(config)#
L3Switch0(config)#interface fa 0/10
L3Switch0(config-if)#switchport access vlan 4
L3Switch0(config-if)#switchport mode access 
L3Switch0(config-if)#exit
  • 疎通確認をする
    PC4からPC7へPing
    Cisco Packet Tracer - E__Cisco Packet Tracer 8.2.2_saves_vlanSwitching-L3-qiita.pkt 2024-05-20 23-11-57.gif

PC5からPC0へPing
Cisco Packet Tracer - E__Cisco Packet Tracer 8.2.2_saves_vlanSwitching-L3-qiita.pkt 2024-05-20 23-13-35.gif

PC0からPC1へPing
Cisco Packet Tracer - E__Cisco Packet Tracer 8.2.2_saves_vlanSwitching-L3-qiita.pkt 2024-05-20 23-15-11.gif

気になったこと,覚えておきたいこと

  • L2スイッチ、ルータ、L3スイッチのコマンドと設定の仕方の違いを覚える

    • VLAN
    L2: (config)#vlan <vlan No.>
    L3: (config)#interface vlan <vlan No.>
    Router: (config-subif)# encapsuration dot1Q <vlan No.>
    
    • VLANをインターフェースに割り当てる
      L2,L3: interfaceにaccess,trunkポートの設定とvlanを割り当てる。
      Router: サブインターフェースに割り当てる
  • L3デバイス(router,L3switch)はno shutdownip addressを忘れない

  • ネットワークを超えない通信はswitchで処理される(基本的すぎるけど改めて確かめて理解した)。

0
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
0
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?