VLAN

 

• VLAN(Virtual LAN)은 스위치내부를 여러 개의 독립 스위치 장비처럼 분할해주거나 이웃 스위치와 통합하는 기능을 제공한다.
• 대규모 네트워크에서 브로드캐스트 트래픽을 차단해주는 역할 제공한다.
• 각각의 VLAN 은 마치 단독의 별도 장치처럼 패킷을 송수신한다.
• VLAN은 각 스위치의 포트별로 설정하며 기본값은 모든 포트가 VLAN1에 속해 있다.

 

 

◾ VLAN으로 환경 구성
• PC1, PC2 ..는 각각 Fa0/1, Fa0/2 ..에 연결된다.

 

◾ VLAN 관련 명령
• show vlan : 현재 VLAN 확인
• show interface status : 각 인터페이스의 상태 확인
• vlan database : VLAN 생성
 - vlan ## name [vnan name]  ‐ VLAN 모드에서 작업
• vlan ## : VLAN 생성
 - name vlan [vnan name]  ‐ VLAN 인터페이스에서 작업
• switchport access vlan ## : 인터페이스를 VLAN에 할당
• switchport mode [access | trunk | dynamic ] : 인터페이스의 mode 정의
  (+ dynamic [auto | desirable] )

 

 

◾ 스위치의 VLAN 상태 확인

Sw1# show vlan
VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 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 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 - - - - - 0 0 1002 fddi 101002 1500 - - - - - 0 0 1003 tr 101003 1500 - - - - - 0 0 1004 fdnet 101004 1500 - - - ieee - 0 0 1005 trnet 101005 1500 - - - ibm - 0 0 ...
sw1#
show interface status
Port Name Status Vlan Duplex Speed Type Fa0/1 connected 1 auto auto 10/100BaseTX Fa0/2 connected 1 auto auto 10/100BaseTX Fa0/3 connected 1 auto auto 10/100BaseTX Fa0/4 connected 1 auto auto 10/100BaseTX Fa0/5 notconnect 1 auto auto 10/100BaseTX ...

 

 

 

개별 VLAN 인터페이스에서 VLAN을 설정한다.

• VLAN을 생성하는 방법은 두가지이나 생성 된 VLAN은 동일하다.

• 좀더 간단한 방법으로 주로 사용된다.

 

[vlan 2]

Switch(config)# vlan 2
Switch(config‐vlan)# name vlan2
Switch(config‐vlan)# do show vlan
VLAN Name                             Status    Ports
‐‐‐‐ ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
1 default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
......
2     vlan2                            active

 

[vlan3,4]

 

 

VLAN에 인터페이스를 할당한다.

• 개별 인터페이스 모드에서 작업한다.

• access 모드는 필수가 아니다.

 

 

아래 그림과 같이 설정하고 테스트를 수행한다.

• VLAN2와 VLAN3의 PC에서 스위치에 telnet 접속을 수행한다.


여러 스위치에서 VLAN 간 통신 실습     버젼 업데이트로 인해 자동으로 

 

 

◾ 여러 스위치에서 VLAN간 환경 구성

 

 

VLAN 1 : all

VLAN 10 : fa0/10 ~ fa0/14

VLAN 20 : fa0/20 ~ fa0/24

 

step.1

Switch 간 연결 Port에 따라 VLAN 접속이 가능 • Sw1의 Gig0/1과 Sw2의 Gig0/1을 모두 VLAN 10에 추가하면 PC10_1과 PC10_2간 통신은 가능 하지만 이외 VLAN간에 통신은 불가능하다.

 

 

step.2

VLAN 마다 별도의 포트를 통해 연결 가능하다. • Sw1과 Sw2 사이에 Gig0/2를 통해 새로운 연결을 구성하고 이를 VLAN 20에 할당하면 VLAN 10, 20 모두 통신 가능하다.

 

sw2(config)#vlan 10
sw2(config-vlan)#name vlan10
sw2(config-vlan)#exit
sw2(config)#vlan 20
sw2(config-vlan)#name vlan20
sw2(config-vlan)#exit
sw2(config)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                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
10   vlan10                           active    
20   vlan20                           active

 

 

