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

Secured DHCP + NATP 실습 23.03.13

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

NAT 목적( 참조 굿bbb https://sys-techlog.tistory.com/49?category=916650)

 

-공인 IP 절약

EX) 1000대의 PC가 있다면 공인 IP 주소가 1000개 필요하다 하지만 NAT를 사용하면 공인 IP 주소 1개만 있어도 1000개의 PC를 사용할 수 있다.

 

-네트워크 보안

NAT 를 사용하면 내부 IP 를 외부에서 알수가 없다.

 

-효과적인 주소 할당

사설 IP 주소를 사용하면 관리자가 원하는 대로 네트워크를 할당할 수 있다. 효과적인 축약이 가능해져서 라우팅 네트워크 성능 향상,장애처리가 쉽다.

 

R1]

R1#confi ter

R1(config-if)#no ip domain lookup
R1(config)#line c 0
R1(config-line)# logg sy
R1(config-line)# exec-timeout 0
R1(config-line)#line vty 0 4

R1(config)#int f0/0
R1(config-if)#no shut    

R1(config)#int f0/0.10
R1(config-subif)#enc dot 10
R1(config-subif)#ip add 192.168.10.1 255.255.255.128

R1(config-subif)#int f0/0.20
R1(config-subif)#enc dot 20
R1(config-subif)#ip add 192.168.10.129 255.255.255.128

 

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

★int f0/0.10 과 int f0/0.20 에 encapsulation dot1q 10 20을 해주는 이유?

참조 : https://www.connecteddots.online/resources/cisco-reference/configuring-IP-routing-on-a-LAN-subinterface-is-only-allowed-if-that-subinterface-is-already-configured-as-part-of-an-IEEE-802.10-IEEE%20802.1Q-or-ISL-VLAN

안해주고 ip add 를 넣어주면 이런 오류가 뜬다.

% Configuring IP routing on a LAN subinterface is only allowed if that 
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q, 
or ISL vLAN.

이 오류 메시지는 언제 나타납니까?

이 오류 메시지는 Layer 3 인터페이스의 하위 인터페이스에서 IP 주소를 구성하려고 시도하는 동안 나타납니다.

이 오류 메시지는 무엇을 의미합니까?

이 오류 메시지는 하위 인터페이스에 대한 IP 주소를 구성하기 전에 하위 인터페이스를 VLAN에 할당해야 함을 나타냅니다.

이 오류의 가장 일반적인 발생은 무엇입니까?

새 하위 인터페이스가 생성된 후 즉시 하위 인터페이스에 대한 IP 주소를 구성하고 싶은 유혹을 느낄 수 있습니다. 그러나 먼저 하위 인터페이스에 대한 VLAN ID를 지정하지 않고는 하위 인터페이스에서 IP 주소를 구성할 수 없습니다.

 

위의 예에서 새 하위 인터페이스(gi0/0.1)가 생성됩니다. 하위 인터페이스를 생성한 직후 하위 인터페이스에 IP 주소(10.0.0.1 /24) 구성을 시도합니다.

오류 메시지는 IP 주소를 구성하기 전에 하위 인터페이스를 VLAN에 할당해야 함을 나타냅니다.

해결책

이 오류에 대한 해결책은 IP 주소를 구성하기 전에 먼저 원하는 VLAN에 하위 인터페이스를 할당하는 것입니다. 캡슐화 명령을 사용하여 인터페이스를 원하는 VLAN에 할당 할 수 있습니다 .

이 예에서는 encapsulation dot1q 10 명령을 사용하여 하위 인터페이스 gi0/0.1을 VLAN 10에 할당합니다 . 하위 인터페이스가 VLAN에 할당되면 하위 인터페이스에서 IP 주소를 구성할 수 있습니다.

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

 


R1(config-subif)#int f0/1
R1(config-if)#mac-add 1234.1234.1234
R1(config-if)#no shut
R1(config-if)#ip add dhcp

R1(config-if)#ip dhcp pool NET0
R1(dhcp-config)#update arp //내가 뿌린 ip의 mac정보를 기록하겠다.
R1(dhcp-config)#network 192.168.10.0 /25
R1(dhcp-config)#lease 8
R1(dhcp-config)#default-router 192.168.10.1 
R1(dhcp-config)#dns-server 168.126.63.1 8.8.8.8
R1(dhcp-config)#class 10
R1(config-dhcp-pool-class)#address range 192.168.10.2 192.168.10.126

//DHCP의 사용자 클래스 기능을 활용하여 특정 컴퓨터들에만 IP 구성정보를 임대해 주는 것이 가능합니다.

- 필터 기능을 통해서 필터링 할 수 도 있습니다.


R1(config-dhcp-pool-class)#ip dhcp pool NET128
R1(dhcp-config)#update arp //내가 뿌린 ip의 mac정보를 기록하겠다.
R1(dhcp-config)#network 192.168.10.128 /25
R1(dhcp-config)#lease 8
R1(dhcp-config)#default-router 192.168.10.129
R1(dhcp-config)#dns-server 168.126.63.1 8.8.8.8
R1(dhcp-config)#class 128
R1(config-dhcp-pool-class)#address range 192.168.10.130 192.168.10.254

//194.139.10.123/25

/25는 서브넷 마스크가 25bit라는 의미로 255.255.255.128이 된다.

이때 호스트에 IP를 할당할 수 있는 범위가 [0~127], [128~255]가 되고, 

네트워크는 [194.139.10.0], [194.139.10.128]이기에 2개로 나누어지게 된다.



