DHCP 中继问题

网络工程 思科 转变 路由器 思科-ios dhcp
2021-08-02 05:25:51

我试图让 DHCP 在这两个设备之间工作。任何提示都会很棒!

开关配置

Switch#show run      
Building configuration...

Current configuration : 1596 bytes
!
! Last configuration change at 00:45:35 UTC Mon Mar 1 1993
!
version 12.2
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Switch
!
boot-start-marker
boot-end-marker
!
!
username nick secret 5 
no aaa new-model
system mtu routing 1500
!
!
ip dhcp-server 10.1.1.1
!
!         
!
!         
!
!         
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!         
!
!         
!
!         
interface GigabitEthernet0/1
!         
interface GigabitEthernet0/2
!         
interface GigabitEthernet0/3
!         
interface GigabitEthernet0/4
!         
interface GigabitEthernet0/5
!         
interface GigabitEthernet0/6
!         
interface GigabitEthernet0/7
!         
interface GigabitEthernet0/8
!         
interface GigabitEthernet0/9
!         
interface GigabitEthernet0/10
!         
interface GigabitEthernet0/11
!         
interface GigabitEthernet0/12
!         
interface GigabitEthernet0/13
!         
interface GigabitEthernet0/14
!         
interface GigabitEthernet0/15
!         
interface GigabitEthernet0/16
!         
interface GigabitEthernet0/17
!         
interface GigabitEthernet0/18
!         
interface GigabitEthernet0/19
!         
interface GigabitEthernet0/20
!         
interface GigabitEthernet0/21
!         
interface GigabitEthernet0/22
!         
interface GigabitEthernet0/23
!         
interface GigabitEthernet0/24
!         
interface GigabitEthernet0/25
!         
interface GigabitEthernet0/26
!         
interface GigabitEthernet0/27
!         
interface GigabitEthernet0/28
!         
interface Vlan1
 ip address 10.1.1.100 255.255.255.0
 ip helper-address 10.1.1.1
!         
ip default-gateway 10.1.1.1
ip http server
ip http secure-server
!         
!
logging esm config
!
!         
line con 0
line vty 5 15
!
end     

路由器配置

cisco2821#show run
Building configuration...


Current configuration : 1749 bytes
!
! Last configuration change at 18:05:40 AEST Sat May 19 2018 by nick
version 15.1
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname cisco2821
!
boot-start-marker
boot-end-marker
!
!
! card type command needed for slot/vwic-slot 0/1
enable secret 5 
!
no aaa new-model
!
clock timezone AEST 10 0
no network-clock-participate wic 2 
!
dot11 syslog
ip source-route
!         
!         
ip cef    
!         
ip dhcp excluded-address 10.1.1.1
ip dhcp excluded-address 10.1.1.1 10.1.1.255
ip dhcp excluded-address 10.1.1.1 10.1.1.100
ip dhcp excluded-address 10.1.1.2
!         
ip dhcp pool VLAN50
 network 10.1.1.0 255.255.255.0
 default-router 10.1.1.1 
 dns-server 4.4.4.4 8.8.8.8 
 lease 3 12 15
!         
ip dhcp pool lab
 network 10.1.2.0 255.255.255.0
 default-router 10.1.1.1 
 dns-server 4.4.4.4 8.8.8.8 
 lease 3 12 15
!         
!         
ip domain name nick.com
no ipv6 cef
!         
multilink bundle-name authenticated
!         
!         
!         
!         
!         
!         
!         
!         
!         
!         
!         
voice-card 0
!         
crypto pki token default removal timeout 0
!         
!         
!         
!         
license udi pid CISCO2821 sn FH
username nick password 0 
!         
redundancy
!         
!         
controller E1 0/2/0
!         
ip ssh version 2
!         
!         
!         
!         
!         
!         
!         
!         
interface GigabitEthernet0/0
 ip address dhcp
 ip helper-address 192.168.20.1
 duplex auto
 speed auto
!         
interface GigabitEthernet0/1
 ip address 10.1.1.1 255.255.255.0
 duplex auto
 speed auto
