본문 바로가기

CCNA 기초

ACL(Access List) - Extended Access List


확장 ACL
설정

Router(config)#access-list access-list number {permit | deny} protocol source-address source-wildcard [operator port] destination-address destination-wildcard [operator port] [establish] [log]

- Access-list number는 100-199, 2000-2699범위 내의 숫자 사용
- Permit | deny는 지정된 어드레스를 차단하는지 허용하는지 여부를 나타냄
- Protocol은 IP, TCP, UDP, ICMP, GRE, IGRP이다.
- Source와 destination address는 각각 송신지 및 수신지 주소이다.
- 와일드 카드 마스크는 0은 일치, 1은 무시를 나타낸다.
- Operator port는 lt(less than), gt(greater than), eq(equal to), neq(not equal to)와 프로토콜 번호이다.
- Establish는 인바운드 TCP에 대해서만 사용
- Log는 콘솔로 로깅 메시지 보냄

- 참고
ICMP (Internet Control Message Protocol)
ICMP 는 호스트 서버와 인터넷 게이트웨이 사이에서 메시지를 제어하고 에러를 알려주는 프로토콜로서 RFC 792에 정의되어있다. ICMP는 IP 데이터그램을 사용하지만, 메시지는 TCP/IP 소프트웨어에 의해 처리되며, 응용프로그램 사용자에게 직접 분명하게 보이지는 않는다. 일례로서, ping 명령어는 인터넷 접속을 테스트하기 위해 ICMP를 사용한다.

TCP (Transmission Control Protocol)
TCP[티 씨피]는 인터넷상의 컴퓨터들 사이에서 데이터를 메시지의 형태로 보내기 위해 IP와 함께 사용되는 프로토콜이다. IP가 실제로 데이터의 배달처리를 관장하는 동안, TCP는 데이터 패킷을 추적 관리한다 (메시지는 인터넷 내에서 효율적인 라우팅을 하기 위해 여러 개의 작은 조각으로 나뉘어지는데, 이것을 패킷이라고 부른다).

예 를 들면, HTML 파일이 웹 서버로부터 사용자에게 보내질 때, 서버 내에 있는 TCP 프로그램 계층은 파일을 여러 개의 패킷들로 나누고, 패킷 번호를 붙인 다음, IP 프로그램 계층으로 보낸다. 각 패킷이 동일한 수신지 주소(IP주소)를 가지고 있더라도, 패킷들은 네트웍의 서로 다른 경로를 통해 전송될 수 있다. 다른 한쪽 편(사용자 컴퓨터 내의 클라이언트 프로그램)에 있는 TCP는, 각 패킷들을 재조립하고, 사용자에게 하나의 완전한 파일로 보낼 수 있을 때까지 기다린다.

TCP 는 연결지향 프로토콜이라고 알려져 있는데, 이것은 메시지들이 각단의 응용 프로그램들에 의해 교환되는 시간동안 연결이 확립되고 유지되는 것을 의미한다. TCP는 IP가 처리할 수 있도록 메시지를 여러 개의 패킷들로 확실히 나누고, 반대편에서는 완전한 메시지로 패킷들을 재조립할 책임이 있다. OSI 통신모델에서, TCP는 4계층인 트랜스포트 계층에 속한다.

UDP (User Datagram Protocol)
UDP[유 디피]는 IP를 사용하는 네트웍 내에서 컴퓨터들 간에 메시지들이 교환될 때 제한된 서비스만을 제공하는 통신 프로토콜이다. UDP는 TCP의 대안이며, IP와 함께 쓰일 때에는 UDP/IP라고 표현하기도 한다. TCP와 마찬가지로 UDP도 한 컴퓨터에서 다른 컴퓨터로 데이터그램이라고 불리는 실제 데이터 단위를 받기 위해 IP를 사용한다. 그러나 UDP는 TCP와는 달리, 메시지를 패킷(데 이터그램)으로 나누고, 반대편에서 재조립하는 등의 서비스는 제공하지 않으며, 특히 도착하는 데이터 패킷들의 순서를 제공하지 않는다. 이 말은 UDP를 사용하는 응용프로그램은, 전체 메시지가 올바른 순서로 도착했는지에 대해 확인할 수 있어야한다는 것을 의미한다. 교환해야할 데이터가 매우 적은(그러므로 재조립해야할 메시지도 매우 적은) 네트웍 응용프로그램들은 처리시간 단축을 위해 TCP 보다 UDP를 더 좋아할 수 있다. 일례로 TFTP는 TCP 대신에 UDP를 사용한다.

UDP는 IP 계층에서 제공되지 않는 두 개의 서비스를 제공하는데, 하나는 다른 사용자 요청을 구분하기 위한 포트 번호와, 도착한 데이터의 손상여부를 확인하기 위한 체크섬 기능이다.

OSI 통신 모델에서, UDP는 TCP와 마찬가지로 4계층인 트랜스포트 계층에 속한다.

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

PC 한대 설정

확장 Access list를 적용하여 192.168.1.2와 FTP접근을 하지 못하도록 하시오.



Router 0 설정

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int fa 0/0
Router(config-if)#ip add 192.168.2.1 255.255.255.0
Router(config-if)#no sh
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#int fa 0/1
Router(config-if)#ip add 192.168.1.1 255.255.255.0
Router(config-if)#no sh
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

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

