bxm's IT Story

어느 곳을 고쳐야할까? 라우터 스위치 문제. 본문

Network/Cisco (KEDU)

어느 곳을 고쳐야할까? 라우터 스위치 문제.

bxmsta9ram 2021. 6. 9. 10:11

 

## Router On a Stick

** 모든 장비 기본 설정
ena
conf t
no ip domain lookup
line c 0
  logg sy
  exec-timeout 0
  exit
line vty 0 4
  password cisco
  exit
hostname XX

SW1]
conf t
no ip routing
vlan 10
  exit
vlan 20
  exit
int f1/3
  switchport mode access
  switchport access vlan 10
  exit
int f1/4
  switchport mode access
  switchport access vlan 20
  exit


SW2]
conf t
no ip routing
vlan 10
  exit
vlan 20
  exit
int f1/1
  switchport mode access
  switchport access vlan 10
  exit
int f1/2
  switchport mode access
  switchport access vlan 20
  exit
int range f1/9
  switchport trunk encapsulation dot1q
  switchport mode trunk
  end
wr

R1]
conf t
int f0/0
  no shutdown
  exit
int f0/0.10
  encapsulation dot1q 10
  ip address 1.1.10.254 255.255.255.0
  exit
int f0/0.20
  encapsulation dot1q 20
  ip address 1.1.20.254 255.255.255.0
  exit


PC1~4]
conf t
no ip routing
ip default-gateway 1.1.x.x
// PC 1과 3의 gateway -> 1.1.10.254
   PC 2와 4의 gateway -> 1.1.20.254
!
int f0/0
  no shutdown
  ip add 1.1.x.x 255.255.255.0  (1-1.1.10.1 / 2-1.1.20.2 / 3-1.1.10.3 / 4-1.1.20.4)
  end
wr

- verify -
show ip interface brief
show vlan-switch
show interface trunk


제일 먼저 해야할 것은 VLAN 확인이다.

 

 

SW1]

위의 모든 명령어를 전부 치고 show vlan-sw 로 확인해본 결과 VLAN 10-1번 / VLAN 20-2번이 들어가야하는데 각각 3/4번이 들어가있음. 

이러면 인터페이스 들어가서 NO 명령어로 실행하면된다.


conf t

int f1/3

no switchport mode access

no switchport access vlan 10

exit

 

int f1/4

no switchport mode access

no switchport access vlan 20

 

int f1/1

switchport mode access

switchport access vlan 10

exit

 

int f1/2

switchport mode access

switchport access vlan 20

exit

제대로 변경된 것을 확인할 수 있다.

 

 


 

 

SW2]

위의 모든 명령어를 전부 치고 show vlan-sw 로 확인해본 결과 VLAN 10-3번 / VLAN 20-4번이 들어가야하는데 각각 1/2번이 들어가있음. 

SW1과 마찬가지로 NO 명령어를 통해 연결된 것을 풀어주면 된다.


conf t

int f1/1

no switchport mode access

no switchport access vlan 10

exit

 

int f1/2

no switchport mode access

no switchport access vlan 20

 

int f1/3

switchport mode access

switchport access vlan 10

exit

 

int f1/4

switchport mode access

switchport access vlan 20

exit

제대로 들어간 것을 확인할 수 있다.


다음으로 확인할 것은 Trunk이다.

 

SW1]

show interface trunk (sw int tr로 축약 가능)

Trunk가 없다.

 

conf t

int f1/9

switchport trunk encapsulation dot1q

switchport mode trunk

Trunk가 된 것을 볼 수 있다.

 

 

 

SW2]

conf t

int f1/15

sw tr enc dot

sw mode tr

위에서 show int tr시 1/9만 나오지만, 명령어 수행후 1/15까지 나오는 것을 확인할 수 있다.

 


마지막으로 확인할 것은 IP이다.

 

R1]

show ip interface br

IP도 확인할 수 있다.

show run interface f0/0.10

 

 

모든 것을 마무리 후 PC1~PC4에서 각각 ping 1.1.10.254 / ping 1.1.20.254를 날렸을 때 (5/5) 모두 성공한 것을

볼 수 있다.