hawl 发表于 2013-5-20 08:56:13

cisco路由交换中DHCP的配置方案

1.多lan端口路由器获取IP地址网络拓扑图如下:路由器的配置:router>enablerouter#conf trouter(config)#interface fastethernet 0/0router(config-if)#ip address 192.168.0.1 255.255.255.0router(config-if)#no shutdownrouter(config-if)#exitrouter(config)#interface fastethernet 1/0router(config-if)#ip address 172.16.1.1 255.255.255.0router(config-if)#no shutdownrouter(config-if)#exitrouter(config)#ip dhcp pool 192    /地址池名为192router(dhcp-config)#network 192.168.0.0 255.255.255.0/分配的ip地址段router(dhcp-config)#default-router 192.168.0.1      /分配的默认路由router(dhcp-config)#dns-server 192.168.0.1         /分配的DNS地址router(dhcp-config)#exitrouter(config)#ip dhcp excluded-address 192.168.0.1 192.168.0.5 /排除分配的ip地址
router(config)#ip dhcp pool 172       /地址池名为172router(dhcp-config)#network 172.16.1.0 255.255.255.0    /分配的ip地址段router(dhcp-config)#default-router 172.16.1.1          /分配的默认路由router(dhcp-config)#dns-server 172.16.1.1            /分配的DNS地址router(dhcp-config)#exitrouter(config)#ip dhcp excluded-address 172.16.1.1 172.16.1.5/排除分配的ip地址
客户机开启自动获取ip地址后就可以自动获取ip地址了
2.单个LAN口为不通vlan的主机分配IP地址(单臂路由)即把一个LAN划分为多个LAN端口,这样就容易理解了网络拓扑图如下:路由器配置;(命令就简写吧)router>enablerouter#conf trouter(config)#int fa 0/0router(config-if)#no ip addressrouter(config-if)#no shutrouter(config-if)#int fa 0/0.1router(config-subif)#encapsulation dot1q 1router(config-subif)#ip address 192.168.0.1 255.255.255.0router(config-subif)#int fa 0/0.2router(config-subif)#encapsulation dot1q 2router(config-subif)#ip address 172.16.1.1 255.255.255.0router(config-subif)#int fa 0/0.3router(config-subif)#encapsulation dot1q 3router(config-subif)#ip address 10.10.10.1 255.255.255.0router(config-subif)#exitrouter(config)#ip dhcp pool 192    /地址池名为192router(dhcp-config)#network 192.168.0.0 255.255.255.0/分配的ip地址段router(dhcp-config)#default-router 192.168.0.1      /分配的默认路由router(dhcp-config)#dns-server 192.168.0.1         /分配的DNS地址router(dhcp-config)#exitrouter(config)#ip dhcp excluded-address 192.168.0.1 192.168.0.5 /排除分配的ip地址
router(config)#ip dhcp pool 172       /地址池名为172router(dhcp-config)#network 122.16.1.0 255.255.255.0    /分配的ip地址段router(dhcp-config)#default-router 172.16.1.1          /分配的默认路由router(dhcp-config)#dns-server 172.16.1.1            /分配的DNS地址router(dhcp-config)#exitrouter(config)#ip dhcp excluded-address 172.16.1.1 172.16.1.5/排除分配的ip地址
router(config)#ip dhcp pool 10       /地址池名为10router(dhcp-config)#network 10.10.10.0 255.255.255.0    /分配的ip地址段router(dhcp-config)#default-router 10.10.10.1          /分配的默认路由router(dhcp-config)#dns-server 10.10.10.1            /分配的DNS地址router(dhcp-config)#exitrouter(config)#ip dhcp excluded-address 10.10.10.1 10.10.10.5/排除分配的ip地址
交换机的划分为三个vlan,即vlan1,vlan2,vlan3,与路由器相连的端口设置为TRUNK后,不同vlan中的主机既可以获取相应的ip地址并进行通信了。
3.主机跨路由从DHCP服务端获取ip地址(dhcp中继)网络拓扑图如下:路由器配置:router>enablerouter#conf trouter(config)#int fa 0/0router(config-if)#no ip addressrouter(config-if)#no shutrouter(config-if)#int fa 0/0.1router(config-subif)#encapsulation dot1q 1router(config-subif)#ip address 192.168.0.1 255.255.255.0router(config-subif)#ip helper-address 10.10.10.1router(config-subif)#int fa 0/0.2router(config-subif)#encapsulation dot1q 2router(config-subif)#ip address 172.16.1.1 255.255.255.0router(config-subif)#ip helper-address 10.10.10.1
交换机划分为两个vlan,vlan1和vlan2,其他配置略...
4.三层交换机提供DHCP服务网络拓扑图如下:三层交换机的配置:switch>enableswitch#conf tswitch(config)#vlan 2switch(config-vlan)#exitswitch(config)#vlan 3switch(config-vlan)#exitswitch(config)#int vlan 1switch(config-if)#ip add 192.168.0.1 255.255.255.0switch(config-if)#no shutswitch(config)#exit
switch(config)#int vlan 2switch(config-if)#ip add 172.16.1.1 255.255.255.0switch(config-if)#no shutswitch(config)#exit
switch(config)#int vlan 3switch(config-if)#ip add 10.10.10.1255.255.255.0switch(config-if)#no shutswitch(config)#exit
switch(config)#ip dhcp pool 192    /地址池名为192switch(dhcp-config)#network 192.168.0.0 255.255.255.0/分配的ip地址段switch(dhcp-config)#default-router 192.168.0.1      /分配的默认路由switch(dhcp-config)#dns-server 192.168.0.1         /分配的DNS地址switch(dhcp-config)#exitswitch(config)#ip dhcp excluded-address 192.168.0.1 192.168.0.5 /排除分配的ip地址
switch(config)#ip dhcp pool 172       /地址池名为172switch(dhcp-config)#network 122.16.1.0 255.255.255.0    /分配的ip地址段switch(dhcp-config)#default-router 172.16.1.1          /分配的默认路由switch(dhcp-config)#dns-server 172.16.1.1            /分配的DNS地址switch(dhcp-config)#exitswithc(config)#ip dhcp excluded-address 172.16.1.1 172.16.1.5/排除分配的ip地址
switch(config)#ip dhcp pool 10       /地址池名为10switch(dhcp-config)#network 10.10.10.0 255.255.255.0    /分配的ip地址段switch(dhcp-config)#default-router 10.10.10.1          /分配的默认路由switch(dhcp-config)#dns-server 10.10.10.1            /分配的DNS地址switch(dhcp-config)#exit
二层交换机与三层连接要把相应的端口设置为TRUNK,这样是在vlan1-vlan3中的客户端都可以自动获取ip地址了

心海恋歌 发表于 2013-5-23 03:31:04

男人偷腥时的智商仅次于爱因斯坦!

pgup12 发表于 2013-5-27 17:27:19

帮帮顶顶!!

喜旎果 发表于 2013-6-1 12:40:48

人生重要的不是所站的位置,而是所朝的方向!

高峰之巅 发表于 2013-6-3 11:02:07

恋爱就是无数个饭局,结婚就是一个饭局。

q29191 发表于 2013-6-3 11:54:18

所有刻骨铭心的爱都灵魂游离于床上的瞬间!

sanhutrees 发表于 2013-6-3 15:58:46

男人与女人,终究也只是欲望的动物吧!真的可以因为爱而结合吗?对不起,我也不知道。。
页: [1]
查看完整版本: cisco路由交换中DHCP的配置方案