**SW1**建立vlan10,vlan20,vlan30(命令:[SW1]vlan batch 10 20 30 )
并将端口G0/0/2 G0/0/3 G0/0/4依次加入vlan10 20 30
并配置虚拟网关:int vlan 10 IP add 192.168.10.254 255.255.255.0
int vlan 20 ip add 192.168.20.254 255.255.255.0
int vlan 30 IP add 192.168.30.254 255.255.255.0
进入vlan1 配置IP地址
int vlan 1 IP add 10.10.10.2 255.255.255.0
**R1**:G 0/0/0 口配置IP“10.10.10.1 255.255.255.0”
配置静态路由: ip route-static 192.168.10.0 255.255.255.0 10.10.10.2
ip route-static 192.168.20.0 255.255.255.0 10.10.10.2
ip route-static 192.168.30.0 255.255.255.0 10.10.10.2
然后为R1开启DHCP服务:[R1]dhcp enable
开启数据保存(为了防止设备故障修复后能及时恢复):[R1]dhcp server database enable
然后配置地址池:ip pool 10
gateway-list 192.168.10.254(目标网络网关)
network 192.168.10.0 mask 255.255.255.0(网段配置)
lease day 7 hour 0 minute 0 (配置租期,精确到分钟)
dns-list 8.8.8.8(配置DNS地址)
excluded-ip-address 192.168.10.200 192.168.10.253(200~253此段地址不分配)
然后进入G 0/0/0 口
int g 0/0/0 dhcp select global(开启全局模式)
SW1:[SW1]dhcp enable
int vlan 10 : dhcp select relay
dhcp relay server-ip 10.10.10.1(开启DHCP中继)
int vlan 20 : dhcp select relay
dhcp relay server-ip 10.10.10.1
int vlan 30 : dhcp select relay
dhcp relay server-ip 10.10.10.1
成功
原文:http://blog.51cto.com/13559812/2064321