본문 바로가기
네트워크 수업

[실습] RIP ACL prefix-list distribute-list Password 23.03.21

by 6^6 2023. 3. 21.
728x90

isp]

ip route 0.0.0.0 0.0.0.0 f1/0 10.0.0.1

username admin password router#
line vty 0 4
login local

 

↓ login local 개념

더보기

no login과 login local 차이점

■1. no login    : - Telnet login 시  패스워드 없이 로그인 가능
■2. login       : - loing 설정시 username 없이 꼴라 만 입력하면됨
■3. login local : - Telnet login 시, local database에 있는 정보를 가지고 사용자 인증
                 - 즉 login local로 설정하면 username 까지 물어본다.

- local database는 Router(config)#username 진만고양이 password 야옹      으로 생성되어 라우터에 저장되는 DB

예제)
1번 경우

!
line vty 0 4
!
----------------------------------------
2번 경우
!
line vty 0 4
 password 꼴라
!
----------------------------------------
3번경우
!
line vty 0 4
 login local 
 password 꼴라
!
!
username 진만고양이 password 야옹

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

 

pc1]

telnet 192.168.10.254

하면 안들어가진다.

 

isp]

enable password router# //이렇게 설정해줘야 들어갈수있다.

 

pc1]

telnet 192.168.10.254

username : admin

password : router#

enable 

 

isp]

ISP(config)#line vty 0 4
ISP(config-line)#login
% Login disabled on line 226, until 'password' is set //패스워드 지정해줘라
% Login disabled on line 227, until 'password' is set
% Login disabled on line 228, until 'password' is set
% Login disabled on line 229, until 'password' is set
% Login disabled on line 230, until 'password' is set
ISP(config-line)#password router#
ISP(config-line)#login

 

로컬하면 admin 패스워드를 물어보고

아니면 안에거를 물어본다.

 

ISP(config-line)#do show line
   Tty Typ     Tx/Rx    A Modem  Roty AccO AccI   Uses   Noise  Overruns   Int
*     0 CTY              -    -      -    -    -      0       0     0/0       -
    225 AUX   9600/9600  -    -      -    -    -      0       0     0/0       -
    226 VTY              -    -      -    -    -      1       0     0/0       -
    227 VTY              -    -      -    -    -      0       0     0/0       -
    228 VTY              -    -      -    -    -      0       0     0/0       -
    229 VTY              -    -      -    -    -      0       0     0/0       -
    230 VTY              -    -      -    -    -      0       0     0/0       -

Line(s) not in async mode -or- with no hardware support: 
1-224

 

225,226,227,228,229 는 절대 채번 방식 번호이다.

VTY 0 4 를 한 이유는 상대 채번 방식을 쓰기때문에.

VTY는 telnet접속하는 단자

 

 

##ISP에서 192.168.10.0 네트워크만 허용해주고 나머지는 다 막자. telnet은 다 허용해주자.

ISP]

ISP(config-line)#access-list 11 permit 192.168.10.1 0.0.0.0  //이거만 딱 지정

ISP(config)#access-list 11 deny any //묵시적으로 생략되지만 써주는게 좋다.
ISP(config)#line vty 0 4 //라인에서 
ISP(config-line)#access-class 11 in

 

pc2]

PC2#telnet 1.1.12.5
Trying 1.1.12.5 ... 
% Connection refused by remote host //막힌거 확인 가능

 

ISP]

ISP#show ip access-list
Standard IP access list 1
    20 permit 1.1.30.0
    10 permit 192.168.10.0
Standard IP access list 11
    10 permit 192.168.10.1
    20 deny   any (1 match)

 

 

##넘버드를 네임드로 바꿔보자

ISP(config)#ip access-list standard PC1_ONLY
ISP(config-std-nacl)#permit host 192.168.10.1    
ISP(config-std-nacl)#deny any

 

ISP(config)#line vty 0 4
ISP(config-line)#no access-class 11 in //아까거 지워주고
ISP(config-line)#access-class PC1_ONLY in 

ISP(config-line)#exit
ISP(config)#no access-list 11 //아까거 지워주고22

 

##번호를쓰는 액세스 리스트로 구름에서 isp로 접근하는 bogon 주소를 막아보세요.

ISP(config)#no access-list 11
ISP(config)#access-list 22 deny 10.0.0.0 0.255.255.255
ISP(config)#access-list 22 deny 172.16.0.0 0.15.255.255
ISP(config)#access-list 22 deny 192.168.0.0 0.255.255.255
ISP(config)#access-list 22 permit any

