[PacketTracer 활용] VLAN 구성
1. 스위치 구성 및 Enable 패스워드 세팅
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname CAT2950
CAT2950(config)#enable password cisco
2. 스위치 관리를 위한 VLAN 1 설정
CAT2950#conf t
Enter configuration commands, one per line. End with CNTL/Z.
CAT2950(config)#interface vlan 1
CAT2950(config-if)#ip address 10.10.10.2 255.255.255.0
CAT2950(config-if)#no sh
CAT2950(config)#ip default-gateway 10.10.10.1
3. VTP 모드를 트랜스페어런트로 설정
CAT2950(config)#vtp mode transparent
CAT2950(config)#vtp domain cisco
CAT2950#show vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 255
Number of existing VLANs : 5
VTP Operating Mode : Transparent
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xAA 0xB9 0x0C 0xCD 0xD7 0xE8 0xA6 0xE0
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00
CAT2950#
4. VLAN 2 만들고 이름은 CCNA로 지정
CAT2950#conf t
Enter configuration commands, one per line. End with CNTL/Z.
CAT2950(config)#vlan 2
CAT2950(config-vlan)#name CCNA
5. 트렁크 포트 세팅. 그림에서 스위치 포트 Fa0/1가 트렁크로 세팅되어 있으며 트렁크 모드는 IEEE802.1Q로 설정
CAT2950#conf t
Enter configuration commands, one per line. End with CNTL/Z.
CAT2950(config)#interface fa0/1
CAT2950(config-if)#switchport mode trunk
CAT2950(config-if)#switchport trunk allowed vlan all
6. 포트를 VLAN에 배치. VLAN 1에 배치할 Fa0/3 포트는 따로 명령을 줄 필요가 없음. 디폴트 VLAN에 속해 있음. Fa0/5 번 포트만 VLAN 2에 넣도록 함.
CAT2950#conf t
Enter configuration commands, one per line. End with CNTL/Z.
CAT2950(config)#interface fa0/5
CAT2950(config-if)#switchport access vlan 2
※ 서브인터페이스란? 인터페이스 하나를 다시 작게 나눈 것을 말한다. 하나의 인터페이스를 왜 다시 나누느냐? 그건 바로 지금처럼 VLAN 을 쓸 때 사용하기 위해서임. 라우터는 스위치의 트렁크 포트와 연결되어 있고 스위치의 트렁크 포트를 통해 라우터로 들어오는 VLAN은 2개임. 따라서 겉으로는 하나지만 내부적으로는 두 개의 인터페이스가 있어야 각각의 VLAN에 대한 라우팅을 해줄 수 있는 것임.
7. 일단 구성에 있어 라우터가 VLAN 트렁킹을 지원한다는 가정하이고 라우터 구성을 해보자.
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router01
Router01(config)#enable password cisco
Router01(config)#interface gi0/0
Router01(config-if)#no shutdown
Router01(config-if)#exit
Router01(config)#interface gigabitEthernet 0/0.1
Router01(config-subif)#encapsulation dot1Q 1 native
Router01(config-subif)#ip address 10.10.10.1 255.255.255.0
Router01(config-subif)#exit
Router01(config)#interface gi 0/0.2
Router01(config-subif)#encapsulation dot1Q 2
Router01(config-subif)#ip address 10.10.11.1 255.255.255.0