Cấu hình router Cisco thành DHCP và DHCP relay agent
Mô hình như sau:
Giải thích:
- R1 là DHCP Server
- R3 sẽ chuyển tiếp yêu cầu cấp địa chỉ ip về DHCP Server (IP Helper)
- 3 router đều xài định tuyến động RIP v2
- C1 sẽ nối với card mạng máy thật
Cấu hình trên R1:
Cấu hình trên R2:
Building configuration…
Current configuration : 1047 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
!
!
no ip domain lookup
ip domain name lab.local
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
archive
log config
hidekeys
!
!
!
!
!
!
!
!
interface FastEthernet0/0
description “Noi voi R1”
ip address 192.168.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
description “Noi voi R3”
ip address 10.0.0.2 255.255.255.0
duplex auto
speed auto
!
router rip
version 2
network 10.0.0.0
network 192.168.1.0
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
line vty 0 4
login
!
!
end
Cấu hình trên R3:
Building configuration…
Current configuration : 1024 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
!
!
no ip domain lookup
ip domain name lab.local
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
archive
log config
hidekeys
!
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 172.16.1.1 255.255.255.0
ip helper-address 192.168.1.1
duplex auto
speed auto
!
router rip
version 2
network 10.0.0.0
network 172.16.0.0
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
line vty 0 4
login
!
!
end
– Chỉnh ip động trên máy tính, sau khi nhận ip xong, show trong status ta sẽ thấy DHCP Server 192.168.1.1
– Dùng lệnh show ip dhcp binding để xem các địa chỉ đã cấp cho client:
Chúc bạn thành công!