결국 194.139.10.7/25가 속한 네트워크는 194.139.10.0/25 대역에 속하게 되며, 

다른 서브넷팅 된 네트워크와는 라우터를 통하여서만 통신할 수 있다.

//


R1(config-dhcp-pool-class)#int f0/0.10
R1(config-subif)#ip dhcp client class-id 10
R1(config-subif)#arp authorized

R1(config-subif)#int f0/0.20
R1(config-subif)#ip dhcp client class-id 128
R1(config-subif)#arp authorized

 

//

arp authorized 를 쓰는 이유?

참조 : https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipaddr/command/ipaddr-cr-book/ipaddr-a1.html#wp9247853340

The arp authorized command disables dynamic ARP learning on an interface.

This command enhances security in public wireless LANs (PWLANs) by limiting the leasing of IP addresses to mobile users and authorized users.

The mapping of IP address to MAC address for an interface can be installed only by the authorized subsystem. Unauthorized clients cannot respond to ARP requests.

 

arp 인증 명령은 인터페이스에서 동적 ARP 학습을 비활성화합니다 . 

이 명령은 IP 주소 임대를 모바일 사용자 및 인증된 사용자로 제한하여 PWLAN(공중 무선 LAN)의 보안을 강화합니다. 

인터페이스에 대한 IP 주소와 MAC 주소의 매핑은 인증된 하위 시스템에서만 설치할 수 있습니다. 

인증되지 않은 클라이언트는 ARP 요청에 응답할 수 없습니다.

//



SW1]


SW1(config-if)#no ip domain lookup
SW1(config)#no ip routing
SW1(config)#line c 0
SW1(config-line)# logg sy
SW1(config-line)# exec-timeout 0
SW1(config-line)#line vty 0 4

SW1#confi ter
SW1(config)#no ip routing

SW1(config)#vlan 10
SW1(config-vlan)#vlan 20
SW1(config-vlan)#exit

SW1(config)#int f1/1
SW1(config-if)#swit mode acc
SW1(config-if)#sw acc vlan 10

SW1(config-if)#int f1/2
SW1(config-if)#swi mode acc
SW1(config-if)#sw acc vlan 20

SW1(config-line)#int f1/9
SW1(config-if)#sw mode tru
SW1(config-if)#sw trun enc dot1

 


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

R1] NAT PT


R1(dhcp-config)#ip access-list standard INGRESS // INGRESS라는 엑세스 리스트 생성
R1(config-std-nacl)#permit 192.168.10.0 0.0.0.127
R1(config-std-nacl)#permit 192.168.128.0 0.0.0.127

 

//

ip access-list standard/extended 를 쓰는 이유??

액세스리스트는 IP 트래픽에 대한 필터링 기능을 수행하며, Standard IP Access List와 Extended IP Access List가 있다.

 

Standard IP Access List는?

송신지의 IP Address만으로 Access를 통제한다. Access List 번호 1-99번을 사용한다.

 

Extended IP Access List는?

송신지의 IP Address, Port Address  도착지의 IP Address,  Port Address를 사용하여 Access를 통제한다. Access List 번호 100-199를 사용한다. 

//


R1(config-std-nacl)#ip nat inside source list INGRESS int f0/1 overload // INGRESS 에 허용된 ip는 f0/1 을 통해 내보내라
 
R1(config)#int f0/0.10 - f0/0.20
R1(config-subif)#ip nat inside // 내부 ip는 inside

R1(config-subif)#int f0/1
R1(config-if)#ip nat outside //외부와 연결된 지점을 outside 

R1(config-if)#ip route 0.0.0.0 0.0.0.0 f0/1 10.0.0.1 // 모르는 경로는 f0/1 인 10.0.0.1 게이트웨이로 나가라

R1(config-if)#do show ip nat translations

 

>>만약 native interface를 주고 싶다면<< ??어떻게 주는거지...??

R1]

(서브인터페이스 생성)
int f0/0.10
encapsulation dot1q 10
ip add 192.168.10.1 255.255.255.0
encapsulation dot1q 10 native // v 10 에 태깅을 안한다 선언
ip nat inside
exit

 

int f0/0.20
encapsulation dot1q 20
ip add 192.168.10.1294 255.255.255.128
ip nat inside
exit

 

SW1]

int r

switchport  native vlan 10

sw 

????

<<

PC1]

PC1#confi ter
Enter configuration commands, one per line.  End with CNTL/Z.
PC1(config)#no ip routing
PC1(config)#no ip domain lookup
PC1(config)#no ip routing
PC1(config)#line c 0
PC1(config-line)# logg sy
PC1(config-line)# exec-timeout 0
PC1(config-line)#line vty 0 4

PC1(config-line)#ip default-gateway 192.168.10.1
PC1(config)#int f0/0
PC1(config-if)#ip add dhcp
PC1(config-if)#no shut

 

PC2]

PC2#confi ter
PC2(config)#no ip routing
PC2(config)#no ip domain lookup
PC2(config)#no ip routing
PC2(config)#line c 0
PC2(config-line)# logg sy
PC2(config-line)# exec-timeout 0
PC2(config-line)#line vty 0 4

PC2(config-line)#ip default-gateway 192.168.10.129
PC2(config)#int f0/0
PC2(config-if)#ip add dhcp
PC2(config)#no shut


PC2(config-if)#do ping 192.168.10.129

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.129, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
PC2(config-if)#

728x90

댓글