文章中,我们针对DHCP端口的一些配置内容进行了讲解和介绍。希望本文所提供的代码以及命令能够给大家一些帮助。

在一些DHCP服务器的配置中,少不了端口的设置。这个也是对于路由器和交换机配置来说非常核心的问题了。用一台cisco 3560来做DHCP服务器,有时候要启多个DHCP来工作。那么我们应该怎么做呢。

DHCP端口设置命令剖析(dhcp使用的端口)  端口 DHCP 第1张

首先我们要把交换端口关闭掉,换成L3的接口。配置上IP地址。再来设置DHCP地址池。我们要让端口f0/1上来的主机分配0网段的IP地址,让f0/2上来的主机分配1网段,那么,我们就应该配置好地址池后,在接口下用到ip help-address 来给客户端的查询指定一个服务地址。详细见配置。以下配置在真实3560上得到通过。

  1. Switch#shrun首先我们看下运行中的配置清单
  2. Switch#shrunning-config
  3. Buildingconfiguration...
  4. Currentconfiguration:1326bytes
  5. !
  6. version12.2
  7. noservicepad
  8. servicetimestampsdebuguptime
  9. servicetimestampsloguptime
  10. noservicepassword-encryption
  11. !
  12. hostnameSwitch
  13. !
  14. !
  15. noaaanew-model
  16. systemmturouting1500
  17. ipsubnet-zero
  18. noipdomain-lookup
  19. !
  20. !
  21. !
  22. !
  23. !
  24. !
  25. !
  26. !
  27. !
  28. spanning-treemodepvst
  29. spanning-treeextendsystem-id
  30. !
  31. vlaninternalallocationpolicyascending
  32. !
  33. !
  34. !
  35. !
  36. interfaceFastEthernet0/1
  37. shutdown
  38. !
  39. interfaceFastEthernet0/2
  40. !
  41. interfaceFastEthernet0/3
  42. !
  43. interfaceFastEthernet0/4
  44. !
  45. interfaceFastEthernet0/5
  46. !
  47. interfaceFastEthernet0/6
  48. !
  49. interfaceFastEthernet0/7
  50. !
  51. interfaceFastEthernet0/8
  52. !
  53. interfaceFastEthernet0/9
  54. !
  55. interfaceFastEthernet0/10
  56. !
  57. interfaceFastEthernet0/11
  58. !
  59. interfaceFastEthernet0/12
  60. !
  61. interfaceFastEthernet0/13
  62. !
  63. interfaceFastEthernet0/14
  64. !
  65. interfaceFastEthernet0/15
  66. !
  67. interfaceFastEthernet0/16
  68. !
  69. interfaceFastEthernet0/17
  70. !
  71. interfaceFastEthernet0/18
  72. !
  73. interfaceFastEthernet0/19
  74. !
  75. interfaceFastEthernet0/20
  76. !
  77. interfaceFastEthernet0/21
  78. !
  79. interfaceFastEthernet0/22
  80. !
  81. interfaceFastEthernet0/23
  82. noswitchport
  83. ipaddress192.168.100.1255.255.255.0
  84. !
  85. interfaceFastEthernet0/24
  86. !
  87. interfaceGigabitEthernet0/1
  88. !
  89. interfaceGigabitEthernet0/2
  90. !
  91. interfaceVlan1
  92. noipaddress
  93. !
  94. ipclassless
  95. iphttpserver
  96. iphttpsecure-server
  97. !
  98. !
  99. !
  100. control-plane
  101. !
  102. !
  103. linecon0
  104. linevty04
  105. login
  106. linevty515
  107. login
  108. !
  109. end


