-
네트워크 5일차 정네트워크 2022. 5. 16. 17:32
20220516 아침정리
0513(금)
200.1.1.64/26 로 알 수 있는 것들 ==>11001000.00000001.00000001.01000000/26
1. 호스트 수 => 2의 h승(호스트 비트 수) -2 ==> 64-2= 62개
2. 서브넷마스크 => 255.255.255.11(여기까지 네트워크 비트 수) 000000 ==> 255.255.255.192
3. 네트워크 IP(원래 주소에서 호스트비트만 0으로 ==> 200.1.1.64(010000000
4. 브로드캐스트 IP (원래 주소에서 호스트 비트를 1로) => 200.1.1.127(01111111)
5. IP 범위 => 200.1.1.65~200.1.1.126
===========================================================
0516
CLI Mode
Exec(실행)=> user(사용자) R> enable
privileged(관리자) R# configure terminal(관리자 실행 모드로 가려면, end 또는 ctrl + Z)
Configuration(변경) => Global(전체) R(config)# interface fastethernet 0(모듈번호)/0(포트번호)~1/1(슬롯 4개 기준)
0(모듈)/0(슬롯)/1(포트)인 경우도 있음
=> Sub(부분) R(config-if)#
CLI 명령어
- Router>enable ==> 라우터에 접근하겠다는 의미(Router#으로 바뀜)
- Router#configure terminal => 터미널 접근 명령(Router(config)#으로 바뀜)
- Router(config)#interface fastethernet 0/0(Router(config-if)#으로 바뀜)
- Router(config-if)#exit (나가겠다는 뜻, Router(config-if)#으로 바뀜)
- Router(config)#exit
- Router#
- Router#disable(Router>로 바뀜)
- Router>logout(종료)
명령어 굳이 길게 다 안써도되고 약어로만 써서 tab누르면 명령어 자동으로 완성시켜줌,
아니면 약어만 써도 사용가능 ex)conf t ==>configure terminal
int f0/0 => interface fastEthernet 0/0
#hostname 원하는 이름 ==> 프롬프트 이름 바꾸는 명령
#banner motd $ ==> 배너 생성해서 메시지 띄우기 '$'는 마지막 멘트 쓰고 종료를 위한 글자.
telnet 연결 방법
1. 콘솔연결
암호 설정
#line console
#password ___
#login
2.가상 터미널 연결
#line vty(0~4번)
#password ____
#login(이걸로 비밀번호 물어보기)
3.관리자 연결(동일 암호 불가, 둘다 암호를 설정했으면 secret 암호 먼저 물어봄)
-텍스트 암호
#enable password ____
-암호화된 암호
#enable secret ___
==>암호 설정
R0>enable
R0#conf t
Enter configuration commands, one per line. End with CNTL/Z.
콘솔로 암호설정
R0(config)#line console 0
R0(config-line)#password rapapass
R0(config-line)#login(이걸 해야 비밀번호를 물어봄)
가상 서버로 암호설정
R0(config-line)#line vty 0 4
R0(config-line)#password metapass
R0(config-line)#login(이걸 해야 비밀번호를 물어봄)
R0(config-line)#exit
접근 할때 암호 설정
R0(config)#enable password rapapass (사용자, 텍스트 암호(권장안함))
R0(config)#enable secret metapass (관리자, 암호화된 암호)
R0(config)#exit
R0#show running-config ==> 메모리 확인하기
R0(config)#service password-encryption(글로벌 모드에서 진행해야함)
텍스트 암호를 암호화된 암호로 변경해줌
비밀번호 해제하기
R0#conf t
R0(config)#no enable password
R0(config)#no enable secret
R0(config)#line console 0
R0(config-line)#no password
R0(config-line)#no login
R0(config-line)#line vty 0 4
R0(config-line)#no password
R0(config-line)#no login
** 변경 단계에서 show run 이런거 해봤자 오류남 do를 붙여야함(변경단계에서만)
라우터 아이피 할당
R0#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R0(config)#interface f0/1
R0(config-if)#ip address 200.1.1.1 255.255.255.0
R0(config-if)#show ip interface brief
^
% Invalid input detected at '^' marker.
R0(config-if)#do show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 200.1.1.1 YES manual administratively down down
Vlan1 unassigned YES unset administratively down down
R0(config-if)#no shutdown ==> 중단되어있던 라우터를 실행상태로 바꿈
부팅시 이전에 내용 저장해서 다시 보여주는 방법
R0#copy running-config startup-config => 현재 내용 저장하기
Destination filename [startup-config]? =>엔터 누르면 됨
Building configuration...
[OK]
R0#show startup-config => 현재 저장 내용 보여주기
R0#reload => 재부팅
R0(config)#line console 0
R0(config-line)#exec-timeout 5 0 => 5분 간 반응없으면 자동 로그아웃
R0(config-line)#exec-timeout 0 0 => 로그아웃 해제를 없애버림(절대 권장하지 않음)
R0(config)#line console 0 =>line 진입
R0(config-line)#logging synchronous ==> 콘솔 입력시 재표시
R0(config-line)#no ip domain-lookup ==> 명령어 잘 못 입력했을 때 조회 중지(오타를 내도 명령어가 아니면 호스트이름인줄알고 쿼리를 실행하기 때문)
CDP/LLDP
인접장비 보는 명령어
=> DSW#show cdp neighbors (DSW는 스위치 이름 변경한 것)
인접장비 자세하게
=> DSW#show cdp entry *
=> DSW#show cdp neighbors detail
위와 내용은 같음
=>DSW(config)#lldp run
=>DSW#show lldp neighbors
=>DSW#show lldp neighbors detail
중지 명령
DSW(config)#no cdp run
DSW(config)#no lldp run
라우터 내부 구성
console
interface
ROM Flash MRAM RAM
ROM => POST(power-on self test) code, Bootstrap code, SubIOS(복구부팅시)
Flash => IOS(정상부팅시)
MRAM => startup-config, (sw경우) vlan.dat
RAM => 실행 IOS, 실행 command, Routing Table, Buffer, running-config
라우터 부팅 순서
1. Post 수행
2. 부트스트랩코드 적재와 실행
3. 시스코 IOS 소프트웨어 찾기(flash)
4. 시스코 IOS 소프트웨어 적재 설정 정보 찾기
mac 테이블 확인하는 명령
=> Switch#show mac-address-table
네트워크 고려사항
1. 성능
2. 확장성
3. 유연성
4. 보안
5. 가용성
네트워크 공격 종류
- sniffing(가로채기)
- spoofing(속이기)
- Dos(서비스 중단 유도)
Mac Addr 를 대량으로 보내서 계속 flooding 현상을 유도
==> mac flooding attack
port-security
==> mac flooding attack을 막기 위해
mac 수 제한
mac 값 제한
스위치 포트 종류
Access Port: PC 연결 포트(port-security 는 여기다가 연결해야함)
Trunk Port: 스위치 연결 포트
Dynamic Port: 협상 상태, 이때는 port-security 적용 안 됨(Access,Trunk port 중에 선택을 해야함)
switch mac table 확인
=> Switch#show mac-address-table
port-security 설정 방법
Switch>enable
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int f0/2
Switch(config-if)#shut => shutdown을 시켜놔야지 안전함.
Switch(config-if)#switchport mode access
Switch(config-if)#switchport port-security
Switch(config-if)#no shutdown
------------------------------------------
Switch(config-if)#do show ip int brief
==> 스위치에 장착된 모든 인터페이스의 물리 계층, 데이터 링크 계층에 up, down 상태 및 IP주소 정보를 확인 하는 명령어
이렇게 막아논 포트를 살리는 방법은
Switch(config-if)#shutdown
Switch(config-if)#no shutdown
shutdown을 했다가 다시 풀어주면 됨.
--------------------------------------------------------------------
MAC 값 제한
Switch(config-if)#switchport mode access
Switch(config-if)#switchport port-security
Switch(config-if)#switchport port-security maximum ?
<1-132> Maximum addresses
Switch(config-if)#switchport port-security maximum 1
Switch(config-if)#switchport port-security mac-address 0000.0000.0002
Switch(config-if)#switchport port-security violation protect
Switch(config-if)#no shutdown
--------------------------------------------------------------------------
MAC 처음 들어오는 값 제한
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport port-security
Switch(config-if-range)#switchport mac-address sticky
**sticky = 스위치가 Mac-address를 동적으로 학습되도록하며, 저장된 주소 저장할 수 있다.
Switch(config-if-range)#switchport port-security mac-address sticky
Switch(config-if-range)#switchport port-security violation protect
**violation protect = port-security가 동작하는 포트에서 위반한
mac주소를 가진 장비의 모든 frame을 drop 시킨다.(Log는 발생하지 않음)
Switch(config-if-range)#no shutdown
----------------------------------------------------------------------
port-security 상태확인
Switch#show port-security
Switch#show port-security address
Switch#show port-security int f0/13'네트워크' 카테고리의 다른 글
네트워크 6일차 정리 (0) 2022.05.17 네트워크 4일차 정리 (0) 2022.05.13 네트워크 3일차 정리 (0) 2022.05.12 네트워크 2일차 정리 (0) 2022.05.12 네트워크 1일차 정리 (0) 2022.05.10