快盘下载:好资源、好软件、快快下载吧!

快盘排行|快盘最新

当前位置:首页软件教程电脑软件教程 → 网络设备之DHCP配置

网络设备之DHCP配置

时间:2022-10-24 11:45:17人气:作者:快盘下载我要评论

1 拓扑图

本例子dhcp server由路由器或者三层交换机担任;S1为三层交换机本身不提供dhcp服务;dhcp中继转发到dhcp server将地址分配给PC机;思科的PC由路由器模拟。
网络设备之DHCP配置

2 思科配置

S1:

service dhcp   # dhcp中继转发也必须启用dhcp
interface FastEthernet0/1
 description Connect to PC1
 switchport access vlan 2
!
interface FastEthernet0/2
 description Connect to PC2
 switchport access vlan 3
!         
interface FastEthernet0/3
 description Connect to DHCP Server
 no switchport
 ip address 10.10.10.1 255.255.255.252
!
interface Vlan2
 ip address 192.168.1.1 255.255.255.0
 ip helper-address 10.10.10.2    # dhcp中继转发
!
interface Vlan3
 ip address 192.168.2.1 255.255.255.0
 ip helper-address 10.10.10.2
!

dhcp-server:

service dhcp
ip dhcp excluded-address 192.168.2.1 192.168.2.99  # 不在分配的范围
ip dhcp excluded-address 192.168.1.1 192.168.1.99  # 不在分配的范围
!         
ip dhcp pool vlan2         # vlan2 dhcp pool
   network 192.168.1.0 255.255.255.0
   default-router 192.168.1.1 
   DNS-server 192.168.2.1 
!
ip dhcp pool vlan3          # vlan3 dhcp pool
   network 192.168.2.0 255.255.255.0
   default-router 192.168.2.1 
   dns-server 192.168.2.1 
!
ip dhcp pool vlan3-allen    # 根据特殊的mac地址获取到特别的地址;需要独立写一个pool
   host 192.168.2.177 255.255.255.0
   client-identifier 01cc.0023.b800.00  #01;mac地址
interface FastEthernet0/0
 description Connect to S1
 ip address 10.10.10.2 255.255.255.252
 speed 100
 full-duplex
!

pc1/pc2:

interface FastEthernet0/0
 ip address dhcp
 speed 100
 full-duplex

pc正常获取到地址:

*Mar  1 00:08:40.463: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 192.168.2.101, mask 255.255.255.0, hostname R2

pc获取到地址;

R1#show ip route 
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 192.168.1.1 to network 0.0.0.0

     10.0.0.0/32 is subnetted, 1 subnets
S       10.10.10.2 [254/0] via 192.168.1.1, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
S*   0.0.0.0/0 [254/0] via 192.168.1.1
R1#show ip cef
Prefix              Next Hop             Interface
0.0.0.0/0           192.168.1.1          FastEthernet0/0
0.0.0.0/32          receive
10.10.10.2/32       192.168.1.1          FastEthernet0/0
192.168.1.0/24      attached             FastEthernet0/0
192.168.1.0/32      receive
192.168.1.1/32      192.168.1.1          FastEthernet0/0
192.168.1.100/32    receive
192.168.1.255/32    receive
224.0.0.0/4         drop
224.0.0.0/24        receive
255.255.255.255/32  receive

dhcp-server查看 dhcp分配情况;

show ip dhcp binding

dhcp-server 清除dhcp客户端地址;

clear ip dhcp binding 192.168.1.2 

3 华为配置

S1:

sysname S1
vlan batch 2 to 3 1001
dhcp enable
#

interface Vlanif2
 ip address 192.168.1.1 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 10.10.10.2
#
interface Vlanif3
 ip address 192.168.2.1 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 10.10.10.2
#
interface Vlanif1001
 ip address 10.10.10.1 255.255.255.252
#

interface GigabitEthernet0/0/1
 description Connect to dhcp-server
 port link-type access
 port default vlan 1001
#
interface GigabitEthernet0/0/2            
 description Connect to PC1
 port link-type access
 port default vlan 2
#
interface GigabitEthernet0/0/3
 description Connect to PC2
 port link-type access
 port default vlan 3
#

dhcp-server:

dhcp enable
#
ip pool vlan2
 gateway-list 192.168.1.1
 network 192.168.1.0 mask 255.255.255.0
 excluded-ip-address 192.168.1.2 192.168.1.11
 dns-list 114.114.114.114
#
ip pool vlan3
 gateway-list 192.168.2.1                 
 network 192.168.2.0 mask 255.255.255.0
 excluded-ip-address 192.168.2.2 192.168.2.11
 static-bind ip-address 192.168.2.177 mac-address 5489-9852-58d5
 dns-list 114.114.114.114
#
interface Vlanif1001
 ip address 10.10.10.2 255.255.255.252
 dhcp select global   #华为一定要配置global或者interface,中继一般是global
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
 port link-type access                    
 port default vlan 1001
#
ip route-static 0.0.0.0 0.0.0.0 10.10.10.1

p1/p2:
DHCPDHCPDHCP

dhcp-server查看 dhcp分配情况;

