Network Address Translation(NAT)은 2개의 네트워크를 연결하는 라우터에서만 설정이 가능하다.프라이빗 어드레스(Private Address)나 비공인 IP Address를 사용하는 내부 네트워크의 트래픽이 다른 외부 네트워크에 패킷을 전송하기 전에 공인 IP 어드레스로 변환 시켜야 한다.
이 어드레스 변환처리는 변환이 필요한 장소의 라우터 에 NAT를 설정하여 라우팅과 연동시킨다. 여기서 다룰 시스코 IOS의 NAT는 RFC 1631을 지원한다. 물론 CISCO IOS는 NAT를지원하는 소프트 웨어야 한다.
1 사용되는 용어
NAT기능이 내장된 라우터를 인터넷과 연결되는 부분에 설치하면 내부 보안 및 공인 IP Address 부족을 해결할 수 있다. 따라서이 장비를 이용하면 효과적일 것이다.
-내부(inside) 어드레스 변환의 대상이 되는 내부 사설 네트워크 군이다.
-외부(outside) 다른 네트워크를 의미한다. 통상적으로 인터넷을 의미한다.
-내부 로컬 IP 어드레스(Inside Local IP Address) 내부네트워크의 호스트에 부여되는 사설 IP 어드레스로서 내부적으로 중복되지않는 어드레스다. 비공인 IP를 사용토록 권장한다. 이 어드레스는 외부쪽(인터넷)으로 라우팅 되지 않는다. 외부쪽에서 라우팅이 되더라도 이 어드레스는 실제로는 타조직에 이미 할당된 어드레스다. 따라서 프라이빗 어드레스 사용을 권장한다.
-내부 글로벌 IP 어드레스(Inside Global IP Address) 내부 호스트의 IP 어드레스와 대응되는 외부의 공인 IP 어드레스이다. 내부 사용자의 IP 어드레스가 이 글로벌(공인) 어드레스로 변환되어 나간다. 이 어드레스는 인터넷에서유일한 어드레스여야 한다.
-단순 변환 엔트리(Simple Translation Entry) 기존 IP 어드레스와 다른 IP 어드레스를 대응시키는 변환 테이블의 엔트리이다.
-확장 변환 엔트리(Extended Translation Entry) IP 어드레스와 포트번호 쌍을 대응시키는 변환 테이블의 엔트리이다.
2 사용되는 주요 기능
-스태틱 어드레스 변환(Static Address Translation) 내부 로컬 어드레스와 글로벌 어드레스를 1대 1로 매핑하여 설정할 수 있다.
-다이나믹 소스 어드레스 변환(Dynamic Source Address Translation) 내부 로컬 어드레스와 글로벌 어드레스의 매핑을 동적으로 작성할 수 있다. 글로벌어드레스에 할당된 어드레스는 어드레스 풀(Address pool)에 저장한다. 로컬어드레스가 자신의 소스어드레스를 어드레스 풀에 있는 글로벌 어드레스로 변환시킨다. 그리고 변화된 어드레스는 변환 테이블 엔트리에 등록된다.
-다이나믹 포트 변환(Dynamic Port Translation) 글로벌 어드레스 풀에 있는 어드레스를 절약하기 위해 TCP또는 UDP의 소스포트를 사용해서 변환할 수 있다. 여러개의 로컬 어드레스가 동일한 그로벌 IP 어드레스를 사용하더라도 포트 번호로 구분할 수 있다. 따라서 변환이 필요할 때에는 Berkeley Standard Distribution의 협정에 따라서 오리지널과 같은 영역(1-->511, 512-->1023,1024-->4999,5000-->65535)에 있는 새로운 포트 번호를 선택한다.
-도착지 어드레스 로타리 변환(Destination Address Rotary Translation) 다이나믹 도착지 변환은 외부에서 내부로 특정 트래픽을 통과하도록 설정할 수 있다. 매핑이 설정되면 액세스리스트의 어드레스에 있는 매치되는 도착지 어드레스는 로컬 풀에 있는 어드레스로 치환된다. 이 어드레스의 할당에는 외부에서 내부로 새로운 커넥션이 확립될 때만 라운드 로빈 방식으로 할당된다.
3 설정 커맨드 -인터페이스 설정 커맨드 커맨드 : ip nat { inside | outside } 설 명 : 인터페이스 내부인지 외부인지 표시할 필요가 있다. 표시된 인터페이스에 속한 패킷만이 변환의 대상이 된다.
설 명 : 최초의 커맨드는 다이나믹 변환을 설정하는 커맨드이다. 이 간단한 엑세스 리스트에 해당하는 어드레스가 있으면 지정된 풀에서 할당된 글로벌 어드레스를 사용해서 변환한다, 옵션의 키워드를 사용해서 UDP와 TCP
의 포트 변환도 가능하다. overload라는 옵션을 주게 되면 NAT Table은 Extended entry를 가지게 됩니다. 그것은 옵션을 주기 않게 되면 내부 IP 하나당 외부 IP 하나씩 할당을 받아서 나가는데 overload 옵션을 주게 되면 포트를 가지고 나갑니다.. 하나의 IP를 가지고 여려사람이 이용할 수 있겠죠....
다음 커맨드는 스태틱 변환을 설정하는 커맨드다. [ 내부 도착지 어드레스를 변환을 가능하게 한다.]
커맨드 : ip nat inside destination { list < acl > pool < name > | static < global-ip > < local-ip> } 설 명 : 이 커맨드는 소스 변환 커맨드와 유사하다. 다이나믹 변환과 같이 풀은 로컬 타입으로 한다.
[ 외부 소스 어드레스의 변환을 가능하게 한다.]
커맨드 : ip nat outside source { list < acl > pool < name > | static < global-ip > < local-ip >} 설 명 : 최초 커맨드(list...pool..)는 다이내믹 변환을 가능하도록 설정한다. 패킷의 어드레스가 이 간단한 엑세스 리스트에 있는 어드레스와 매칭이 되면 지정된 풀 에서 할당된 로컬 어드레스를 사용해서 변환시킨다.
두번째 커맨드 static는 스태틱 변환을 설정하는 커맨드이다.
[ 변환 타임아웃(timeout)을 설정한다.]
커맨드 : ip nat translation timeout < seconds > ip nat translation udp-timeout <seconds> ip nat translation dns-timeout <seconds> ip nat translation tcp-timeout <seconds> ip nat translation finrst-timeout <seconds>
설 명 : 다이나믹 변환은 내부 사용자가 사용하지 않은 상태로 일정시간이 경과되면 변환 테이블의 해당 엔트리
를 타임아웃시킨다. 포트 변환이 설정되어 있지 않을때에 변환 테이블의 엔트리는 24시간 후에 타임아웃된다.
[ Exec 커맨드 ]
커맨드 : show ip nat translation [ verboss ] 설 명 : 액티브한 변환을 확인한다.
커맨드 : show ip nat statics 설 명 : 변환 통계를 확인한다.
커맨드 : clear ip nat translation * 설 명 : 전 다이나믹 변환을 해제한다.
커맨드 : clear ip nat translation < global-ip > 설 명 : 단순한 다이나믹 변환을 해제한다.
커맨드 : clear ip nat translation < global-ip > < local-ip > < proto > < global-port > < local-port > 설 명 : 특정 다이나믹 변환을 해제한다.
커맨드 : debug ip nat [ <list> ] [ detailed ] 설 명 : 디버그
[ config 예1 ]
라우터 조건 : Version : 11.2(9) 이상 ,메모리 : 8M 이상(C1000 시리즈인 경우) router#sh ver - 먼저 버전 확인
Cisco Internetwork Operating System Software IOS (tm) 1005 Software (C1005-BNSY-M), Version 11.2(9), RELEASE SOFTWARE (fc1) Copyright (c) 1986-1997 by cisco Systems, Inc. Compiled Mon 22-Sep-97 21:53 by ckralik Image text-base: 0x02004000, data-base: 0x023CB294
ROM: System Bootstrap, Version 5.3.2(9) [vatran 9], RELEASE SOFTWARE (fc1) BOOTFLASH: 1000 Bootstrap Software (C1000-RBOOT-R), Version 10.3(9), RELEASE SOF TWARE (fc1)
router uptime is 2 hours, 17 minutes System restarted by power-on System image file is "flash:c1005-bnsy-mz.112-9", booted via flash
cisco 1000 (68360) processor (revision @) with 7680K/512K bytes of memory. Processor board ID 04836644 Bridging software. X.25 software, Version 2.0, NET2, BFE and GOSIP compliant. 1 Ethernet/IEEE 802.3 interface(s) 1 Serial network interface(s) 8K bytes of non-volatile configuration memory. 2048K bytes of processor board PCMCIA flash (Read/Write) Configuration register is 0x2102
2.Cisco 1005 Config 내역
2.Cisco 1005 Config 내역
router#sh config Using 688 out of 7506 bytes ! version 11.2 no service pad service udp-small-servers service tcp-small-servers ! hostname router ! enable secret 5 $1$hhG6$C8XU.Ph/ALfd8bBtOH.zK. enable password router ! ip nat pool cks 210.101.66.182 210.101.66.182 netmask 255.255.255.252 ip nat inside source list 1 pool cks overload ! interface Ethernet0 ip address 200.200.200.254 255.255.255.0 ip nat inside ! interface Serial0 ip address 210.101.66.182 255.255.255.252 ip nat outside encapsulation ppp ! router rip network 200.200.200.0 network 210.101.66.0 ! no ip classless ip route 0.0.0.0 0.0.0.0 210.101.66.181 access-list 1 permit 200.200.200.0 0.0.0.255 ! line con 0 line vty 0 4 password router login ! end
[ config 예2 ]
Bluehill#sh conf Using 1937 out of 32762 bytes ! version 11.2 service timestamps debug datetime localtime service timestamps log datetime localtime no service udp-small-servers no service tcp-small-servers ! hostname router! enable secret 5 $1$m5fp$oTlTNpBGcNvfR2ONCQPqj/ enable password kim ! ip subnet-zero ip nat translation timeout 300 ip nat translation tcp-timeout 300 ip nat pool hansol 210.101.116.1 210.101.116.254 netmask 255.255.255.0 ip nat inside source list 10 pool hansol ip name-server 210.116.254.1 ! interface Ethernet0 ip address 133.10.60.5 255.255.0.0 no ip mroute-cache ip nat inside ! interface Serial0 no ip address no ip mroute-cache encapsulation frame-relay bandwidth 128 shutdown frame-relay lmi-type ansi ! interface Serial0.1 multipoint - F/R PORT 사용 ip address 210.116.246.103 255.255.255.240 ip accounting output-packets no ip mroute-cache ip nat outside frame-relay interface-dlci 700 ! interface Serial1 ip address 210.101.117.34 255.255.255.252 ip accounting output-packets no ip mroute-cache no ip route-cache ip nat outside ! router rip passive-interface Ethernet0 network 133.10.0.0 network 168.126.0.0 network 210.101.116.0 network 210.121.42.0 network 210.121.43.0 distribute-list 77 out Serial0.1 ! ip http server ip http port 90 ip classless ip route 0.0.0.0 0.0.0.0 210.101.117.33 ip route 0.0.0.0 0.0.0.0 168.126.148.49 ip route 133.10.0.0 255.255.0.0 133.10.10.4 ip route 133.20.0.0 255.255.0.0 133.10.10.4 ip route 133.30.0.0 255.255.0.0 133.10.10.4 ip route 210.101.116.0 255.255.255.0 Null0 254 ip route 210.121.42.0 255.255.255.0 Null0 254 ip route 210.121.43.0 255.255.255.0 Null0 254 access-list 10 permit 210.101.116.0 access-list 10 permit 133.10.0.0 0.0.255.255 access-list 66 permit 133.10.0.0 0.0.255.255 access-list 77 permit 210.121.43.0 access-list 77 permit 210.121.42.0 snmp-server community tnldnsrj RW ! line con 0 password blivy line aux 0 transport input all line vty 0 4 password blivy login ! end
예제1) router#sh config Using 709 out of 32762 bytes ! version 11.2 no service password-encryption no service udp-small-servers no service tcp-small-servers ! hostname router ! enable secret 5 $1$UnkP$pEIOM/ZlIw/918ANOS4zm0 ! ip nat pool kt 211.54.83.170 211.54.83.173 netmask 255.255.255.224 ip nat inside source list 1 pool kt_pri overload ip name-server 168.126.63.1 ! interface Ethernet0 ip address 211.54.83.174 255.255.255.224 secondary ip address 168.192.100.254 255.255.255.0 ip nat inside ! interface Serial0 no ip address ip nat outside ! interface Serial1 no ip address shutdown ! ip classless ip route 0.0.0.0 0.0.0.0 Serial0 access-list 1 permit 168.192.100.0 0.0.0.255 ! ! line con 0 line aux 0 line vty 0 4 password suwon login ! end router#
예제2) router#sh conf Using 1417 out of 32762 bytes ! version 11.2 no service password-encryption no service udp-small-servers no service tcp-small-servers ! hostname router ! enable secret 5 $1$7N4H$AVSlVb5dbZxJTsXp8Hmcg/ enable password router ! ip nat pool net-1 210.223.111.6 210.223.111.255 netmask 255.255.255.0 ip nat inside source list 1 pool net-1 overload ip nat inside source static 172.16.211.9 210.223.111.2 ip domain-name kyungdong.co.kr ip name-server 172.16.211.9 ! interface Ethernet0 ip address 172.16.206.11 255.255.255.0 secondary ip address 210.223.111.4 255.255.255.0 ip nat inside ! interface Serial0 ip address 192.168.234.190 255.255.255.252 ip nat outside bandwidth 1544 ! interface Serial1 ip address 172.16.100.1 255.255.255.0 ip nat inside ! router rip redistribute static network 172.16.0.0 ! ip classless ip route 0.0.0.0 0.0.0.0 192.168.234.189 ip route 128.3.2.0 255.255.255.0 172.16.206.12 ip route 172.16.101.0 255.255.255.0 172.16.100.2 ip route 172.16.107.0 255.255.255.0 172.16.100.2 ip route 172.16.108.0 255.255.255.0 172.16.100.2 ip route 172.16.209.0 255.255.255.0 172.16.206.10 ip route 172.16.210.0 255.255.255.0 172.16.206.10 ip route 172.16.211.0 255.255.255.0 172.16.206.10 ip route 172.16.212.0 255.255.255.0 172.16.206.10 access-list 1 permit 172.16.0.0 0.0.255.255 access-list 1 permit 128.3.2.0 0.0.0.255 snmp-server community public RO ! line con 0 line aux 0 line vty 0 4 password router login ! end
예제3) router#sh conf Using 1215 out of 32762 bytes ! version 11.2 no service password-encryption no service udp-small-servers no service tcp-small-servers ! hostname router ! enable secret 5 $1$40jO$hyLEyHgr4FB7uItdw3SXW1 enable password decolan ! ip nat pool dsec 210.217.42.1 210.217.42.100 netmask 255.255.0.0 ip nat inside source list 1 pool dsec overload ip domain-name kornet21.net ip name-server 168.126.63.1 ip name-server 147.47.1.1 ! interface Ethernet0 ip address 210.217.42.1 255.255.0.0 secondary ip address 130.1.3.5 255.255.0.0 ip nat inside ! interface Serial0 ip address 192.168.62.58 255.255.255.252 ip nat outside ip rip authentication mode 0 ! interface Serial1 no ip address shutdown ! ip classless ip route 0.0.0.0 0.0.0.0 192.168.62.57 ip route 130.1.0.0 255.255.0.0 130.1.3.11 ip route 130.3.0.0 255.255.0.0 130.1.3.11 ip route 130.4.0.0 255.255.0.0 130.1.3.11 ip route 130.10.0.0 255.255.0.0 130.1.3.11 access-list 1 permit 130.1.0.0 0.0.255.255 access-list 1 permit 130.2.0.0 0.0.255.255 access-list 1 permit 130.3.0.0 0.0.255.255 access-list 1 permit 130.7.0.0 0.0.255.255 access-list 1 permit 130.4.0.0 0.0.255.255 access-list 1 permit 130.10.0.0 0.0.255.255 ! line con 0 line aux 0 line vty 0 4 password decolan login ! end
예제4) router#sh conf Using 1276 out of 32762 bytes ! version 11.3 service timestamps debug uptime service timestamps log uptime no service password-encryption service udp-small-servers service tcp-small-servers ! hostname router ! enable secret 5 $1$i9vO$MhVhuIF/6NGwDr0kuVXFK0 enable password router ! ip nat pool sm_pri1 210.183.57.64 210.183.57.95 netmask 255.255.255.224 ip nat pool sm_pri 210.113.59.66 210.113.59.126 netmask 255.255.255.192 ip nat inside source list 1 pool sm_pri ip nat inside source list 2 pool sm_pri1 ip nat inside source static 195.7.7.253 210.113.59.65 no ip domain-lookup ! ! ! interface Ethernet0 ip address 195.7.7.254 255.255.255.0 ip nat inside ! interface Serial0 ip address 192.168.239.190 255.255.255.252 ip nat outside no keepalive ! interface Serial1 no ip address shutdown ! ip classless ip route 0.0.0.0 0.0.0.0 Serial0 ip route 195.7.8.0 255.255.255.0 195.7.7.250 ip route 195.7.9.0 255.255.255.0 195.7.7.250 ip route 195.7.10.0 255.255.255.0 195.7.7.250 ip route 195.7.11.0 255.255.255.0 195.7.7.250 ! access-list 1 permit 195.7.7.0 0.0.0.255 access-list 1 permit 195.7.10.0 0.0.0.255 access-list 2 permit 195.7.8.0 0.0.0.255 access-list 2 permit 195.7.9.0 0.0.0.255 access-list 2 permit 195.7.11.0 0.0.0.255 ! line con 0 line aux 0 line vty 0 4 password suwon login ! end
댓글을 달아 주세요