現在位置: ホーム / みらくるブログ / GNS3 活用 - Cisco スイッチ VLAN 編 その2 (トランク接続)

GNS3 活用 - Cisco スイッチ VLAN 編 その2 (トランク接続)

トランク接続でVLAN同士の通信を可能にしてみます。

お疲れさまです。ニックネーム たいちょう です。

2017年1月から、GNS3 活用 - Cisco スイッチ VLAN 編を連載しています。

 

今回は、GNS3 活用 - Cisco スイッチ VLAN 編 その2 (トランク接続)として、以下のようなタスクを実行してみます。

タスク

  • 2つのスイッチを配置する。それぞれに VLAN100,200 の端末を収容する。
  • 同じ VLAN 同士で接続を確立する。IP アドレスは任意とする。

作業記録です。

Sw1#vlan database
Sw1(vlan)#vlan 100   
VLAN 100 added:
    Name: VLAN0100
Sw1(vlan)#vlan 200
VLAN 200 added:
    Name: VLAN0200
Sw1(vlan)#apply
APPLY completed.
Sw1(vlan)#exit
APPLY completed.
Exiting....
Sw1#

Sw2#vlan database
Sw2(vlan)#vlan 100
VLAN 100 added:
    Name: VLAN0100
Sw2(vlan)#vlan 200
VLAN 200 added:
    Name: VLAN0200
Sw2(vlan)#apply
APPLY completed.
Sw2(vlan)#exit
APPLY completed.
Exiting....
Sw2#

Sw1(config)#int range fa1/1 -2
Sw1(config-if-range)#switchport mode access
Sw1(config-if-range)#exit
Sw1(config)#int fa1/1
Sw1(config-if)#switchport access vlan 100
Sw1(config-if)#int fa1/2
Sw1(config-if)#switchport access vlan 200
Sw1(config-if)#end

Sw2(config)#int range fa1/1 - 2
Sw2(config-if-range)#switchport mode access
Sw2(config-if-range)#exit
Sw2(config)#int fa1/1  
Sw2(config-if)#switchport access vlan 100
Sw2(config-if)#int fa1/2
Sw2(config-if)#switchport access vlan 200
Sw2(config-if)#end

Sw1#sho vlan-switch

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/0, Fa1/3, Fa1/4, Fa1/5
                                                Fa1/6, Fa1/7, Fa1/8, Fa1/9
                                                Fa1/10, Fa1/11, Fa1/12, Fa1/13
                                                Fa1/14, Fa1/15
100  VLAN0100                         active    Fa1/1
200  VLAN0200                         active    Fa1/2
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        1002   1003
100  enet  100100     1500  -      -      -        -    -        0      0   
200  enet  100200     1500  -      -      -        -    -        0      0   
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0   
1005 trnet 101005     1500  -      -      1        ibm  -        0      0   

Sw2#sho vlan-swi

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/0, Fa1/3, Fa1/4, Fa1/5
                                                Fa1/6, Fa1/7, Fa1/8, Fa1/9
                                                Fa1/10, Fa1/11, Fa1/12, Fa1/13
                                                Fa1/14, Fa1/15
100  VLAN0100                         active    Fa1/1
200  VLAN0200                         active    Fa1/2
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        1002   1003
100  enet  100100     1500  -      -      -        -    -        0      0   
200  enet  100200     1500  -      -      -        -    -        0      0   
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0   
1005 trnet 101005     1500  -      -      1        ibm  -        0      0   

Sw1(config)#int fa1/15
Sw1(config-if)#switchport trunk enc dot
Sw1(config-if)#switchport mode trunk
Sw1(config-if)#switchport trunk allowed vlan 1-2,1002-1005,100,200
Sw1(config-if)#end
Sw1#

Sw2(config)#int fa1/15
Sw2(config-if)#switchport trunk enc dot
Sw2(config-if)#switchport mode trunk
Sw2(config-if)#switchport trunk allowed vlan 1-2,1002-1005,100,200
Sw2(config-if)#end
Sw2#

Sw1#sho ip int bri | begin FastEthernet1/1
FastEthernet1/1            unassigned      YES unset  up                    up      
FastEthernet1/2            unassigned      YES unset  up                    up  

Sw1#sho int trun

