본문 바로가기
CCNA

Switch - Vlan 설정 // Router inter-Vlan

by 북한산산적 2012. 1. 7.

Switch - Vlan 설정



Switch 1번 설정

SW1#configure t
SW1(config)#vlan 10
SW1(config-vlan)#vlan 20
SW1(config-vlan)#vlan 30
SW1(config-vlan)#vlan 40
SW1(config-vlan)#no vlan 40
SW1(config)#no vlan 30
SW1(config)#vlan 20
SW1(config-vlan)#name AAA
SW1(config-vlan)#do show vlan    
vlan 설정 확인


SW1(config-vlan)#int fa0/1
SW1(config-if)#switch
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10


SW1(config-if)#int fa0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20


SW2(config)#interface fa0/10
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 10

sw 2 번 이랑 연결된 포트를 trunk 로 만듬
연속적일때.
SW1(config)#int range fa0/23 - fa0/24

연속적이지 않을때

SW1(config)#int range fa0/23 , fa0/25

2950 스위치 이상일때.
SW1(config-if-range)#switchport trunk encapsulation dotlq

trunk 포트 설정

SW1(config-if-range)#switchport mode trunk


Switch 2 설정

SW2#configure t
SW2(config)#vlan 10
SW2(config-vlan)#vlan 20

SW1(config-vlan)#int fa0/1
SW1(config-if)#switch
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20


SW1(config-if)#int fa0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10


SW2(config)#interface fa0/10
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 20

SW2#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID    Local Intrfce   Holdtme    Capability   Platform    Port ID
SW1          Fas 0/24         165            S       2950        Fas 0/23
SW1          Fas 0/23         165            S       2950        Fas 0/24
SW2#


SW1(config)#int range fa0/23 - fa0/24

SW1(config-if-range)#switchport mode trunk


--------------------------------------------
Trunk 확인
SW2#show interfaces trunk

--------------------------------------------

R1 설정

Router#configure t
Router(config)#no ip domain-lookup
Router(config)#line con
Router(config)#line console 0
Router(config-line)#exit
Router(config)#hostname vlan
vlan(config)#int fa0/0
vlan(config-if)#no shutdown

vlan(config-if)#ip address 172.16.1.1 255.255.255.0

 

vlan#conf t

vlan(config)#interface fa0/1

vlan(config-if)#no shutdown

vlan(config-if)#ip address 172.16.2.1 255.255.255.0



Inter - Vlan (Router 에서 설정)

하나의 inter face 를 가지고 여러개의 Vlan과 통신 시켜 준다.


단점 : 혼잡발생

Router 설정

int f0/0    //

no shutdown

int fa0//0.10 // Sub interface


encapsulation dot1q  10   // 10은 vlan 번호

int fa0/0.20

encapsulation dot1q 20 // 20은 vlan 번호

ip address 172.16.2.1 255.255.255.0

 


Switch interface fa0/1 는 trunk 로 설정 해 주어야 한다.

 


-------------------------------------------
Switch 1번 설정

switchport mode trunk


SW1(config)#int fa0/10
SW1(config-if)#switchport mode trunk

 

Router
R1 설정


vlan(config)#int fa0/0
vlan(config-if)#no shutdown
vlan(config-if)#int fa0/0.10
vlan(config-subif)#encapsulation dot1Q 10
vlan(config-subif)#ip address 172.16.1.1 255.255.255.0
vlan(config-subif)#exit

vlan(config)#interface fa0/0.20
vlan(config-subif)#encapsulation do
vlan(config-subif)#encapsulation dot1Q 20
vlan(config-subif)#ip address 172.16.2.1 255.255.255.0
vlan(config-subif)#