메뉴 바로가기 검색 및 카테고리 바로가기 본문 바로가기

한빛출판네트워크

IT/모바일

시스코 라우터 접속하기

한빛미디어

|

2001-11-06

|

by HANBIT

19,733

by Dru Lavigne, 역 한빛리포터 2기 신동섭 오늘 기사에서는 rollover 케이블을 사용하여 FreeBSD box로부터 시스코 라우터에 접속하려고 한다. 일반적으로 여러분이 시스코 라우터에 접속하는데 필요한 시간은 구성정보를 보거나 바꾸는것과 telnet 유틸리티를 사용하는 것으로 정해진다고 볼 수 있다. 그러나 여러분이 라우터를 처음 구매하였거나 우연하게 구성정보를 삭제했다면 인터페이스가 다운된 것처럼 라우터에 텔넷접속을 할 수 없으며 텔넷으로 어떠한 IP주소도 가질 수 없을 것이다. 만약 그 경우라면 여러분은 컴퓨터와 라우터를 직렬 인터페이스로 연결하여 콘솔을 통해 라우터에 접속을 시도할 것이다.
Managing IP Networks with Cisco Routers
마이크로소프트 랜드에서는 이런 작업을 하는데 보통 hyperterminal을 사용한다. 여러분의 FreeBSD 컴퓨터에 hyperterminal이 없을 경우에는 이러한 기능을 제공하는 포트 컬렉션에 있어 두 개의 내장형 유틸리티와 몇 개의 프로그램이 있다. 나는 cutip을 사용해 보고 싶다. 또한 minicom, ecu, kermit, seyon을 구성하고 사용할 것이다. 여러분이 처음으로 시스코 라우터를 셋업한다면 라우터와 연결되는 길고 평평하며 엷은 하늘색 rollover 케이블을 찾아라. 이 케이블 연결은 케이블 두 끝을 비교해보면 쉽게 인식할 수 있다. pinout이 서로 반대되기 때문에 rollover 케이블이라 불리게 되었다. 사실상 케이블은 두 번째 연결이 주름진 모양이 되었을 때 감겨진다. 라우터 뒷 부분에 케이블과 같은 하늘색으로 "console"이라고 적혀있는 연결부분에 rollover 케이블의 한쪽 끝을 꽂아라. 아직 FreeBSD 컴퓨터로 케이블의 다른 쪽을 연결하지 말아라. 왜냐하면 라우터에서 직렬 어댑터의 한쪽 끝을 사용해야 하기 때문이다. 여러분은 9핀과 25핀 어댑터를 가지고 있어야 한다. 사용할 수 있는 직렬포트를 보려면 FreeBSD 컴퓨터 뒷면을 봐라. 나의 시스템에서는 com1에 마우스를 연결했고 com2에는 아무것도 연결하지 않았다. 따라서 25핀 어댑터에 rollover 케이블을 연결하고 난 후, 이 케이블을 내 컴퓨터 com2에 연결했다. 모든 것이 연결되고 나면 FreeBSD 컴퓨터뒤의 파워를 켜고 시스코 라우터 뒷면의 파워 스위치를 켠다. 시작 전에 마지막으로 구별할 필요가 있는 것은 컴퓨터의 com 포트를 위한 FreeBSD 장비 이름이다. Com 포트는 0에서 시작하는 #이 있는 /dev/cuaa#이다. 여러분이 com1을 사용하고 있다면 cuaa0을 사용하고 있는 것이다.; 나는 com2를 사용하고 있기 때문에 이 기사에선 cuaa1을 사용할 것이다. 또한 우리는 직접적으로 직렬장비를 접속할 것이기 때문에 언급한 모든 유틸리티들을 여러분이 사용하는데 있어 슈퍼유저가 되어야 한다. FreeBSD-cutip-에서의 유틸리티로 시작해보도록 하자. cu를 사용하기 위해, -1을 사용하여 여러분의 com 포트나 라인 스위치를 입력하고 속도 스위치 -s를 사용하여 9600baud 속도를 입력하라.
su
Password:
cu -l /dev/cuaa1 -s 9600
Connected.
엔터키를 누르고 시스코 라우터의 셋업 유틸리티를 실행한다. 인터페이스에서 IP주소를 셋업하라는 프롬프트가 뜰 것이다. 패스워드를 설정하고 telnet 패스워드를 설정하라. Rollover 케이블없이 시스코 라우터에 접속할 수 있도록 하는데 필요한 최소한의 구성정보가 이런 것들이다. 시스코에선 여러분이 그러한 해답에 만족한다면 단지 엔터키를 누르기만 하면되는 것을 의미하는 "[]"안에 대부분의 질문에 대한 해답을 가지고 있다. 여러분이 그렇지 않다면 여러분이 요구하는 응답을 입력하라. 셋업 과정은 이것과 같아야 한다.
First, would you like to see the current interface summary? [yes]:
Any interface listed with OK? value "NO" does not have a valid configuration
Interface  IP-Address   OK? Method  Status  Protocol
Ethernet0  unassigned   NO  unset   up      down
Serial0    unassigned   NO  unset   down    down