Port      Mode         Encapsulation  Status        Native vlan
Fa1/15    on           802.1q         trunking      1

Port      Vlans allowed on trunk
Fa1/15    1-2,100,200,1002-1005

Port      Vlans allowed and active in management domain
Fa1/15    1,100,200

Port      Vlans in spanning tree forwarding state and not pruned
Fa1/15    1,100,200

Sw2#sho ip int bri | begin FastEthernet1/1
FastEthernet1/1            unassigned      YES unset  up                    up      
FastEthernet1/2            unassigned      YES unset  up                    up      

Sw2#sho int trunk

Port      Mode         Encapsulation  Status        Native vlan
Fa1/15    on           802.1q         trunking      1

Port      Vlans allowed on trunk
Fa1/15    1-2,100,200,1002-1005

Port      Vlans allowed and active in management domain
Fa1/15    1,100,200

Port      Vlans in spanning tree forwarding state and not pruned
Fa1/15    1,100,200

PC1> ip 192.168.100.1/24
Checking for duplicate address...
PC1 : 192.168.100.1 255.255.255.0

PC1> show ip

NAME        : PC1[1]
IP/MASK     : 192.168.100.1/24
GATEWAY     : 0.0.0.0
DNS         :
MAC         : 00:50:79:66:68:00
LPORT       : 10002
RHOST:PORT  : 127.0.0.1:10003
MTU:        : 1500

PC2> ip 192.168.200.1/24
Checking for duplicate address...
PC1 : 192.168.200.1 255.255.255.0

PC2> show ip

NAME        : PC2[1]
IP/MASK     : 192.168.200.1/24
GATEWAY     : 0.0.0.0
DNS         :
MAC         : 00:50:79:66:68:01
LPORT       : 10005
RHOST:PORT  : 127.0.0.1:10004
MTU:        : 1500

PC3> ip 192.168.100.2/24
Checking for duplicate address...
PC1 : 192.168.100.2 255.255.255.0

PC3> show ip

NAME        : PC3[1]
IP/MASK     : 192.168.100.2/24
GATEWAY     : 0.0.0.0
DNS         :
MAC         : 00:50:79:66:68:02
LPORT       : 10007
RHOST:PORT  : 127.0.0.1:10006
MTU:        : 1500

PC4> ip 192.168.200.2/24
Checking for duplicate address...
PC1 : 192.168.200.2 255.255.255.0

PC4> show ip

NAME        : PC4[1]
IP/MASK     : 192.168.200.2/24
GATEWAY     : 0.0.0.0
DNS         :
MAC         : 00:50:79:66:68:03
LPORT       : 10008
RHOST:PORT  : 127.0.0.1:10009
MTU:        : 1500

PC1> ping 192.168.100.2
84 bytes from 192.168.100.2 icmp_seq=1 ttl=64 time=0.120 ms
84 bytes from 192.168.100.2 icmp_seq=2 ttl=64 time=0.180 ms
84 bytes from 192.168.100.2 icmp_seq=3 ttl=64 time=0.165 ms
84 bytes from 192.168.100.2 icmp_seq=4 ttl=64 time=0.222 ms
84 bytes from 192.168.100.2 icmp_seq=5 ttl=64 time=0.204 ms

PC2> ping 192.168.200.2
84 bytes from 192.168.200.2 icmp_seq=1 ttl=64 time=0.101 ms
84 bytes from 192.168.200.2 icmp_seq=2 ttl=64 time=0.164 ms
84 bytes from 192.168.200.2 icmp_seq=3 ttl=64 time=0.222 ms
84 bytes from 192.168.200.2 icmp_seq=4 ttl=64 time=0.168 ms
84 bytes from 192.168.200.2 icmp_seq=5 ttl=64 time=0.210 ms

設定を保存します。

Sw1#wri
Building configuration...
[OK]

Sw2#wri
Building configuration...
[OK]

PC1> save
Saving startup configuration to startup.vpc
.  done

PC2> save
Saving startup configuration to startup.vpc
.  done

PC3> save
Saving startup configuration to startup.vpc
.  done

PC4> save
Saving startup configuration to startup.vpc
.  done



お疲れさまです。本日の実験は終了です。

ニックネーム たいちょう でした。次回をお楽しみに。

タグ: