如何进行cisco 3560 DHCP服务器配置呢?这个问题可能不少朋友都不太清楚。那么现在我们就来分享一位网友的配置经验吧。下面是笔者的总结:有时候要启多个DHCP来工作。那么我们应该怎么做呢。首先我们要把交换端口关闭掉,换成L3的接口。配置上IP地址。再来设置DHCP地址池。我们要让端口f0/1上来的主机分配0网段的IP地址,让f0/2上来的主机分配1网段,那么,我们就应该配置好地址池后,在接口下用到ip help-address 来给客户端的查询指定一个服务地址。详细见配置。以下配置在真实3560上得到通过。
- Switch#sh run 首先我们看下运行中的cisco 3560 DHCP服务器务器清单
- Switch#sh running-config
- Building configuration...
- Current configuration : 1326 bytes
- !
- version 12.2
- no service pad
- service timestamps debug uptime
- service timestamps log uptime
- no service password-encryption
- !
- hostname Switch
- !
- !
- no aaa new-model
- system mtu routing 1500
- ip subnet-zero
- no ip domain-lookup
- !
- !
- !
- !
- !
- !
- !
- !
- !
- spanning-tree mode pvst
- spanning-tree extend system-id
- !
- vlan internal allocation policy ascending
- !
- !
- !
- !
- interface FastEthernet0/1
- shutdown
- !
- interface FastEthernet0/2
- !
- interface FastEthernet0/3
- !
- interface FastEthernet0/4
- !
- interface FastEthernet0/5
- !
- interface FastEthernet0/6
- !
- interface FastEthernet0/7
- !
- interface FastEthernet0/8
- !
- interface FastEthernet0/9
- !
- interface FastEthernet0/10
- !
- interface FastEthernet0/11
- !
- interface FastEthernet0/12
- !
- interface FastEthernet0/13
- !
- interface FastEthernet0/14
- !
- interface FastEthernet0/15
- !
- interface FastEthernet0/16
- !
- interface FastEthernet0/17
- !
- interface FastEthernet0/18
- !
- interface FastEthernet0/19
- !
- interface FastEthernet0/20
- !
- interface FastEthernet0/21
- !
- interface FastEthernet0/22
- !
- interface FastEthernet0/23
- no switchport
- ip address 192.168.100.1 255.255.255.0
- !
- interface FastEthernet0/24
- !
- interface GigabitEthernet0/1
- !
- interface GigabitEthernet0/2
- !
- interface Vlan1
- no ip address
- !
- ip classless
- ip http server
- ip http secure-server
- !
- !
- !
- control-plane
- !
- !
- line con 0
- line vty 0 4
- login
- line vty 5 15
- login
- !
- end
- Switch#conf t
- Switch(config)#int fa 0/1 cisco 3560 DHCP服务器配置中,进入F0/1
- Switch(config-if)#no switchport 关闭L2端口
- Switch(config-if)#ip add 10.0.0.1 255.255.255.0 配置IP地址
- Switch(config-if)#no sh 打开端口
- Switch(config-if)#exi
- Switch(config)#int fa 0/2
- Switch(config-if)#no sw
- Switch(config-if)#no switchport
- Switch(config-if)#no sh
- Switch(config-if)#ip add 10.0.1.1 255.255.255.0
- Switch(config-if)#no sh
- Switch(config-if)#exi
- Switch(config)#ip dhcp pool ccna 设置DHCP组
- Switch(dhcp-config)#network 10.0.0.0 255.255.255.0 地址池
- Switch(dhcp-config)#default-router 10.0.0.254 缺省路由(网关)
- Switch(dhcp-config)#dns-server 202.103.24.68 DNS地址设置
- Switch(dhcp-config)#lease 365 地址租期
- Switch(dhcp-config)#exi
- Switch(config)#ip dhcp pool ccnp
- Switch(dhcp-config)#network 10.0.1.0 255.255.255.0
- Switch(dhcp-config)#default-router 10.0.1.254
- Switch(dhcp-config)#dns-server 202.103.24.68
- Switch(dhcp-config)#lease 365
- Switch(dhcp-config)#exi
- Switch(config)#ip dhcp excluded-address 10.0.0.1 不参与分配的地址
- Switch(config)#ip dhcp excluded-address 10.0.0.254
- Switch(config)#ip dhcp excluded-address 10.0.1.254
- Switch(config)#ip dhcp excluded-address 10.0.1.1
- Switch(config)#exi
- Switch(config)#int fa 0/1
- Switch(config-if)#ip helper-address 10.0.0.1 cisco 3560 DHCP服务器配置中需要指定帮助地址,它将默认转发给8个UDP服务
- Switch(config-if)#exi
- Switch(config)#int fa 0/2
- Switch(config-if)#ip helper-address 10.0.1.1
- Switch(config-if)#exi
- Switch#sh run
- Switch#sh running-config
- Building configuration...
- Current configuration : 1864 bytes
- !
- version 12.2
- no service pad
- service timestamps debug uptime
- service timestamps log uptime
- no service password-encryption
- !
- hostname Switch
- !
- !
- no aaa new-model
- system mtu routing 1500
- ip subnet-zero
- no ip domain-lookup
- ip dhcp excluded-address 10.0.0.1
- ip dhcp excluded-address 10.0.0.254
- ip dhcp excluded-address 10.0.1.254
- ip dhcp excluded-address 10.0.1.1
- !
- ip dhcp pool ccna
- network 10.0.0.0 255.255.255.0
- default-router 10.0.0.254
- dns-server 202.103.24.68
- lease 365
- !
- ip dhcp pool ccnp
- network 10.0.1.0 255.255.255.0
- default-router 10.0.1.254
- dns-server 202.103.24.68
- lease 365
- !
- !
- !
- !
- !
- !
- !
- !
- !
- spanning-tree mode pvst
- spanning-tree extend system-id
- !
- vlan internal allocation policy ascending
- !
- !
- !
- !
- interface FastEthernet0/1
- no switchport
- ip address 10.0.0.1 255.255.255.0
- ip helper-address 10.0.0.1
- !
- interface FastEthernet0/2
- no switchport
- ip address 10.0.1.1 255.255.255.0
- ip helper-address 10.0.1.1
- !
- interface FastEthernet0/3
- !
- interface FastEthernet0/4
- !
- interface FastEthernet0/5
- !
- interface FastEthernet0/6
- !
- interface FastEthernet0/7
- !
- interface FastEthernet0/8
- !
- interface FastEthernet0/9
- !
- interface FastEthernet0/10
- !
- interface FastEthernet0/11
- !
- interface FastEthernet0/12
- !
- interface FastEthernet0/13
- !
- interface FastEthernet0/14
- !
- interface FastEthernet0/15
- !
- interface FastEthernet0/16
- !
- interface FastEthernet0/17
- !
- interface FastEthernet0/18
- !
- interface FastEthernet0/19
- !
- interface FastEthernet0/20
- !
- interface FastEthernet0/21
- !
- interface FastEthernet0/22
- !
- interface FastEthernet0/23
- no switchport
- ip address 192.168.100.1 255.255.255.0
- !
- interface FastEthernet0/24
- !
- Switch#sh arp
- Protocol Address Age (min) Hardware Addr Type Interface
- Internet 10.0.0.2 0 001a.4b58.42a9 ARPA FastEthernet0/1
- Internet 10.0.1.1 - 001e.4a0a.2042 ARPA FastEthernet0/2
- Internet 10.0.0.1 - 001e.4a0a.2041 ARPA FastEthernet0/1
- Internet 192.168.100.1 - 001e.4a0a.2043 ARPA FastEthernet0/23
根据上面的cisco 3560 DHCP服务器配置,现在我们只要连接到f0/1口上,那么客户端分配到的地址将是0网段的地址 ,如果连接到f 0/2口上,那么客户端将分配到1网段的地址。
help-address的说明:help-address 缺省转发的8个udp服务:time37 , tacacs49 , dns53 , boot/dhcp服务器67 , boot/dhcp客户端68 , tftp69 , netbios名字服务137, netbios数据报服务138