ISP(config)#int f1/0
ISP(config-if)#ip access-group 22 in

 

##이걸 네임드 NO_BOGON 으로 다시 바꿔보세요

//먼저 넘버드 삭제해주고

no ip access-group 22 in

no access-list 22

 

ISP(config)#ip access-list standard NO_BOGON 
ISP(config-std-nacl)#deny 10.0.0.0 0.255.255.255
ISP(config-std-nacl)#deny 172.16.0.0 0.15.255.255 
ISP(config-std-nacl)#deny 192.168.0.0 0.255.255.255
ISP(config-std-nacl)#permit any

ISP(config-std-nacl)#int f1/0
ISP(config-if)#ip access-group NO_BOGON in 

 

## ISP에서 192.168.10.0 와 1.1.30.0를 네임드(INSIDE) 표준 엑세스 리스트로 NAT로 돌리시오

ISP(config)#ip access-list standard INSIDE
ISP(config-std-nacl)#permit 192.168.10.0 0.0.0.255

ISP(config-std-nacl)#permit 1.1.30.0 0.0.0.255
ISP(config-std-nacl)#exit    

ISP(config)#ip nat inside source list INSIDE interface f1/0 overload


ISP(config)#int range f0/0 - 1
ISP(config-if-range)#ip nat inside
ISP(config-if-range)#int f1/0
ISP(config-if)#ip nat outside

 

//isp에서 nat를 돌게 하는이유 구름이 랜카드이기 때문 static으로 디폴트 잡아주고 이 포트에서 nat되어 나가게끔해줘야 

실무에선 구름에서 프로토콜이 돌기때문에 nat를 돌릴필요가 없다 ㅎㅎ

 

##pc1과 pc2에서 이더넷으로 ping날려보기
ISP(config)#int f1/0
ISP(config-if)#no ip access-group NO_BOGON in //일단 필터링한거 지워주고 //안지워진다..;';//다시 껐다켜서 지우니까 지워짐;;

그럼 핑날아간다 //근데 난 안날아간다;;;//지워주면 날아간다;;

 

 

 

## R2에 nat돌리기

R2

R2(config)#ip access-list standard INSIDE
R2(config-std-nacl)#permit 1.1.30.0 0.0.0.255

R2(config)#ip nat inside source list INSIDE int f0/1 overload
R2(config)#int f0/0
R2(config-if)#ip nat inside

R2(config-if)#int f1/0
R2(config-if)#ip nat outside

 

//이렇게 되면 R2안쪽에있는 1.1.30.0 대역은 isp에게 알려주면 안된다!!

router rip에서 no net 1.0.0.0 하게되면 R2 f0/1 대역 네트워크도 못보내준다....

그렇다면? distribute-list prefix 를 써보자

R2(config-if)#router rip // rip대역에서 

R2(config-router)#distribute-list prefix NO_30 out //rip에는 NO_30 분배하는 클래스 만들고. //R2에서 ISP로 보내는거니까 out을 쓴다.

R2(config-router)#ip prefix-list NO_30 deny 1.1.30.0/24 // 그 NO_30은 1.1.30.0/24을 거부하는 클래스이다.

R2(config-router)#permit 0.0.0.0/0 le 32  //★ prefix에선 이게 any다. 와일드카드로 총 32비트가 모든 범위니까
 //0비트~32비트 와일드카드 0000 255.255.255.255
//이거 안해주면 R2옆에 서버 달릴때 막혀버림..

//ex)
//1.1.10.0/24 ge 24 //는 24~32bit까지 ge는 이상(grater)

 

===또는 prefix를 access-list로 바꿀 수 있다.===

R2(config)#router rip
R2(config-router)#no  distribute-list prefix NO_30 out
R2(config-router)#distribute-list NO_30 out
R2(config-router)#ip access-list standard NO_30
R2(config-std-nacl)#deny 1.1.30.0 0.0.0.255
R2(config-std-nacl)#permit any

=======================================

 

이 상태에서 pc2에서 10.0.0.1 로 핑 날려보면 안될거다

왜냐면 1.1.12.4 네트워크대역은 isp가 모른다. 


ISP#config ter
ISP(config)#ip access-list standard INSIDE 
ISP(config-std-nacl)#no 20
ISP(config-std-nacl)#20 permit host 1.1.12.6

 

pc2에서 10.0.0.1 ping날려주면 성공

 

isp]

clear mac

clear arp

 

show ip route 하면

1.1.30.0 가 없어야한다.

 

728x90

댓글