Contents

VLAN

   Feb 13, 2023     5 min read

VLAN

: Virtual Local Network - 논리적으로 Vroadcast 영역
참고) 물리적인 Broadcast 영역 (L3 장비)

Ex. VLAN

Untitled

부서별 연락이 되게 해 보자.

Access mode : PC끼리 연결 된 것.
Trunk mode : Switch끼리 연결 된 것.



방법

  • Switch 1
vlan 10

vlan 20

int fa0/1
switchport mode access
switchport access vlan 10

int fa0/2
switchport mode access
switchport access vlan 20

int fa0/3
switchport mode trunk

show vlan



  • Switch 2
vlan 10

vlan 20

int fa0/1
switchport mode access
switchport access vlan 10

int fa0/2
switchport mode access
switchport access vlan 20

int fa0/3
switchport mode trunk

show vlan



결과

Untitled (1)

Untitled (2)

Untitled (3)

Untitled (4)

PC 10.1

Untitled (5)

10.2는 통신이 안 되지만
10.3은 통신이 가능하다.

Untitled (6)

10.4 역시 통신이 안 된다.

정리 - 결과

  • PC 10.1
    > ping 192.168.10.2 - X
    > ping 192.168.10.3 - O
    > ping 192.168.10.4 - X
    



  • PC 10.2
    > ping 192.168.10.1 - X
    > ping 192.168.10.3 - X
    > ping 192.168.10.4 - O
    



  • PC 10.3
    > ping 192.168.10.1 - O
    > ping 192.168.10.2 - X
    > ping 192.168.10.4 - X
    



  • PC 10.4
    > ping 192.168.10.1 - X
    > ping 192.168.10.2 - O
    > ping 192.168.10.3 - X
    



주의

  • 스위치는 VLAN 구성이 되어 있는 경우
    받을 때 VLAN Tag를 붙이고, 나갈 때 VLAN Tag를 제거함.
    단, Trunk mode인 경우는 VLAN Tag 붙은 상태로 보내고 받음.


참고

Untitled (7)

기본으로 VLAN 1에 다 설정되어 있다.

Ex.02

Untitled (8)

  • L3
interface fa0/0
no shutdown

interface fa0/0.10
encapsulation dot1Q 10
ip address 192.168.10.254 255.255.255.0

interface fa0/0.20
encapsulation dot1Q 20
ip address 192.168.20.254 255.255.255.0



  • Switch 02
interface fa0/4
switchport mode trunk



결과

Untitled (9)

  • PC 10.1
    > ping 192.168.10.2 - O
    > ping 192.168.20.1 - O
    > ping 192.168.20.2 - O
    



Untitled (10)

Untitled (11)

Ex. 03

Untitled (12)

10.1에서 모든 PC로 ping이 가도록.

방법

  • Switch 01
    interface fa0/3
    switchport trunk encapsulation dot1q
    switchport mode trunk
    



  • Switch 02
    interface fa0/3
    switchport trunk encapsulation dot1q
    switchport mode trunk
    



  • Router 01
    int fa0/0
    no shutdown
    



  • Router 02
    int fa0/0
    no shutdown
    



결과

Untitled (13)

Untitled (14)

PC 10.1에서 모두 ping이 된다.


Ex. 04

Untitled (15)

방법

  • Switch 3
no ip routing

vlan 10

vlan 20

int Gi0/0
switchport trunk encapsulation dot1q
switchport mode trunk

int Gi0/1
switchport mode access
switchport access vlan 10

int Gi0/2
switchport mode access
switchport access vlan 20



  • Switch 4
no ip routing

vlan 30

vlan 40

int Gi0/0
switchport trunk encapsulation dot1q
switchport mode trunk

int Gi0/1
switchport mode access
switchport access vlan 30

int Gi0/2
switchport mode access
swtichport access vlan 40



  • vIOS1
int Gi0/0
no shutdown

int g0/0.10
encapsulation dot1Q 10
ip address 192.168.10.2 255.255.255.0

int g0/0.20
encapsulation dot1Q 20
ip address 192.168.20.2 255.255.255.0



  • vIOS2
int Gi0/0
no shutdown

int g0/0.30
encapsulation dot1Q 30
ip address 192.168.30.2 255.255.255.0

int g0/0.40
encapsulation dot1Q 40
ip address 192.168.40.2 255.255.255.0




결과

Untitled (16)

10.1 PC에서 모두 다 ping이 간다.


참고

Linux - cd /etc/sysconfig/network-scripts/
vi ifcfg-eth0