VLAN 포트 설정

sw1(config)#interface range fa0/10-14
sw1(config-if-range)#switchport access vlan 10
sw1(config-if-range)#switchport mode access
sw1(config-if-range)#exit
sw1(config)#int range fa0/20-24
sw1(config-if-range)#switchport access vlan 20
sw1(config-if-range)#switchport mode access
sw1(config-if-range)#exit
sw1(config)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Gig0/1, Gig0/2
10   vlan10                           active    Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14
20   vlan20                           active    Fa0/20, Fa0/21, Fa0/22, Fa0/23
                                                Fa0/24

 

sw1(config)#int g0/1
sw1(config-if)#sw ac vlan 10
sw1(config-if)#sw mode ac
sw1(config-if)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Gig0/2
10   vlan10                           active    Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Gig0/1
20   vlan20                           active    Fa0/20, Fa0/21, Fa0/22, Fa0/23
                                                Fa0/24

 

 

 

 


VLAN Routing 실습

VLAN간에 통신은 반드시 L3 장치를 통해서 가능하다.

VLAN 10 : 1.1.1.0/24 : fa10 ~ fa14

• VLAN 20 : 2.2.2.0/24 : fa20 ~ fa24

• S1 gi0/1는 R0의 gi0/0에 연결.

- 트렁크로 지정 VLAN 10,20의 GW로 사용한다.

- R1의 gi0/0에 IP를 두 개 설정한다.

 

 

스위치 설정

S0(config)#vlan 10
S0(config-vlan)#name vlan10
S0(config-vlan)#vlan 20
S0(config-vlan)#name vlan20
S0(config-vlan)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                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
10   vlan10                           active    
20   vlan20                           active
...
S0(config)#int range f0/10-14, g0/1
S0(config-if-range)#switch access vlan 10
S0(config-if-range)#switchport mode access
S0(config-if-range)#int range f0/20-24, g0/2
S0(config-if-range)#sw ac vlan 20
S0(config-if-range)#sw mode access
S0(config-if-range)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19
10   vlan10                           active    Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Gig0/1
20   vlan20                           active    Fa0/20, Fa0/21, Fa0/22, Fa0/23
                                                Fa0/24, Gig0/2

 

 

 

라우터 설정

R1(config)# int gi0/0
R1(config‐if)# no sh
R1(config‐if)# int gi0/0.10
R1(config‐subif)# encapsulation dot1q 10
R1(config‐subif)# ip address 1.1.1.1 255.255.255.0
R1(config‐subif)# int gi0/0.20
R1(config‐subif)# encapsulation dot1q 20
R1(config‐subif)# ip address 2.2.2.1 255.255.255.0
R1(config‐subif)# do show ip int brief
Interface              IP‐Address      OK? Method Status                
Protocol
GigabitEthernet0/0     unassigned      YES manual up                    up
GigabitEthernet0/0.10  1.1.1.1         YES manual up                    up
GigabitEthernet0/0.20  2.2.2.1         YES manual up                    up

 

 

테스트는 PC에서 진행한다.

C:\>ping 1.1.1.1

Pinging 1.1.1.1 with 32 bytes of data:

Reply from 1.1.1.1: bytes=32 time=19ms TTL=255
Reply from 1.1.1.1: bytes=32 time<1ms TTL=255
Reply from 1.1.1.1: bytes=32 time<1ms TTL=255
Reply from 1.1.1.1: bytes=32 time<1ms TTL=255

Ping statistics for 1.1.1.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 19ms, Average = 4ms

C:\>ping 2.2.2.1 with 32 bytes of data:

Pinging  2.2.2.1  with 32 bytes of data:

Reply from 2.2.2.1: bytes=32 time<1ms TTL=255
Reply from 2.2.2.1: bytes=32 time<1ms TTL=255
Reply from 2.2.2.1: bytes=32 time<1ms TTL=255
Reply from 2.2.2.1: bytes=32 time<1ms TTL=255

