cisco 3560 DHCP服務器配置代碼明細
如何進行cisco 3560 DHCP服務器配置呢?這個問題可能不少朋友都不太清楚。那么現(xiàn)在我們就來分享一位網(wǎng)友的配置經(jīng)驗吧。下面是筆者的總結(jié):有時候要啟多個DHCP來工作。那么我們應該怎么做呢。首先我們要把交換端口關(guān)閉掉,換成L3的接口。配置上IP地址。再來設(shè)置DHCP地址池。我們要讓端口f0/1上來的主機分配0網(wǎng)段的IP地址,讓f0/2上來的主機分配1網(wǎng)段,那么,我們就應該配置好地址池后,在接口下用到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 關(guān)閉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 設(shè)置DHCP組
- Switch(dhcp-config)#network 10.0.0.0 255.255.255.0 地址池
- Switch(dhcp-config)#default-router 10.0.0.254 缺省路由(網(wǎng)關(guān))
- Switch(dhcp-config)#dns-server 202.103.24.68 DNS地址設(shè)置
- 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服務器配置中需要指定幫助地址,它將默認轉(zhuǎn)發(fā)給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
根據(jù)上面的cisco 3560 DHCP服務器配置,現(xiàn)在我們只要連接到f0/1口上,那么客戶端分配到的地址將是0網(wǎng)段的地址 ,如果連接到f 0/2口上,那么客戶端將分配到1網(wǎng)段的地址。
help-address的說明:help-address 缺省轉(zhuǎn)發(fā)的8個udp服務:time37 , tacacs49 , dns53 , boot/dhcp服務器67 , boot/dhcp客戶端68 , tftp69 , netbios名字服務137, netbios數(shù)據(jù)報服務138