R1:服務器
enable config t hostname R1 interface s 0/2/0 ip address 12.1.1.1 255.255.255.0 clock rate 64000 no shutdown interface g 0/0 ip address 192.168.2.1 255.255.255.0 no shutdown exit
R2:網絡
enable config t hostname R2 interface s 0/2/0 ip address 12.1.1.2 255.255.255.0 no shutdown interface g 0/0 ip address 192.168.3.1 255.255.255.0 no shutdown exit
R1:ide
ip route 192.168.3.0 255.255.255.0 12.1.1.2
R2:3d
ip route 192.168.2.0 255.255.255.0 12.1.1.1
R1:code
ip dhcp pool zhulou //定義dhcp地址池名稱爲「zhulou」 network 192.168.2.0 255.255.255.0 //定義動態分配的ip地址範圍 default-router 192.168.2.1 //配置dns服務器地址 dns-server 218.2.135.1 //配置網關地址 ip dhcp pool fulou network 192.168.3.0 255.255.255.0 default-router 192.168.3.1 dns-server 218.2.135.1 exit ip dhcp excluded-address 192.168.2.1 // 排除主樓客戶機網關 ip dhcp excluded-address 192.168.3.1 // 排除輔樓客戶機網關
R2:router
interface g 0/0 ip helper-address 12.1.1.1 //配置輔助尋址,指向DHCP服務器的地址
PC1:server