!         
router ospf 1
 router-id 10.1.1.1
 network 10.1.1.1 0.0.0.0 area 0
!         
ip forward-protocol nd
no ip http server
no ip http secure-server
!         
!         
!         
!         
!         
!         
!         
!         
!         
control-plane
!         
!         
!         
!         
mgcp profile default
!         
!         
!         
!         
!         
gatekeeper
 shutdown 
!         
!         
!         
line con 0
line aux 0
line vty 0 4
 login local
 transport input all
!         
scheduler allocate 20000 1000
ntp server 192.168.20.1
end   

cisco2821#show ip dhcp 池

Pool VLAN50 :
 Utilization mark (high/low)    : 100 / 0
 Subnet size (first/next)       : 0 / 0 
 Total addresses                : 254
 Leased addresses               : 0
 Pending event                  : none
 1 subnet is currently in the pool :
 Current index        IP address range                    Leased addresses
 0.0.0.0              10.1.1.1         - 10.1.1.254        0

Pool lab :
 Utilization mark (high/low)    : 100 / 0
 Subnet size (first/next)       : 0 / 0 
 Total addresses                : 254
 Leased addresses               : 0
 Pending event                  : none
 1 subnet is currently in the pool :
 Current index        IP address range                    Leased addresses
 10.1.2.1             10.1.2.1         - 10.1.2.254        0
1个回答

你有几个问题:

  • 您排除了 VLAN50 DHCP 池中的每个地址:

    ip dhcp excluded-address 10.1.1.1 10.1.1.255
    

    命令是:

    ip dhcp excluded-address {low-address [high-address]}
    

    您只想排除静态定义的地址,据我所知,这只是10.1.1.100. 您不需要排除路由器接口地址10.1.1.1,因为路由器会为您做这件事。因此,您应该拥有的唯一排除是:

    ip dhcp excluded-address 10.1.1.100
    
  • 网络的网关必须是网络中的地址。你有这个:

    ip dhcp pool lab
     network 10.1.2.0 255.255.255.0
     default-router 10.1.1.1 
     dns-server 4.4.4.4 8.8.8.8 
     lease 3 12 15
    !
    

    但是网关 ( default-router) 位于不同的网络中,因此主机需要一个网关才能到达网关,而这种方式不起作用。

    您还没有向我们提供具有10.1.2.0/24网络的设备的配置,所以我不确定您为什么要这样做。

  • helper-address接口上的命令是使用DHCP本身没有意义,甚至工作。您在网络上没有 DHCP 服务器的网络的路由器接口上放置了一个帮助程序地址,它指向一个 DHCP 服务器,该服务器具有路由器知道如何到达的该网络的范围。路由器本身在您的接口上使用 DHCP,因此路由器所连接的网络上必须有一个 DHCP 服务器,或者在同一网络上的不同路由器上有一个辅助地址:

    interface GigabitEthernet0/0
     ip address dhcp
     ip helper-address 192.168.20.1   ! This is incorrect bcause the network is served by another device, not this router
     duplex auto
     speed auto
    !
    
  • 您的 OSPF 配置对您所拥有的没有意义。你只有一个接口参与OSPF,但是路由器在网络之间路由,路由器已经知道 10.1.1.0/24网络了。OSPF 用于在路由器之间共享路由,我看不到您在该网络上的其他路由器的位置。路由器将在任何直接连接的网络之间自动路由。更有可能的是,您需要一个静态定义的默认路由:

    ip route 0.0.0.0 0.0.0.0 dhcp
    
  • 您已将 DHCP 池命名为 VLAN50,但它所服务的 VLAN 是 VLAN 1,因此它可能会产生误导,并在以后引起混淆。

  • 在交换机上,您不应该拥有该ip dhcp-server 10.1.1.1 命令。利用:

    no ip dhcp-server 10.1.1.1
    
  • 此外,在交换机上ip helper-address 10.1.1.1interface Vlan1以下位置删除命令

    no ip helper-address 10.1.1.1
    

    该命令实际上并没有做任何事情,因为该网络的 DHCP 服务器在该网络上。该命令可用于不同网络上的 DHCP 服务器,但最好将其放置在路由器接口上。