文章中,我们针对DHCP端口的一些配置内容进行了讲解和介绍。希望本文所提供的代码以及命令能够给大家一些帮助。
在一些DHCP服务器的配置中,少不了端口的设置。这个也是对于路由器和交换机配置来说非常核心的问题了。用一台cisco 3560来做DHCP服务器,有时候要启多个DHCP来工作。那么我们应该怎么做呢。
首先我们要把交换端口关闭掉,换成L3的接口。配置上IP地址。再来设置DHCP地址池。我们要让端口f0/1上来的主机分配0网段的IP地址,让f0/2上来的主机分配1网段,那么,我们就应该配置好地址池后,在接口下用到ip help-address 来给客户端的查询指定一个服务地址。详细见配置。以下配置在真实3560上得到通过。
- Switch#shrun首先我们看下运行中的配置清单
- Switch#shrunning-config
- Buildingconfiguration...
- Currentconfiguration:1326bytes
- !
- version12.2
- noservicepad
- servicetimestampsdebuguptime
- servicetimestampsloguptime
- noservicepassword-encryption
- !
- hostnameSwitch
- !
- !
- noaaanew-model
- systemmturouting1500
- ipsubnet-zero
- noipdomain-lookup
- !
- !
- !
- !
- !
- !
- !
- !
- !
- spanning-treemodepvst
- spanning-treeextendsystem-id
- !
- vlaninternalallocationpolicyascending
- !
- !
- !
- !
- interfaceFastEthernet0/1
- shutdown
- !
- interfaceFastEthernet0/2
- !
- interfaceFastEthernet0/3
- !
- interfaceFastEthernet0/4
- !
- interfaceFastEthernet0/5
- !
- interfaceFastEthernet0/6
- !
- interfaceFastEthernet0/7
- !
- interfaceFastEthernet0/8
- !
- interfaceFastEthernet0/9
- !
- interfaceFastEthernet0/10
- !
- interfaceFastEthernet0/11
- !
- interfaceFastEthernet0/12
- !
- interfaceFastEthernet0/13
- !
- interfaceFastEthernet0/14
- !
- interfaceFastEthernet0/15
- !
- interfaceFastEthernet0/16
- !
- interfaceFastEthernet0/17
- !
- interfaceFastEthernet0/18
- !
- interfaceFastEthernet0/19
- !
- interfaceFastEthernet0/20
- !
- interfaceFastEthernet0/21
- !
- interfaceFastEthernet0/22
- !
- interfaceFastEthernet0/23
- noswitchport
- ipaddress192.168.100.1255.255.255.0
- !
- interfaceFastEthernet0/24
- !
- interfaceGigabitEthernet0/1
- !
- interfaceGigabitEthernet0/2
- !
- interfaceVlan1
- noipaddress
- !
- ipclassless
- iphttpserver
- iphttpsecure-server
- !
- !
- !
- control-plane
- !
- !
- linecon0
- linevty04
- login
- linevty515
- login
- !
- end
#p#
- Switch#conft
- Switch(config)#intfa0/1进入F0/1
- Switch(config-if)#noswitchport关闭L2端口
- Switch(config-if)#ipadd10.0.0.1255.255.255.0配置IP地址
- Switch(config-if)#nosh打开端口
- Switch(config-if)#exi
- Switch(config)#intfa0/2
- Switch(config-if)#nosw
- Switch(config-if)#noswitchport
- Switch(config-if)#nosh
- Switch(config-if)#ipadd10.0.1.1255.255.255.0
- Switch(config-if)#nosh
- Switch(config-if)#exi
- Switch(config)#ipdhcppoolccna设置DHCP组
- Switch(dhcp-config)#network10.0.0.0255.255.255.0地址池
- Switch(dhcp-config)#default-router10.0.0.254缺省路由(网关)
- Switch(dhcp-config)#dns-server202.103.24.68DNS地址设置
- Switch(dhcp-config)#lease365地址租期
- Switch(dhcp-config)#exi
- Switch(config)#ipdhcppoolccnp
- Switch(dhcp-config)#network10.0.1.0255.255.255.0
- Switch(dhcp-config)#default-router10.0.1.254
- Switch(dhcp-config)#dns-server202.103.24.68
- Switch(dhcp-config)#lease365
- Switch(dhcp-config)#exi
- Switch(config)#ipdhcpexcluded-address10.0.0.1不参与分配的地址
- Switch(config)#ipdhcpexcluded-address10.0.0.254
- Switch(config)#ipdhcpexcluded-address10.0.1.254
- Switch(config)#ipdhcpexcluded-address10.0.1.1
- Switch(config)#exi
- Switch(config)#intfa0/1
- Switch(config-if)#iphelper-address10.0.0.1指定帮助地址,它将默认转发给8个UDP服务
- Switch(config-if)#exi
- Switch(config)#intfa0/2
- Switch(config-if)#iphelper-address10.0.1.1
- Switch(config-if)#exi
- Switch#shrun
- Switch#shrunning-config
- Buildingconfiguration...
#p#
- Currentconfiguration:1864bytes
- !
- version12.2
- noservicepad
- servicetimestampsdebuguptime
- servicetimestampsloguptime
- noservicepassword-encryption
- !
- hostnameSwitch
- !
- !
- noaaanew-model
- systemmturouting1500
- ipsubnet-zero
- noipdomain-lookup
- ipdhcpexcluded-address10.0.0.1
- ipdhcpexcluded-address10.0.0.254
- ipdhcpexcluded-address10.0.1.254
- ipdhcpexcluded-address10.0.1.1
- !
- ipdhcppoolccna
- network10.0.0.0255.255.255.0
- default-router10.0.0.254
- dns-server202.103.24.68
- lease365
- !
- ipdhcppoolccnp
- network10.0.1.0255.255.255.0
- default-router10.0.1.254
- dns-server202.103.24.68
- lease365
- !
- !
- !
- !
- !
- !
- !
- !
- !
- spanning-treemodepvst
- spanning-treeextendsystem-id
- !
- vlaninternalallocationpolicyascending
- !
- !
- !
- !
- interfaceFastEthernet0/1
- noswitchport
- ipaddress10.0.0.1255.255.255.0
- iphelper-address10.0.0.1
- !
- interfaceFastEthernet0/2
- noswitchport
- ipaddress10.0.1.1255.255.255.0
- iphelper-address10.0.1.1
- !
- interfaceFastEthernet0/3
- !
- interfaceFastEthernet0/4
- !
- interfaceFastEthernet0/5
- !
- interfaceFastEthernet0/6
- !
- interfaceFastEthernet0/7
- !
- interfaceFastEthernet0/8
- !
- interfaceFastEthernet0/9
- !
- interfaceFastEthernet0/10
- !
- interfaceFastEthernet0/11
- !
- interfaceFastEthernet0/12
- !
- interfaceFastEthernet0/13
- !
- interfaceFastEthernet0/14
- !
- interfaceFastEthernet0/15
- !
- interfaceFastEthernet0/16
- !
- interfaceFastEthernet0/17
- !
- interfaceFastEthernet0/18
- !
- interfaceFastEthernet0/19
- !
- interfaceFastEthernet0/20
- !
- interfaceFastEthernet0/21
- !
- interfaceFastEthernet0/22
- !
- interfaceFastEthernet0/23
- noswitchport
- ipaddress192.168.100.1255.255.255.0
- !
- interfaceFastEthernet0/24
- !
- Switch#sharp
- ProtocolAddressAge(min)HardwareAddrTypeInterface
- Internet10.0.0.20001a.4b58.42a9ARPAFastEthernet0/1
- Internet10.0.1.1-001e.4a0a.2042ARPAFastEthernet0/2
- Internet10.0.0.1-001e.4a0a.2041ARPAFastEthernet0/1
- Internet192.168.100.1-001e.4a0a.2043ARPAFastEthernet0/23
根据上面的配置,现在我们只要连接到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
转载请说明出处
知优网 » DHCP端口设置命令剖析(dhcp使用的端口)
知优网 » DHCP端口设置命令剖析(dhcp使用的端口)