#p#

  1. Switch#conft
  2. Switch(config)#intfa0/1进入F0/1
  3. Switch(config-if)#noswitchport关闭L2端口
  4. Switch(config-if)#ipadd10.0.0.1255.255.255.0配置IP地址
  5. Switch(config-if)#nosh打开端口
  6. Switch(config-if)#exi
  7. Switch(config)#intfa0/2
  8. Switch(config-if)#nosw
  9. Switch(config-if)#noswitchport
  10. Switch(config-if)#nosh
  11. Switch(config-if)#ipadd10.0.1.1255.255.255.0
  12. Switch(config-if)#nosh
  13. Switch(config-if)#exi
  14. Switch(config)#ipdhcppoolccna设置DHCP组
  15. Switch(dhcp-config)#network10.0.0.0255.255.255.0地址池
  16. Switch(dhcp-config)#default-router10.0.0.254缺省路由(网关)
  17. Switch(dhcp-config)#dns-server202.103.24.68DNS地址设置
  18. Switch(dhcp-config)#lease365地址租期
  19. Switch(dhcp-config)#exi
  20. Switch(config)#ipdhcppoolccnp
  21. Switch(dhcp-config)#network10.0.1.0255.255.255.0
  22. Switch(dhcp-config)#default-router10.0.1.254
  23. Switch(dhcp-config)#dns-server202.103.24.68
  24. Switch(dhcp-config)#lease365
  25. Switch(dhcp-config)#exi
  26. Switch(config)#ipdhcpexcluded-address10.0.0.1不参与分配的地址
  27. Switch(config)#ipdhcpexcluded-address10.0.0.254
  28. Switch(config)#ipdhcpexcluded-address10.0.1.254
  29. Switch(config)#ipdhcpexcluded-address10.0.1.1
  30. Switch(config)#exi
  31. Switch(config)#intfa0/1
  32. Switch(config-if)#iphelper-address10.0.0.1指定帮助地址,它将默认转发给8个UDP服务
  33. Switch(config-if)#exi
  34. Switch(config)#intfa0/2
  35. Switch(config-if)#iphelper-address10.0.1.1
  36. Switch(config-if)#exi
  37. Switch#shrun
  38. Switch#shrunning-config
  39. Buildingconfiguration...

#p#

  1. Currentconfiguration:1864bytes
  2. !
  3. version12.2
  4. noservicepad
  5. servicetimestampsdebuguptime
  6. servicetimestampsloguptime
  7. noservicepassword-encryption
  8. !
  9. hostnameSwitch
  10. !
  11. !
  12. noaaanew-model
  13. systemmturouting1500
  14. ipsubnet-zero
  15. noipdomain-lookup
  16. ipdhcpexcluded-address10.0.0.1
  17. ipdhcpexcluded-address10.0.0.254
  18. ipdhcpexcluded-address10.0.1.254
  19. ipdhcpexcluded-address10.0.1.1
  20. !
  21. ipdhcppoolccna
  22. network10.0.0.0255.255.255.0
  23. default-router10.0.0.254
  24. dns-server202.103.24.68
  25. lease365
  26. !
  27. ipdhcppoolccnp
  28. network10.0.1.0255.255.255.0
  29. default-router10.0.1.254
  30. dns-server202.103.24.68
  31. lease365
  32. !
  33. !
  34. !
  35. !
  36. !
  37. !
  38. !
  39. !
  40. !
  41. spanning-treemodepvst
  42. spanning-treeextendsystem-id
  43. !
  44. vlaninternalallocationpolicyascending
  45. !
  46. !
  47. !
  48. !
  49. interfaceFastEthernet0/1
  50. noswitchport
  51. ipaddress10.0.0.1255.255.255.0
  52. iphelper-address10.0.0.1
  53. !
  54. interfaceFastEthernet0/2
  55. noswitchport
  56. ipaddress10.0.1.1255.255.255.0
  57. iphelper-address10.0.1.1
  58. !
  59. interfaceFastEthernet0/3
  60. !
  61. interfaceFastEthernet0/4
  62. !
  63. interfaceFastEthernet0/5
  64. !
  65. interfaceFastEthernet0/6
  66. !
  67. interfaceFastEthernet0/7
  68. !
  69. interfaceFastEthernet0/8
  70. !
  71. interfaceFastEthernet0/9
  72. !
  73. interfaceFastEthernet0/10
  74. !
  75. interfaceFastEthernet0/11
  76. !
  77. interfaceFastEthernet0/12
  78. !
  79. interfaceFastEthernet0/13
  80. !
  81. interfaceFastEthernet0/14
  82. !
  83. interfaceFastEthernet0/15
  84. !
  85. interfaceFastEthernet0/16
  86. !
  87. interfaceFastEthernet0/17
  88. !
  89. interfaceFastEthernet0/18
  90. !
  91. interfaceFastEthernet0/19
  92. !
  93. interfaceFastEthernet0/20
  94. !
  95. interfaceFastEthernet0/21
  96. !
  97. interfaceFastEthernet0/22
  98. !
  99. interfaceFastEthernet0/23
  100. noswitchport
  101. ipaddress192.168.100.1255.255.255.0
  102. !
  103. interfaceFastEthernet0/24
  104. !
  105. Switch#sharp
  106. ProtocolAddressAge(min)HardwareAddrTypeInterface
  107. Internet10.0.0.20001a.4b58.42a9ARPAFastEthernet0/1
  108. Internet10.0.1.1-001e.4a0a.2042ARPAFastEthernet0/2
  109. Internet10.0.0.1-001e.4a0a.2041ARPAFastEthernet0/1
  110. 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使用的端口)

发表评论

您需要后才能发表评论