大家好!本人刚学CISCO配置,现在研究实现了DHCP功能的同一路由下VLAN间的互访,但是发现如果实现了DHCP,VLAN间就没法互访了,具体配置如下:

路由器(CISCO 2811)(拓扑图就不上了,简单说一下,2811 f0/0,f0/1分别接两个2960交换机f0/24 ,f0/24启用了trunk链路)

interface FastEthernet0/0

 no ip address

 duplex auto

 speed auto

!

interface FastEthernet0/0.1

 encapsulation dot1Q 10

 ip address 192.168.10.1 255.255.255.0

!

interface FastEthernet0/0.2

 encapsulation dot1Q 20

 ip address 192.168.20.1 255.255.255.0

!

interface FastEthernet0/1

 no ip address

 duplex auto

 speed auto

!

interface FastEthernet0/1.1

 encapsulation dot1Q 30

 ip address 192.168.30.1 255.255.255.0

!

interface FastEthernet0/1.2

 encapsulation dot1Q 40

 ip address 192.168.40.1 255.255.255.0



ip dhcp pool vlan10

 network 192.168.10.0 255.255.255.0

 default-router 192.168.10.1

ip dhcp pool vlan20

 network 192.168.20.0 255.255.255.0

 default-router 192.168.20.1

ip dhcp pool vlan30

 network 192.168.30.0 255.255.255.0

 default-router 192.168.30.1

ip dhcp pool vlan40

 network 192.168.40.0 255.255.255.0

 default-router 192.168.40.1


交换机(CISCO 2960)

两个2960交换机,分别配置了VLAN 10 20 和30 40,并且指定了IP 


交换机一


interface FastEthernet0/1

 switchport access vlan 10

!

interface FastEthernet0/2

 switchport access vlan 10

!

interface FastEthernet0/3

 switchport access vlan 10

!

interface FastEthernet0/4

 switchport access vlan 10

!

interface FastEthernet0/5

 switchport access vlan 10

!

interface FastEthernet0/6

 switchport access vlan 10

!

interface FastEthernet0/7

 switchport access vlan 10

!

interface FastEthernet0/8

 switchport access vlan 10

!

interface FastEthernet0/9

 switchport access vlan 10

!

interface FastEthernet0/10

 switchport access vlan 10

!

interface FastEthernet0/11

 switchport access vlan 10

!

interface FastEthernet0/12

 switchport access vlan 20

!

interface FastEthernet0/13

 switchport access vlan 20

!

interface FastEthernet0/14

 switchport access vlan 20

!

interface FastEthernet0/15

 switchport access vlan 20

!

interface FastEthernet0/16

 switchport access vlan 20

!

interface FastEthernet0/17

 switchport access vlan 20

!

interface FastEthernet0/18

 switchport access vlan 20

!

interface FastEthernet0/19

 switchport access vlan 20

!

interface FastEthernet0/20

 switchport access vlan 20

!

interface FastEthernet0/21

 switchport access vlan 20

!

interface FastEthernet0/22

 switchport access vlan 20

!

interface FastEthernet0/23

 switchport access vlan 20

!

interface FastEthernet0/24

 switchport trunk allowed vlan 10,20

 switchport mode trunk

!

interface GigabitEthernet1/1

!

interface GigabitEthernet1/2

!

interface Vlan1

 no ip address

 shutdown

!

interface Vlan10

 ip address 192.168.10.1 255.255.255.0

!

interface Vlan20

 ip address 192.168.20.1 255.255.255.0



交换机二


interface FastEthernet0/1

 switchport access vlan 30

!

interface FastEthernet0/2

 switchport access vlan 30

!

interface FastEthernet0/3

 switchport access vlan 30

!

interface FastEthernet0/4

 switchport access vlan 30

!

interface FastEthernet0/5

 switchport access vlan 30

!

interface FastEthernet0/6

 switchport access vlan 30

!

interface FastEthernet0/7

 switchport access vlan 30

!

interface FastEthernet0/8

 switchport access vlan 30

!

interface FastEthernet0/9

 switchport access vlan 30

!

interface FastEthernet0/10

 switchport access vlan 30

!

interface FastEthernet0/11

 switchport access vlan 30

!

interface FastEthernet0/12

 switchport access vlan 40

!

interface FastEthernet0/13

 switchport access vlan 40

!

interface FastEthernet0/14

 switchport access vlan 40

!

interface FastEthernet0/15

 switchport access vlan 40

!

interface FastEthernet0/16

 switchport access vlan 40

!

interface FastEthernet0/17

 switchport access vlan 40

!

interface FastEthernet0/18

 switchport access vlan 40

!

interface FastEthernet0/19

 switchport access vlan 40

!

interface FastEthernet0/20

 switchport access vlan 40

!

interface FastEthernet0/21

 switchport access vlan 40

!

interface FastEthernet0/22

 switchport access vlan 40

!

interface FastEthernet0/23

 switchport access vlan 40

!

interface FastEthernet0/24

 switchport trunk allowed vlan 30,40

 switchport mode trunk

!

interface GigabitEthernet1/1

!

interface GigabitEthernet1/2

!

interface Vlan1

 no ip address

 shutdown

!

interface Vlan30

 ip address 192.168.30.1 255.255.255.0

!

interface Vlan40

 ip address 192.168.40.1 255.255.255.0


现在的问题是:DHCP自动获取正常,但VLAN间无法互访,请高手指导一下,怎么样改写才能实现DHCP下的VLAN间互访(本人已实验过如果取消DHCP,手动指定PC的IP地址是能实现互访的)。