L2 스위치 게이트웨이 - L2 seuwichi geiteuwei

티스토리 뷰

스위치는 별도의 설정을 하지 않아도 전원을 연결하고 포트에 선만 꼽으면 잘 작동하지만 텔넷이나 SSH를 이용한 원격 접속이나 SNMP(Simple Network Management Protocol)를 이용한 관리를 하려면 IP 주소를 설정해야 한다.

일단 IP 주소, 서브넷 마스크, 디폴트 게이트웨이 주소를 설정해줘야 합니다.

설정은 정적인 방법으로 할 수도 있고 DHCP를 사용할 수도 있다.

어느 쪽이든 스위치에서 IP 설정을 할 때는 VLAN 1 가상 인터페이스에 설정한다.

이때 중요한 것은 'VLAN 1'과 'VLAN 1 가상 인터페이스'는 다르다!

먼저 정적으로 IP를 설정

1. 전역 설정 모드에서 'interface vlan 1' 명령어로 VLAN 1 설정 모드로 진입한다.

2. 'ip addressipmask' 명령어로 IP 주소와 서브넷 마스크 설정한다.

3. 'no shutdown' 명령어로 VLAN 1 가상 인터페이스 활성화한다.

4. 전역 설정 모드로 빠져나와 'ip default-gatewayip' 명령어로 디폴트 게이트웨이 주소를 설정한다.

Switch#configure terminal Switch(config)#interface vlan 1 Switch(config-if)#ip address 192.168.1.2 255.255.255.0 Switch(config-if)#no shutdown Switch(config-if)#exit Switch(config)#ip default-gateway 192.168.1.1

DHCP를 이용하여 설정

1. 전역 설정 모드에서 'interface vlan 1' 명령어로 VLAN 1 설정 모드로 진입한다.

2. 'ip address dhcp 명령어로 IP 주소와 서브넷 마스크 설정한다.

3. 'no shutdown' 명령어로 VLAN 1 가상 인터페이스 활성화한다.

4번이었던 디폴트 게이트웨이 설정을 하지 않는다는 것이 차이점이 있다.

한 가지 알아야 할 점은 dhcp로 IP 주소를 설정할 경우 'show running-config' 명령어로는 IP 주소를 볼 수 없다.

이때는 'show dhcp lease' 명령어나 'show interface vlan 1' 명령어를 통해 IP 주소를 확인할 수 있다.

tl;dr

The switch management cannot send anything to a different layer-3 network without a default gateway. Telnet is a bidirectional protocol, and the switch, without the default gateway, would be unable to respond to the host which is attempting to establish the Telnet session.

Long explanation:

The default gateway on a switch has the same function as any gateway configured on a host PC. Without a default gateway, the switch management address (on VLAN 1 in your case, but it could be on any VLAN configured on the switch) cannot send traffic off its network to another network.

When a host (including the switch management), wants to send a packet to another host, it needs to resolve the layer-3 address (IP, etc.) to the other host's layer-2 address (MAC, etc.) in order to build a layer-2 frame.

The host (including the switch management) sends an ARP (Address Resolution Protocol) request via a broadcast to do the resolution. Broadcasts do not cross layer-3 boundaries (routers). The host (including the switch management) can tell if the destination layer-3 address is outside its network because it has its own layer-3 address, the destination layer-3 address, and the network mask of its network. If the destination is on a different layer-3 network, the host (including the switch management) will send the frame to the gateway's layer-2 address.

IPv6 does basically the same thing, but IPv6 doesn't have broadcasts, so it uses a special multicast group based on the last 24 bits of the IPv6 address. This doesn't interrupt every host on the LAN, and it, in all probability, with only hit the host for which it wants to resolve the layer-2 address. Multicast doesn't cross layer-3 boundaries, either, unless a router is configured to route multicast (off by default).


네트워크/R&S 일반

스위치 기본 명령

2011. 2. 26. 12:06

♤ Config 초기화 & VLAN 정보 삭제
    Switch# erase startup-config
    Switch# clear vtp counters
    Switch# delete vlan.dat
    Switch# reload

♤ Management IP 설정
    Switch(config)# interface vlan 1
    Switch(config-if)#  ip address 10.10.10.2 255.255.255.0
    Switch(config-if)#  no shutdown
          : 스위치의 관리 IP는 스위치의 관리용 역할만 하며, L2 스위치에서는 동시에 2개가 활성화되지는 못함.

♤ Default-Gateway 설정


    Switch#ip default-gateway 10.10.10.1
            :  Default Gateway 미 설정 시에, 다른 네트워크에서 스위치로 접속이 불가함.