DHCP Relay Agent

2022. 11. 28. 18:29Network

DHCP의 IP 동적 할당 방식에는 브로드캐스트 도메인이 동일해야 한다는 문제점이 있습니다.

다른 네트워크 대역이더라도 하나의 서버로 IP를 할당해주는 방식이 바로 DHCP Relay Agent입니다.

 

방화벽이 서버쪽에서 67/udp 클라쪽에서 68/udp가 열려있어야 통신가능합니다.


토폴로지 구성을 해보겠습니다.

목표 구성안

 

 

장비 세팅 시 보안을 위해 사용하지 않는 포트는 모두 닫아줍니다.

그리고 vlan 10,20,30,40을 각각 세팅해주겠습니다.

en
conf t
int ra f 1/0 - 15
sh
switchport mode access
switchport access vlan 10
! auto create vlan 10
int f 1/0
no sh
int f 1/10
no sh
!

 

상위 스위치에 vlan 인터페이스를 만들어 주고 dhcp 서비스를 시작시킵니다.

en
conf t
vlan 10
vlan 20
int vlan 10
ip add 10.1.10.254 255.255.255.0
no sh
int vlan 20
ip add 10.1.20.254 255.255.255.0
no sh
exit

service dhcp

 

상위 스위치 중 DHCP 서버로 설정할 스위치에 DHCP 설정을 합니다.

vlan 셋팅도 역시 해줍니다. 그리고 DHCP Relay Agent로 설정될 스위치와의 통신을 위해 ospf 라우팅 설정합니다.

ip dhcp ex 10.1.10.254
ip dhcp ex 10.1.20.254
ip dhcp ex 10.1.30.254
ip dhcp ex 10.1.40.254
ip dhcp pool vlan10
network 10.1.10.0 255.255.255.0
default 10.1.10.254
dns-server 8.8.8.8
domain-name labs.local
lease 0 8
ip dhcp pool vlan20
network 10.1.20.0 255.255.255.0
default 10.1.20.254
dns-server 8.8.8.8
domain-name labs.local
lease 0 8
ip dhcp pool vlan30
network 10.1.30.0 255.255.255.0
default 10.1.30.254
dns-server 8.8.8.8
domain-name labs.local
lease 0 8
ip dhcp pool vlan40
network 10.1.40.0 255.255.255.0
default 10.1.40.254
dns-server 8.8.8.8
domain-name labs.local
lease 0 8

int f 1/2
no sw
ip add 10.0.0.1 255.255.255.252
no sh
exit
int f 1/0
sw m a
sw a v 10
int f 1/1
sw m a
sw a v 20
ip routing
int lo 0
ip add 1.1.1.1 255.255.255.255
exit
router ospf 1
router-id 1.1.1.1
network 10.0.0.1 0.0.0.0 area 0
network 10.1.10.254 0.0.0.0 area 0
network 10.1.20.254 0.0.0.0 area 0
!

 

DHCP Relay Agent가 될 스위치의 svi에 helper-address 설정을 해서 DHCP서버와 ip를 주고받을 수 있게 설정합니다.

en
conf t
vlan 30
vlan 40
int vlan 30
ip add 10.1.30.254 255.255.255.0
no sh
int vlan 40
ip add 10.1.40.254 255.255.255.0
no sh

int f 1/2
no sw
ip add 10.0.0.2 255.255.255.252
no sh
exit
int f 1/0
sw m a
sw a v 30
int f 1/1
sw m a
sw a v 40
ip routing
int lo 0
ip add 1.1.1.2 255.255.255.255
exit
router ospf 1
router-id 1.1.1.2
network 10.0.0.2 0.0.0.0 area 0
network 10.1.30.254 0.0.0.0 area 0
network 10.1.40.254 0.0.0.0 area 0

int vlan 30
ip helper-address 10.0.0.1
int vlan 40
ip helper-address 10.0.0.1
!

service dhcp

 

모든 스위치 설정이 완료된 후 pc에서 dhcp할당을 받는 명령어를 입력하면
DORA 과정 수행 후 IP가 잘 받아진 모습입니다.

 

1128_Report_SW.txt
0.00MB