<dhcp-server>display ip pool name vlan2 used 
  Pool-name      : vlan2
  Pool-No        : 0
  Lease          : 1 Days 0 Hours 0 Minutes
  Domain-name    : -
  DNS-server0    : 114.114.114.114 
  NBNS-server0   : -               
  Netbios-type   : -               
  Position       : Local           Status           : Unlocked
  Gateway-0      : 192.168.1.1     
  Mask           : 255.255.255.0
  VPN instance   : --
 -----------------------------------------------------------------------------
         Start           End     Total  Used  Idle(Expired)  Conflict  Disable
 -----------------------------------------------------------------------------
     192.168.1.1   192.168.1.254   253     1        242(0)         0       10
 -----------------------------------------------------------------------------

  Network section : 
  --------------------------------------------------------------------------
  Index              IP               MAC      Lease   Status  
  --------------------------------------------------------------------------
    176   192.168.1.177    5489-9817-3b64        714   Used       
  --------------------------------------------------------------------------

<dhcp-server>display ip pool name vlan3 used 
  Pool-name      : vlan3
  Pool-No        : 1
  Lease          : 1 Days 0 Hours 0 Minutes
  Domain-name    : -
  DNS-server0    : 114.114.114.114 
  NBNS-server0   : -               
  Netbios-type   : -               
  Position       : Local           Status           : Unlocked
  Gateway-0      : 192.168.2.1     
  Mask           : 255.255.255.0
  VPN instance   : --
 -----------------------------------------------------------------------------
         Start           End     Total  Used  Idle(Expired)  Conflict  Disable
 -----------------------------------------------------------------------------
     192.168.2.1   192.168.2.254   253     1        242(0)         0       10
 -----------------------------------------------------------------------------

  Network section : 
  --------------------------------------------------------------------------
  Index              IP               MAC      Lease   Status  
  --------------------------------------------------------------------------
    176   192.168.2.177    5489-9852-58d5          -   Static-bind used
  --------------------------------------------------------------------------

dhcp-server 清除dhcp客户端地址;

reset ip pool name vlan2 192.168.1.177

4 华三配置

S1:

sysname S1
dhcp enable
vlan 2 to 3
interface Vlan-interface2
 ip address 192.168.1.1 255.255.255.0
 dhcp select relay
 dhcp relay server-address 10.10.10.2
#
interface Vlan-interface3
 ip address 192.168.2.1 255.255.255.0
 dhcp select relay
 dhcp relay server-address 10.10.10.2
#
interface GigabitEthernet1/0/3
 port link-mode route
 description Connect to dhcp-server
 combo enable fiber
 ip address 10.10.10.1 255.255.255.252
#
interface GigabitEthernet1/0/1
 port link-mode bridge
 description Connect to PC1
 port access vlan 2
 combo enable copper
#
interface GigabitEthernet1/0/2
 port link-mode bridge
 description Connect to PC2
 port access vlan 3
 combo enable copper
#

dhcp-server:

 sysname dhcp-server
 dhcp enable
 dhcp server forbidden-ip 192.168.1.2 192.168.1.11
 dhcp server forbidden-ip 192.168.2.2 192.168.2.11
 dhcp server ip-pool vlan2
 gateway-list 192.168.1.1
 network 192.168.1.0 mask 255.255.255.0
 dns-list 114.114.114.114
#
dhcp server ip-pool vlan3
 gateway-list 192.168.2.1
 network 192.168.2.0 mask 255.255.255.0
 dns-list 114.114.114.114
 static-bind ip-address 192.168.2.177 mask 255.255.255.0 hardware-address 840f-becf-0406
#
interface GigabitEthernet1/0/3
 port link-mode route
 combo enable fiber
 ip address 10.10.10.2 255.255.255.252
#
ip route-static 0.0.0.0 0 10.10.10.1

pc1/pc2:
DHCPDHCP
dhcp-server查看 dhcp分配情况;

<dhcp-server>display dhcp server ip-in-use 
IP address       Client identifier/    Lease expiration      Type
                 Hardware address
192.168.1.12     0037-6338-352e-3134-  Oct 24 16:39:35 2022  Auto(C)            
                 3535-2e30-3230-362d-                                           
                 4745-302f-302f-31                                              
192.168.2.12     0038-3430-662e-6265-  Oct 24 16:29:38 2022  Auto(C)            
                 6366-2e30-3430-362d-                                           
                 4745-302f-302f-31                                              
192.168.2.177    840f-becf-0406        Oct 24 16:36:47 2022  Static(C) 

dhcp-server 清除dhcp客户端地址;

reset dhcp server ip-in-use ip 192.168.2.2 

相关文章

  • 在linux上搭建DHCP和DNS

    在linux上搭建DHCP和DNS,先上拓扑图:本实验在VMware Workstation 16上完成。目的:实现在linux上安装dhcp和dns服务。...
  • 锐捷DHCP+DHCP中继基础实验

    锐捷DHCP+DHCP中继基础实验,ip helper-address 192.168.10.254 配置dhcp中继地址为192.168.10.254。host 192.168.10.101 255.255.255.0 为哑终端分配的IP地址。建议采用Client命令来手工分配IP地址,如果Client分配失败,则尝试hardware方式。配置排除地址(分配地址时不分配以下地址)一个地址池只可以配置1个手工IP地址。创建为PC3分配的地址池。创建为PC4分配的地址池。创建为哑...

网友评论

快盘下载暂未开通留言功能。

关于我们| 广告联络| 联系我们| 网站帮助| 免责声明| 软件发布

Copyright 2019-2029 【快快下载吧】 版权所有 快快下载吧 | 豫ICP备10006759号公安备案:41010502004165

声明: 快快下载吧上的所有软件和资料来源于互联网,仅供学习和研究使用,请测试后自行销毁,如有侵犯你版权的,请来信指出,本站将立即改正。