Configuring global parameters:
Enter host name [Router]:
The enable secret is a one-way cryptographic secret used
instead of the enable password when it exists.
Enter enable secret:

The enable password is used when there is no enable secret
and when using older software and some boot images.
Enter enable password:
Enter virtual terminal password:
Configure SNMP Network Management? [yes]: no
Configure IPX? [no]:
Configure IP? [yes]:
Configure IGRP routing? [yes]: no
Configure RIP routing? [no]:

Configuring interface parameters:
Configuring interface Ethernet0:
Is this interface in use? [yes]:
Configure IP on this interface? [yes]:
IP address for this interface: 10.0.0.100
Number of bits in subnet field [0]:
Class A network is 10.0.0.0, 0 subnet bits; mask is /8

Configuring interface Serial0:
Is this interface in use? [yes] no
The following configuration command script was created:

Use this configuration? [yes/no]: yes
Building configuration...
Use the enable mode "configure" command to modify this configuration.

Press RETURN to get started!
Router>
구성 정보 과정이 지금 끝나고 사용자 모드 프롬프트에 있다. 여러분이 시스코 IOS 명령에 익숙하다면 일반적으로 이들을 사용할 수 있다. 여러분이 cu 세션을 닫음으로 인해 시스코 라우터와의 연결을 끊길 원할 때 입력하라.
~.
다음으로 enter키를 입력하라. "Disconnected" 메시지를 받으면 FreeBSD 프롬프트 상태로 돌아갈 것이다. 이제 tip 유틸리티를 사용하여 라우터에 재접속을 시도해 보자. tip에서, /etc/remote 파일로부터 entry를 사용하기위한 tip으로 라인이나 스피드 스위치는 사용하지 않는다.
more /etc/remote
# $FreeBSD: src/etc/remote,v 1.10.2.1 
#    2001/03/06 02:22:39 obrien Exp $
#
#	@(#)remote	5.2 (Berkeley) 6/30/90
#
# remote -- remote host description file
# see tip(1), remote(5)
#
# dv	device to use for the tty
# el	EOL marks (default is NULL)
# du	make a call flag (dial up)
# pn	phone numbers (@ =>"s search phones file; 
#	    possibly taken from PHONES environment variable)
# at	ACU type
# ie	input EOF marks (default is NULL)
# oe	output EOF string (default is NULL)
# cu	call unit (default is dv)
# br	baud rate (defaults to 300)
# fs	frame size (default is BUFSIZ) -- used in 
#	    buffering writes on receive operations
# tc	to continue a capability

# Systems definitions
netcom|Netcom Unix Access:\
	:pn=\@:tc=unix1200:
omen|Omen BBS:\
	:pn=\@:tc=dos1200:

# UNIX system definitions
unix1200|1200 Baud dial-out to a UNIX system:\
	:el=^U^C^R^O^D^S^Q:ie=%$:oe=^D:tc=dial1200:
unix300|300 Baud dial-out to a UNIX system:\
	:el=^U^C^R^O^D^S^Q:ie=%$:oe=^D:tc=dial300:

# DOS system definitions
dos1200|1200 Baud dial-out to a DOS system:\
	:el=^U^C^R^O^D^S^Q:ie=%$:oe=^Z:pa=none:tc=dial1200:

# General dialer definitions used below
#
# COURIER switch settings:
# switch:	1 2 3 4 5 6 7 8 9 10
# setting:	D U D U D D U D U U
# Rackmount:	U U D U D U D D U D
#
dial2400|2400 Baud Hayes attributes:\
	:dv=/dev/cuaa0:br#2400:cu=/dev/cuaa0:at=hayes:du:
dial1200|1200 Baud Hayes attributes:\
	:dv=/dev/cuaa0:br#1200:cu=/dev/cuaa0:at=hayes:du:

# Hardwired line
cuaa0b|cua0b:dv=/dev/cuaa0:br#2400:pa=none:
cuaa0c|cua0c:dv=/dev/cuaa0:br#9600:pa=none:

