네트워크 장비에 IP를 할당하는 방법은 자동과 수동 2가지로 나눌 수 있다.
Router에서 DHCP service를 올려서 사용할 수 있다.
모든 장비는 C2691 router
Pool name |
DHCP_test |
할당할 네트워크 범위 |
10.10.10.0 /24 |
제외할 IP |
10.10.10.1 ~ 10.10.10.10 |
기본 interface 설정
!R1
conf t
int s1/0
ip add 29.29.12.1 255.255.255.0
no sh
!R2
conf t
int s1/0
ip add 29.29.12.2 255.255.255.0
no sh
int f0/0
ip add 10.10.10.1 255.255.255.0
no sh
-----------------------------------
DHCP 설정
(R1은 DHCP server , R2는 Relay-agent)
!R1
ip dhcp excluded-address 10.10.10.1 10.10.10.10
ip dhcp pool DHCP_test
network 10.10.10.0 255.255.255.0
default-router 10.10.10.1
!R2
int f0/0
ip helper-address 29.29.12.1
여기까지 설정 후에
PC1의 주소를 자동으로 받게 하자
!PC1
conf t
int f0/0
no sh
ip add dhcp <-자동으로 ip할당 받는 명령어
PC1에서 보내는 DHCP discover packet
( IP를 아직 할당 받지 않았기 때문에 Source address가 0.0.0.0 , DHCP discover는 broadcast로 날아가기 때문에 Destination address는 255.255.255.255 )
R2에서 대신해서 R1에게 보내주는 DHCP discover packet
(ip helper-address라는 명령어를 통해 broadcast packet을 unicast로 바꾸어 보낸다)
그런데 IP를 자동으로 받아오지 못한다. 이유는 뭘까?
R1의 Routing table을 살펴보자
10.10.10.1로 Offer packet을 보내야 하는데 Routing table에 이 Network에 대한 정보가 없기 때문이다
Default route로 경로를 만들어주자
!R1
ip route 0.0.0.0 0.0.0.0 29.29.12.2
4개의 Packet을 모두 주고 받아 10.10.10.11이라고 하는 IP를 할당 받았다.
'Network' 카테고리의 다른 글
EIGRP // DUAL 알고리즘과 Query & Reply packet (0) | 2014.06.26 |
---|---|
DHCP 이론 (0) | 2014.06.23 |
Router on a Stick (0) | 2014.06.03 |
VLAN & EtherChannel 실습 (0) | 2014.05.29 |
VLAN 실습 (0) | 2014.05.27 |