设为首页收藏本站language 语言切换
查看: 1934|回复: 8
收起左侧

[求助] 关于DHCP的问题

[复制链接]
发表于 2021-11-6 18:55:16 | 显示全部楼层 |阅读模式
3鸿鹄币
                                          
12.png


如拓扑,R1做了DHCP ,2个地址池,分别是VLAN 10 和 vlan 20.    问题:如果,R1的FA0/1接口做子接口,配置vlan10 和vlan20 ,pc2,pc3可以获得到地址(pc2和pc3分别链接的是交换机fa0/2和FA0/3,VLAN 是vlan10和vlan20). 但是 pc0和pc1就获取不到地址了。删除R1的fa0/1子接口,pc0和pc1就可以获取到地址。我的配置如下:

左边交换机的配置:
Switch(config)#do show run
Building configuration...

Current configuration : 1205 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch

spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/2
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/3
switchport mode trunk
!
interface Vlan1
no ip address
shutdown
!
!
line con 0
!
line vty 0 4
login
line vty 5 15
login

!
end


R0的配置

Router#show run
Building configuration...

Current configuration : 1064 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router

ip cef
no ipv6 cef


spanning-tree mode pvst
!

interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.1
encapsulation dot1Q 10
ip address 192.168.10.254 255.255.255.0
ip helper-address 10.1.12.2
!
interface FastEthernet0/0.2
encapsulation dot1Q 20
ip address 192.168.20.254 255.255.255.0
ip helper-address 10.1.12.2
!
interface FastEthernet0/1
ip address 10.1.12.1 255.255.255.0
duplex auto
speed auto
!
interface Vlan1
no ip address
shutdown
!
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 1.1.1.1 0.0.0.0 area 0
network 10.1.12.0 0.0.0.255 area 0
network 192.168.10.0 0.0.0.255 area 0
network 192.168.20.0 0.0.0.255 area 0
!
ip classless
!
ip flow-export version 9

line con 0
!
line aux 0
!
line vty 0 4
login
!

end


R1的配置
Router#show run
Building configuration...

Current configuration : 1155 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router

ip dhcp pool 10
network 192.168.10.0 255.255.255.0
default-router 192.168.10.254
dns-server 61.139.2.69
ip dhcp pool 20
network 192.168.20.0 255.255.255.0
default-router 192.168.20.254
dns-server 61.139.2.69

ip cef
no ipv6 cef

spanning-tree mode pvst

interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 10.1.12.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
!
interface FastEthernet0/1.1
encapsulation dot1Q 10
ip address 192.168.10.254 255.255.255.0
!
interface FastEthernet0/1.2
encapsulation dot1Q 20
ip address 192.168.20.254 255.255.255.0
!
interface Vlan1
no ip address
shutdown
!
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 10.1.12.0 0.0.0.255 area 0
network 2.2.2.2 0.0.0.0 area 0
ip classless
ip flow-export version 9

no cdp run

line con 0
!
line aux 0
!
line vty 0 4
login


end

右边交换机的配置
Switch#show run
Building configuration...

Current configuration : 1205 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch

spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/3
switchport access vlan 10
switchport mode access

interface Vlan1
no ip address
shutdown

line con 0
!
line vty 0 4
login
line vty 5 15
login

!

end



请大佬帮忙看看,是什么问题。还是说两边不能同时获取到同一VLAN 的地址,谢谢大家!!!!!

最佳答案

查看完整内容

子接口的地址换一下吧,两边的网络是同一张网络,IP地址是不能有重复的,除非有NAT。两边的子网一样,路由器不知道数据到底转给谁。希望能够帮助您。
发表于 2021-11-6 18:55:17 | 显示全部楼层
子接口的地址换一下吧,两边的网络是同一张网络,IP地址是不能有重复的,除非有NAT。两边的子网一样,路由器不知道数据到底转给谁。希望能够帮助您。
沙发 2021-11-6 18:55:17 收起回复
kevin870504 2023-10-4 02:04
回复 举报
專業!!!幫助很大~感謝回覆
回复

使用道具 举报

发表于 2021-11-7 14:47:14 | 显示全部楼层
666
板凳 2021-11-7 14:47:14 回复 收起回复
回复

使用道具 举报

发表于 2021-11-19 07:08:30 | 显示全部楼层
666
地板 2021-11-19 07:08:30 回复 收起回复
回复

使用道具 举报

发表于 2021-11-20 01:47:43 | 显示全部楼层
666
5# 2021-11-20 01:47:43 回复 收起回复
回复

使用道具 举报

发表于 2021-11-25 09:19:04 | 显示全部楼层
两侧vlan10 和 vlan 20地址重复,R0中继发起的DHCP discover报文源IP地址是子接口IP地址,R1收到discover报文后,因为R1上vlan10和vlan20所在网段和左侧一致,所以回包目的地址是自己直连路由,并不会回传给R0,DHCP交互失败。
6# 2021-11-25 09:19:04 回复 收起回复
回复

使用道具 举报

发表于 2022-1-25 16:25:53 | 显示全部楼层
7# 2022-1-25 16:25:53 回复 收起回复
回复

使用道具 举报

发表于 2022-5-16 12:22:31 | 显示全部楼层
是的,地址重复了
8# 2022-5-16 12:22:31 回复 收起回复
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2025-2-5 22:14 , Processed in 0.068485 second(s), 14 queries , Redis On.  

  Powered by Discuz!

  © 2001-2025 HH010.COM

快速回复 返回顶部 返回列表