# Finger friendly shortcuts
com1:dv=/dev/cuaa0:br#9600:pa=none:
com2:dv=/dev/cuaa1:br#9600:pa=none:
com3:dv=/dev/cuaa2:br#9600:pa=none:
com4:dv=/dev/cuaa3:br#9600:pa=none:
이 파일은 네개의 com 포트를 엔트리로 하는 바닥의 섹션에서 쇼컷으로 얻을 때까지 아주 불쾌하게 보인다. 이는 tip을 사용하여, 아주 간단한 형태를 가질 수 있다.
tip com2
connected
엔터를 입력할 때 시스코 사용자 모드 프롬프트로 돌아왔음을 의미하는 router> 프롬프트를 다시 볼 수 있을 것이다. tip 세션을 끝내었을 때, 아래를 입력함으로써 라우터로부터 연결을 해제하게된다.
~^D
[EOT]
여러분은 연결해제 시퀀스를 위해 좀 더 복잡한 키조합 과정을 거쳐야 한다. 시프트키를 누른 상태에서 ~키를 눌러라; 컨트롤키를 누를 때 시프트키의 손가락 상태를 유지해라. 그 다음 문자 "D"를 눌러라. 포트 컬렉션의 comms 세션으로 가서 시스코 라우터에 접속하는데 사용될 수 있는 포트를 구성하자. 나는 minicom으로 시작할 것이다.
cd /usr/ports/comms/minicom
make install clean
===> minicom-1.83.1_2 is forbidden: Local exploit yielding setuid uucp.
여러분은 이 포트가 minicom에서 특별한 것이 있는 것처럼 숨겨진 채 마크되어 있다는 사실을 알아야 한다. 이것에 대한 더 자세한 것을 읽고자 하면 이 보고자료(클릭)를 봐라. 이 보고자료를 읽었으면 이 포트는 여러분의 환경에 위험요소가 있는지 아닌지를 결정할 수 있다. 작업하기 편리하고 dial-in 서버로 minicom을 사용하지 않을 것이기 때문에 다시 구성할 수 있을 것이다. 먼저 make 파일의 FORBIDDEN 라인에서 remark(#)를 제거해야 하며 그 다음 make를 다시 실행해야 한다. 나는 흥미로운 구성결과를 가지고 있다.
make install clean

# this script creates a link from your comm 
# port to /dev/modem
/bin/sh /usr/ports/comms/minicom/scripts/create-dev-link
Minicom will be installed mode 4511 (setuid) owner uucp, 
 and group dialer. Is this ok? [y] y
Minicom needs to know what device your modem is hanging 
 off of. I (the porter) have adopted Satoshi Asami"s lead 
 of using /dev/modem.
Lets see if you have too...Nope, you haven"t (yet).
The patches to Minicom hardcode /dev/modem.
Would you like me to make this link for you? [Y] 
From the list below, what port number is your modem 
 attached to?
cuaa0	cuaa1	cuaa2	cuaa3
Enter the number X from cuaaX above : 1

===>  SECURITY NOTE: 
      This port has installed the following binaries 
      which execute with increased privileges.
1143283  288 -rwsr-xr-x   1 uucp   dialer  
  132420 Oct  4 12:33 /usr/local/bin/minicom

      If there are vulnerabilities in these programs 
      there may be a security risk to the system. 
      FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please 
      type "make deinstall" to deinstall the port if 
      this is a concern.
우리가 minicom을 사용하기 전에 보고자료에서 설명했던 것처럼 특별한 것을 위한 작업에 착수 하자.
chmod -s /usr/bin/minicom
chmod: /usr/bin/minicom: No such file or directory
한번 더 시도해 보도록 하자.
which minicom
/usr/local/bin/minicom
chmod -s /usr/local/bin/minicom
여러분이 minicom을 처음 시작할 때, 여러분은 s 스위치를 사용하여 셋업 모드로 들어가길 원할 것이다.
minicom -s
이것은 minicom 환경 설정 메뉴를 보여줄 것이다. "Serial port setup" 메뉴로 화살표를 내려서 엔터키를 누른다. 그 다음 /dev/modem에서 dev/cuaal로 직렬장비를 변화시키기 위해 "A"를 누르고 Bps/Par/Bits를 변화하기위해 "E"를 눌러라. 다음 9600을 선택하기위해 E를 다시 누르고 하드웨어 흐름 제어를 끄기 위해 "F"를 눌러라. 이 환경 설정 메뉴를 빠져나가기 위해 ESC키를 누르고 "Save setup as…"를 선택하라. "cisco"로 이것을 저장할 것이다. 환경 설정이 저장되고 나면, "exit"를 선택하라. 포인트 minicom은 시스코 라우터에 연결할 것이며 router> 프롬프트를 보게 될 것이다. minicom 세션을 끝내길 원할 때 ctrl-A를 눌러라. 컨트롤키를 누른 상태로 Q를 눌러라. 여러분은 리셋없이 빠져나가기 위해 "YES"를 선택하려 할 것이다. 여러분은 minicom을 사용하여 다시 시스코 라우터에 접속할 필요가 있다면 간단히 아래와 같이 입력해라.
minicom cisco
연결을 초기화하기 위해 지금 ecu를 시도하자:
cd /usr/ports/comms/ecu
make install clean
이 포트를 구성 할 때 자동으로 아래와 같은 내용들에 응답을 한다.
If you execute ecu with uid set to uucp lines, then 
 uucp will be able to access any serial line owned 
 by the user or owned by uucp. In addition, you need 
 not provide for world-write access to the UUCP
 lock directory.  Answer "n" if you are not sure.
 Do you wish to run ecu setuid to uucp?  ([y],n)? 
What do you want for a default tty? [cuaa0]
What do you want for a default bit rate? [9600]
What do you want for default parity ([n],e,o)? 
Where do you want the public executables 
 placed? [/usr/local/bin]
Where do you want the ECU library 
 placed? [/usr/local/lib/ecu]
How many seconds should the built-in dialer wait 
 for carrier? [60]
What is the maximum number of screen 
 lines (>= 24)? [50]
What is the maximum number of screen 
 columns ($gt;= 80)? [80]
minicom 유틸리티처럼, ecu는 하나의 entry를 생성하고 저장할 수 있게 해준다. 나는 아래와 같은 entry를 생성할 것이다.
ecu
^D 		to enter phone directory
a 		to add an entry
Enter new directory entry name:   cisco
arrow down to device and type in:    cuaa1
press END key to accept
press Enter to dial
type y to save entry

Connecting to cisco
on /dev/cuaa1 at 9600 baud (14:38:22)
CONNECT 9600
내가 엔터를 누를 때, router$gt; 프롬프트를 받을 것이다. 이 프로그램은 광범위한 도움말 시스템을 가지고 있다. 이 시스템은 Home키를 누르면 접속되며 "help"를 입력해도 된다.
help
여러분이 ecu 사용을 끝내고자 할 때에는 홈키를 누르고 "EX"를 입력하면 된다.
EX
다시 여러분이 ecu를 사용하기 원한다면, ecu cisco를 사용하여 직접적으로 라우터에 접속을 할 수 있다.
ecu cisco
kermit으로 옮겨보자.
cd /usr/ports/comms/kermit
make install clean
kermit을 사용하기 위해 아래의 내용을 입력하라.
kermit
SET LINE /dev/cuaa1
SET CARRIER-WATCH OFF
connect
그 다음 router$gt 프롬프트를 얻기 위해 엔터키를 눌러라. kermit 세션으로 끝내고자 할 때는 컨트롤 키를 누른 채로 키를 눌러라. 다음 시프트 키를 누른 채 "C"를 눌러라. 여러분의 프롬프트는 아래처럼 보일것이다:
C-Kermit$gt;
그리고 여러분은 "quit"를 입력하여 "kermit"을 마치게 된다:
C-Kermit$gt; quit
Closing /dev/cuaa1...OK 
우리가 볼 마지막 포트는 X 윈도우 세션에서 사용되었던 것이다.
cd /usr/ports/comms/seyon
make install clean
구성이 끝나고 나면 X 윈도우 세션을 시작하고 xterm 윈도우를 열어라. 그리고 슈퍼유저가 되어야 한다. 여러분이 xterm 윈도우에서 아래내용을 입력한다면
su
Password:
seyon -modems /dev/cuaa1
이것과 같이 보이는 두 개의 윈도우가 열릴 것이다. (클릭) 윈도우중 하나는 여러분의 라우터에 대한 연결정보를 보여주고 반면에 다른 윈도우는 seyon 명령을 포함한다. 여러분이 라우터 작업을 끝낼 때, 여러분은 세션을 끝내기위해 마우스로 exit 옵션을 누를 수 있다. 만약 여러분이 과거에 이러한 유틸리티를 사용해본 경험이 있거나 구성을 따라해 본 경험이 있다면 이 기사에서 다루었던 유틸리티들은 내가 언급해왔던 것보다 더 큰 능력을 가지고 있다는 것을 깨달았을 것이다. 내가 그것들과 시스코 라우터의 접속을 위해 사용하는 것에 중점을 둔 것에도 불구하고, 이러한 유틸리티들은 강력한 직렬 포트 통신을 제공한다. 여러분이 다른 가능성을 시험해 보고자 한다면 내가 사용해 봤던 모든 유틸리티는 여러분의 숙독을 위해 확장된 man 페이지를 가지고 있다. Dru Lavigne는 Kingston, ON에 있는 사설 기술대학에서 네트워크 강사로 있으며 시험장비에서 다중 부팅을 확신할 수 있는 운영체제가 몇 개나 되는지 알아보는 작업을 하고있는 것으로 유명하다.
TAG :
댓글 입력
자료실

최근 본 책0