Ping statistics for 2.2.2.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

 

 


 VLAN Routing Trunk 실습

◾ VLAN간에 통신은 반드시 L3 장치를 통해서 가능하다.
• VLAN 10 : 1.1.1.0/24 : fa10 ~ fa14
• VLAN 20 : 2.2.2.0/24 : fa20 ~ fa14
• S0 gi0/1는 R0의 gi0/0에 연결.
- 트렁크로 지정 VLAN 10,20의 GW로 사용한다.
- R0의 gi0/0에 IP를 두 개 설정한다.

 

스위치 설정

S0(config)#interface range gi0/1-2
S0(config-if-range)#no sw ac vlan
S0(config-if-range)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Gig0/1, Gig0/2
10   vlan10                           active    Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14
20   vlan20                           active    Fa0/20, Fa0/21, Fa0/22, Fa0/23
                                                Fa0/24

 

 

라우터 설정 ‐ 설정 삭제(이전실습 연동경우만)

R1(config)# int gi0/0
R1(config‐if)# no ip address
R1(config‐if)# shutdown
R1(config)# int gi0/1
R1(config‐if)# no ip address
R1(config‐if)# shutdown
R1(config‐if)# do show ip int brief
Interface           IP‐Address    OK? Method Status                  Protocol
GigabitEthernet0/0  unassigned    YES manual administratively down   down
GigabitEthernet0/1  unassigned    YES manual administratively down   down
Vlan1               unassigned    YES unset  administratively down   down

 

라우터 설정 ‐ 트렁크 포트 라우팅

◾   스위치의 트렁크 포트로부터 전송되는 여러 VLAN  패킷을 정상 처리하기 위해서는 라우터의 포 트에 두가지 기능이 필요하다.

① 포트에 여러 IP 설정이 가능해야 한다.

② 여러 VLAN 패킷을 처리할 수 있어야 한다.

 

라우터 포트에 여러 IP 설정

• 유닉스나 리눅스와 비슷한 방법으로 서브 인터페이스에 IP를 할당한다.

• gi0/0인 경우 gi0/0.10,  gi0/0.20 …

 

여러 VLAN 패킷 처리

• 각 인터페이스에 다중 VLAN 처리가 가능하도록 설정한다.

• (config‐subif)# encapsulation dot1q [# of vlan]

 

 

라우터 설정

R1(config)# int gi0/0
R1(config‐if)# no sh
R1(config‐if)# int gi0/0.10
R1(config‐subif)# encapsulation dot1q 10
R1(config‐subif)# ip address 1.1.1.1 255.255.255.0
R1(config‐subif)# int gi0/0.20
R1(config‐subif)# encapsulation dot1q 20
R1(config‐subif)# ip address 2.2.2.1 255.255.255.0
R1(config‐subif)# do show ip int brief
Interface              IP‐Address      OK? Method Status                
Protocol
GigabitEthernet0/0     unassigned      YES manual up                    up
GigabitEthernet0/0.10  1.1.1.1         YES manual up                    up
GigabitEthernet0/0.20  2.2.2.1         YES manual up                    up

 

 

pc에서 TEST

C:\>ping 1.1.1.3

Pinging 1.1.1.3 with 32 bytes of data:

Reply from 1.1.1.3: bytes=32 time=19ms TTL=255
Reply from 1.1.1.3: bytes=32 time<1ms TTL=255
Reply from 1.1.1.3: bytes=32 time<1ms TTL=255
Reply from 1.1.1.3: bytes=32 time<1ms TTL=255

Ping statistics for 1.1.1.3:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 19ms, Average = 4ms

C:\>ping 2.2.2.3 with 32 bytes of data:

Pinging  2.2.2.3  with 32 bytes of data:

Reply from 2.2.2.3: bytes=32 time<1ms TTL=255
Reply from 2.2.2.3: bytes=32 time<1ms TTL=255
Reply from 2.2.2.3: bytes=32 time<1ms TTL=255
Reply from 2.2.2.3: bytes=32 time<1ms TTL=255

Ping statistics for 2.2.2.3:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
2024. 3. 5. 14:57