Server 0 의 설정





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

PC 0 설정

Command Prompt
PC>ping 192.168.2.2

Pinging 192.168.2.2 with 32 bytes of data:

Request timed out.
Reply from 192.168.2.2: bytes=32 time=12ms TTL=127
Reply from 192.168.2.2: bytes=32 time=13ms TTL=127
Reply from 192.168.2.2: bytes=32 time=11ms TTL=127

Ping statistics for 192.168.2.2:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 11ms, Maximum = 13ms, Average = 12ms

Web Browser


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

확장 ACL 적용
- Router 0


Router#conf t
Router(config)#access-list 100 deny tcp 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255 eq www
Router(config)#int fa 0/0
Router(config-if)#ip access-group 100 out
Router(config-if)#end
%SYS-5-CONFIG_I: Configured from console by console

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

설정 확인


Router 0
Router#show access-lists
Extended IP access list 100
    deny tcp 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255 eq www

PC0
Command Prompt
PC>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.2.2:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

Web Browser





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

PC 두대 설정

확장 Access list를 적용하여 192.168.1.0/24 네트워크 대역의 호스트들의 FTP접근을 제어하시오.




Router 0 의 설정

장비 추가


Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int fa 0/0
Router(config-if)#ip add 192.168.2.1 255.255.255.0
Router(config-if)#no sh
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#int fa 0/1
Router(config-if)#ip add 192.168.1.1 255.255.255.0
Router(config-if)#no sh
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit

Router(config)#do show ip int brief
Interface               IP-Address      OK?   Method Status                       Protocol
FastEthernet0/0     192.168.2.1        YES   manual up                            up
FastEthernet0/1     192.168.1.1        YES   manual up                            up
Ethernet0/0/0        unassigned      YES   manual administratively down down
Vlan1                   unassigned      YES   manual administratively down down

Router(config)#int ethernet 0/0/0
Router(config-if)#ip add 192.168.3.1 255.255.255.0
Router(config-if)#no sh
%LINK-5-CHANGED: Interface Ethernet0/0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0/0, changed state to up

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

확장 ACL 적용 - Router 0

Router#conf t
Router(config)#access-list 100 deny tcp 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255 eq www
- 192.168.1.0 네트워크 대역을 192.168.2.0 네트워크 대역에 www 접속하는 것을 제한한다.
Router(config)#access-list 100 permit tcp 192.168.3.0 0.0.0.255 192.168.2.0 0.0.0.255 eq www
- 192.168.3.0 네트워크 대역을 192.168.2.0 네트워크 대역에 www 접속하는 것을 허용한다.
Router(config)#access-list 100 permit ip any any
- 제한한 네트워크 대역을 제외한 모든 네트워크 대역을 허용한다.
Router(config)#int fa 0/0
Router(config-if)#ip access-group 100 out - interface 0/0으로 나가는 192.168.1.0의 네트워크 대역 (을 제한한다.)
Router(config-if)#end
%SYS-5-CONFIG_I: Configured from console by console

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

설정 확인

Router 0
Router#show access-list
Extended IP access list 100
    deny tcp 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255 eq www
    permit tcp 192.168.3.0 0.0.0.255 192.168.2.0 0.0.0.255 eq www
    permit ip any any
Router#show ip int brief
Interface                IP-Address      OK?   Method Status                      Protocol
FastEthernet0/0      unassigned      YES   manual up                           up
FastEthernet0/1      unassigned      YES   manual up                           up
Ethernet0/0/0          192.168.3.1       YES   manual up                            up
Vlan1                    unassigned      YES   manual administratively down down

PC0 확인
Command Prompt
PC>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:

Reply from 192.168.2.2: bytes=32 time=17ms TTL=127
Reply from 192.168.2.2: bytes=32 time=12ms TTL=127
Reply from 192.168.2.2: bytes=32 time=12ms TTL=127
Reply from 192.168.2.2: bytes=32 time=13ms TTL=127

Ping statistics for 192.168.2.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 12ms, Maximum = 17ms, Average = 13ms

Web Browser - www 접속만 제한하기 때문에 ping은 가게 된다. 



PC1 확인
Command Prompt
PC>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:

Reply from 192.168.2.2: bytes=32 time=12ms TTL=127
Reply from 192.168.2.2: bytes=32 time=13ms TTL=127
Reply from 192.168.2.2: bytes=32 time=11ms TTL=127
Reply from 192.168.2.2: bytes=32 time=13ms TTL=127

Ping statistics for 192.168.2.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 11ms, Maximum = 13ms, Average = 12ms

Web Browser


- 참고
pc0, pc1은 모두 서버에 ping은 가지만 pc0의 경우 www 접속이 차단되었기 때문에 www 접속은 되지 않고,
pc1 및 다른 ip대역은 모두 www 접속을 허락했기 때문에 모두 접속이 된다.



'CCNA 기초' 카테고리의 다른 글

Overload NAT  (0) 2008.12.05
Dynamic NAT(Network Address Translation)  (0) 2008.12.05
Static NAT(Network Address Translation)  (0) 2008.12.05
ACL(Access List) - Standard Access List  (0) 2008.12.05
WAN - Frame Relay  (0) 2008.12.04
WAN (Wide Area Network) - PPP & HDLC  (0) 2008.12.04