一、首先PC需要启用DHCP获取IP地址
二、配置路由器的接口IP
三、配置DHCP server
R1(中继)配置如下:
dhcp enable
interface GigabitEthernet0/0/0
ip address 10.1.1.254 255.255.255.0
dhcp select relay
dhcp relay server-ip 12.1.1.2
interface GigabitEthernet0/0/1
ip address 12.1.1.1 255.255.255.0 #和服务器相连接口的IP,同一网段
interface GigabitEthernet0/0/2
ip address 20.1.1.254 255.255.255.0
dhcp select relay
dhcp relay server-ip 12.1.1.2
R2(服务器)配置如下:
dhcp enable
ip pool 10
gateway-list 10.1.1.254
network 10.1.1.0 mask 255.255.255.0
static-bind ip-address 10.1.1.10 mac-address 5489-984d-804d #PC4的IP和MAC地址绑定
dns-list 10.10.10.10
ip pool 20
gateway-list 20.1.1.254
network 20.1.1.0 mask 255.255.255.0
interface GigabitEthernet0/0/1
ip address 12.1.1.2 255.255.255.0
dhcp select global
ip route-static 10.1.1.0 255.255.255.0 12.1.1.1
ip route-static 20.1.1.0 255.255.255.0 12.1.1.1
dis ip routing-table查看配置的两条路由
dis ip pool name 10 used查看地址池10已用的IP地址
结果验证:
本文出自 “互联互通” 博客,请务必保留此出处http://jschinamobile.blog.51cto.com/11464420/1917352
原文地址:http://jschinamobile.blog.51cto.com/11464420/1917352