zoukankan      html  css  js  c++  java
  • 思科DCHP解决方案

    DHCP功能平时用的不算少,而且本人的几乎所有的DHCP功能都是在交换机上实现的,虽然也可以通过PC实现,而且PC的DHCP Server功能还更完善,比如可以不受DHCP作用域的限制、IP分配情况直观等优点,但从我的日常工作环境来看,如果是简单地实现小规模DHCP,那么还是三层交换机更方便一些。
    下面将转自思科中文社区的DHCP文章共享给大家,欢迎交流。
     
     
    一、如果不用交换机的DHCP功能而是利用PC的DHCP功能!
    1.在交换机上配置DHCP服务器:
      ip dhcp-server 192.168.0.69
    2.在交换机中为每个VLAN设置同样的DHCP服务器的IP地址:
      interface Vlan11
      ip address 192.168.1.254 255.255.255.0
      ip helper-address 192.168.0.69 DHCP Server IP
      interface Vlan12
      ip address 192.168.2.254 255.255.255.0
      ip helper-address 192.168.0.69 DHCP Server IP
    3.在DHCP服务器上设置网络地址分别为192.168.1.0、192.168.2.0的作用域,并将这些作用域的“路
    由器”选项设置为对应VLAN的接口IP地址。
     
    二、利用三层交换机自带的DHCP功能实现多VLAN的IP地址自动分配
    (一) 配置方法1

    1.同时为多个VLAN的客户机分配地址
    2.VLAN内有部分地址采用手工分配的方式
    3.为客户指定网关、Wins服务器等
    4.VLAN 2的地址租用有效期限为1天,其它为3天
    5.按MAC地址为特定用户分配指定的IP地址
    最终配置如下:
    ip dhcp excluded-address 10.1.1.1 10.1.1.19 //不用于动态地址分配的地址
    ip dhcp excluded-address 10.1.1.240 10.1.1.254
    ip dhcp excluded-address 10.1.2.1 10.1.2.19
    !
    ip dhcp pool global //global是pool name, 由用户指定
    network 10.1.0.0 255.255.0.0 //动态分配的地址段
    domain-name client.com //为客户机配置域后缀
    dns-server 10.1.1.1 10.1.1.2 //为客户机配置dns服务器
    netbios-name-server 10.1.1.5 10.1.1.6 //为客户机配置wins服务器
    netbios-node-type h-node //为客户机配置节点模式(影响名称解释的顺利,如h-node=先通过wins服务
    器解释...)
    lease 3 //地址租用期限: 3天
    ip dhcp pool vlan1
    network 10.1.1.0 255.255.255.0 //本pool是global的子pool, 将从global pool继承domain-name等
    option
    default-router 10.1.1.100 10.1.1.101 //为客户机配置默认网关
    !
    ip dhcp pool vlan2 //为另一VLAN配置的pool
    network 10.1.2.0 255.255.255.0
    default-router 10.1.2.100 10.1.2.101
    lease 1
    !
    ip dhcp pool vlan1_john //总是为MAC地址为...的机器分配...地址
    host 10.1.1.21 255.255.255.0
    client-identifier 010050.bade.6384 //client-identifier=01加上客户机网卡地址
    !
    ip dhcp pool vlan1_tom
    host 10.1.1.50 255.255.255.0
    client-identifier 010010.3ab1.eac8
     
    相关的DHCP调试命令:
    no service dhcp //停止DHCP服务[默认为启用DHCP服务]
    sh ip dhcp binding //显示地址分配情况
    show ip dhcp conflict //显示地址冲突情况
    debug ip dhcp server {events | packets | linkage} //观察DHCP服务器工作情况
    如果DHCP客户机分配不到IP地址,常见的原因有两个。第一种情况是没有把连接客户机的端口设置为
    Portfast方式。MS客户机开机后检查网卡连接正常,Link是UP的,就开始发送DHCPDISCOVER请求,而此时
    交换机端口正在经历生成树计算,一般需要30-50秒才能进入转发状态。MS客户机没有收到DHCP SERVER的
    响应就会给网卡设置一个169.169.X.X的IP地址。解决的方法是把交换机端口设置为Portfast方式:
    CatOS(4000/5000/6000): set spantree portfast mod_num/port_num enable; IOS(2900/3500):
    interface ... ; spanning-tree portfast
    (二) 配置方法2
    一台3550EMI交换机,划分三个vlan
    vlan2 为服务器所在网络,命名为server,IP地址段为192.168.2.0,子网掩码:255.255.255.0,网
    关:192.168.2.1,域服务器为windows 2000 advance server,同时兼作DNS服务器,IP地址为192.168.2.10
    vlan3为客户机1所在网络,IP地址段为192.168.3.0,子网掩码:255.255.255.0,网关:192.168.3.1命名为
    work01
    vlan4为客户机2所在网络,命名为work02,IP地址段为192.168.4.0,子网掩码:255.255.255.0,网
    关:192.168.4.1,
    3550作DHCP服务器,端口1-8划到VLAN 2,端口9-16划分到VLAN 3,端口17-24划分到VLAN 4.
    DHCP服务器实现功能:
    各VLAN保留2-10的IP地址不分配置,例如:192.168.2.0的网段,保留192.168.2.2至192.168.2.10的IP地址
    段不分配.
    安全要求:
    VLAN 3和VLAN 4 不允许互相访问,但都可以访问服务器所在的VLAN 2,
    默认访问控制列表的规则是拒绝所有包.
    配置命令及步骤如下:
    第一步:创建VLAN:
    Switch>en
    Switch#Vlan Database
    Switch(Vlan)>Vlan 2 Name server
    Switch(Vlan)>Vlan 3 Name work01
    Switch(vlan)>Vlan 4 Name work02
    第二步:设置VLAN IP地址:
    Switch#Config T
    Switch(Config)>Int Vlan 2
    Switch(Config-vlan)Ip Address 192.168.2.1 255.255.255.0
    Switch(Config-vlan)No Shut
    Switch(Config-vlan)>Int Vlan 3
    Switch(Config-vlan)Ip Address 192.168.3.1 255.255.255.0
    Switch(Config-vlan)No Shut
    Switch(Config-vlan)>Int Vlan 4
    Switch(Config-vlan)Ip Address 192.168.4.1 255.255.255.0
    Switch(Config-vlan)No Shut
    Switch(Config-vlan)Exit
    第三步:设置端口全局参数
    Switch(Config)Interface Range Fa 0/1 - 24
    Switch(Config-if-range)Switchport Mode Access
    Switch(Config-if-range)Spanning-tree Portfast
    第四步:将端口添加到VLAN2,3,4中

    Switch(Config)Interface Range Fa 0/1 - 8
    Switch(Config-if-range)Switchport Access Vlan 2

    Switch(Config)Interface Range Fa 0/9 - 16
    Switch(Config-if-range)Switchport Access Vlan 3

    Switch(Config)Interface Range Fa 0/17 - 24
    Switch(Config-if-range)Switchport Access Vlan 4
    Switch(Config-if-range)Exit
    第五步:配置3550作为DHCP服务器

    Switch(Config)Ip Dhcp Pool Test01

    Switch(Config-pool)Network 192.168.2.0 255.255.255.0

    Switch(Config-pool)Dns-server 192.168.2.10

    Switch(Config-pool)Default-router 192.168.2.1

    Switch(Config)Ip Dhcp Pool Test02
    Switch(Config-pool)Network 192.168.3.0 255.255.255.0
    Switch(Config-pool)Dns-server 192.168.2.10
    Switch(Config-pool)Default-router 192.168.3.1

    Switch(Config)Ip Dhcp Pool Test03
    Switch(Config-pool)Network 192.168.4.0 255.255.255.0
    Switch(Config-pool)Dns-server 192.168.2.10
    Switch(Config-pool)Default-router 192.168.4.1
    第六步:设置DHCP保留不分配的地址
    Switch(Config)Ip Dhcp Excluded-address 192.168.2.2 192.168.2.10
    Switch(Config)Ip Dhcp Excluded-address 192.168.3.2 192.168.3.10
    Switch(Config)Ip Dhcp Excluded-address 192.168.4.2 192.168.4.10

    第七步:启用路由

    Switch(Config)Ip Routing
    第八步:配置访问控制列表
    Switch(Config)access-list 103 permit ip 192.168.2.0 0.0.0.255 192.168.3.0 0.0.0.255
    Switch(Config)access-list 103 permit ip 192.168.3.0 0.0.0.255 192.168.2.0 0.0.0.255
    Switch(Config)access-list 103 permit udp any any eq bootpc
    Switch(Config)access-list 103 permit udp any any eq tftp
    Switch(Config)access-list 103 permit udp any eq bootpc any
    Switch(Config)access-list 103 permit udp any eq tftp any
    Switch(Config)access-list 104 permit ip 192.168.2.0 0.0.0.255 192.168.4.0 0.0.0.255
    Switch(Config)access-list 104 permit ip 192.168.4.0 0.0.0.255 192.168.2.0 0.0.0.255
    Switch(Config)access-list 104 permit udp any eq tftp any
    Switch(Config)access-list 104 permit udp any eq bootpc any
    Switch(Config)access-list 104 permit udp any eq bootpc any
    Switch(Config)access-list 104 permit udp any eq tftp any
    第九步:应用访问控制列表

    Switch(Config)Int Vlan 3
    Switch(Config-vlan)ip access-group 103 out
    Switch(Config-vlan)Int Vlan 4
    Switch(Config-vlan)ip access-group 104 out
    第十步:结束并保存配置
    Switch(Config-vlan)End
    Switch#Copy Run Start
  • 相关阅读:
    remove white space from read
    optimize the access speed of django website
    dowload image from requests
    run jupyter from command
    crawl wechat page
    python version 2.7 required which was not found in the registry windows 7
    health
    alternate rows shading using conditional formatting
    word
    【JAVA基础】static 关键字
  • 原文地址:https://www.cnblogs.com/alanjl/p/4861389.html
Copyright © 2011-2022 走看看