因此,我在Packet Tracer中的网络配置如下:![网络配置][1] 。
路由器是用DHCP配置的。交换机上的端口被配置为访问模式--对于那些属于PC的端口。未使用的端口被关闭了。交换机之间的端口和交换机与路由器之间的端口被配置为中继端口。所有连接到直接连接到R1的S1的PC都从路由器获得IP地址。然而,连接到S2和S3的电脑却没有--相反,他们得到的消息是 "DHCP请求失败,正在使用APIPA"。问题出在哪里?
这里是配置的链接 - https://1drv.ms/u/s!AiRtffZ-QpFphY8iof_YGdcuua3KXw
R1的配置:
ip dhcp pool Head
network 10.10.10.0 255.255.255.0
default-router 10.10.10.1
ip dhcp pool R&D
network 10.10.20.0 255.255.255.0
default-router 10.10.20.1
ip dhcp pool M&S
network 10.10.30.0 255.255.255.0
default-router 10.10.30.1
ip dhcp pool Lab
network 10.10.40.0 255.255.255.0
default-router 10.10.40.1
ip dhcp pool WS
network 10.10.50.0 255.255.255.0
default-router 10.10.50.1
no ip cef
no ipv6 cef
spanning-tree mode pvst
interface FastEthernet0/0
no ip address
ip nat inside
duplex auto
speed auto
!
interface FastEthernet0/0.1
encapsulation dot1Q 1 native
ip address 10.10.1.1 255.255.255.0
!
interface FastEthernet0/0.10
encapsulation dot1Q 10
ip address 10.10.10.1 255.255.255.0
!
interface FastEthernet0/0.20
encapsulation dot1Q 20
ip address 10.10.20.1 255.255.255.0
!
interface FastEthernet0/0.30
encapsulation dot1Q 30
ip address 10.10.30.1 255.255.255.0
!
interface FastEthernet0/0.40
encapsulation dot1Q 40
ip address 10.10.40.1 255.255.255.0
!
interface FastEthernet0/0.50
encapsulation dot1Q 50
ip address 10.10.50.1 255.255.255.0
!
interface FastEthernet0/0.99
encapsulation dot1Q 99
ip address 10.10.99.1 255.255.255.0
!
interface FastEthernet0/1
ip address 85.143.163.237 255.255.255.0
ip nat outside
duplex auto
speed auto
interface Vlan1
no ip address
shutdown
ip nat inside source list 1 interface FastEthernet0/1 overload
ip classless
ip flow-export version 9
access-list 1 permit 10.10.0.0 0.0.255.255
line con 0
line aux 0
line vty 0 4
login
对S1的配置:
spanning-tree mode pvst
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet0/2
switchport mode trunk
!
interface FastEthernet0/3
shutdown
!
interface FastEthernet0/4
switchport mode trunk
!
interface FastEthernet0/5
shutdown
!
interface FastEthernet0/6
shutdown
!
interface FastEthernet0/7
shutdown
!
interface FastEthernet0/8
shutdown
!
interface FastEthernet0/9
shutdown
!
interface FastEthernet0/10
switchport access vlan 20
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/11
switchport access vlan 20
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/12
switchport access vlan 20
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/13
switchport access vlan 20
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/14
switchport access vlan 20
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/15
switchport access vlan 10
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/16
switchport access vlan 10
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/17
switchport access vlan 30
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/18
switchport access vlan 30
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/19
switchport access vlan 30
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/20
switchport access vlan 30
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/21
switchport access vlan 20
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/22
switchport access vlan 20
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/23
switchport access vlan 30
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/24
shutdown
!
interface Vlan1
no ip address
shutdown
!
interface Vlan99
ip address 10.10.99.10 255.255.255.0
!
ip default-gateway 10.10.99.1
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
S2的配置:
spanning-tree mode pvst
!
interface FastEthernet0/1
shutdown
!
interface FastEthernet0/2
switchport mode trunk
!
interface FastEthernet0/3
switchport mode trunk
!
interface FastEthernet0/4
shutdown
!
interface FastEthernet0/5
shutdown
!
interface FastEthernet0/6
shutdown
!
interface FastEthernet0/7
shutdown
!
interface FastEthernet0/8
shutdown
!
interface FastEthernet0/9
shutdown
!
interface FastEthernet0/10
switchport access vlan 40
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/11
switchport access vlan 40
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/12
switchport access vlan 40
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/13
switchport access vlan 40
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/14
switchport access vlan 40
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/15
switchport access vlan 40
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/16
shutdown
!
interface FastEthernet0/17
shutdown
!
interface FastEthernet0/18
shutdown
!
interface FastEthernet0/19
shutdown
!
interface FastEthernet0/20
shutdown
!
interface FastEthernet0/21
shutdown
!
interface FastEthernet0/22
shutdown
!
interface FastEthernet0/23
shutdown
!
interface FastEthernet0/24
shutdown
!
interface Vlan1
no ip address
shutdown
!
interface Vlan99
ip address 10.10.99.20 255.255.255.0
!
ip default-gateway 10.10.99.1
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
S3的配置:。
spanning-tree mode pvst
!
interface FastEthernet0/1
shutdown
!
interface FastEthernet0/2
shutdown
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
shutdown
!
interface FastEthernet0/6
shutdown
!
interface FastEthernet0/7
shutdown
!
interface FastEthernet0/8
shutdown
!
interface FastEthernet0/9
shutdown
!
interface FastEthernet0/10
switchport access vlan 50
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/11
switchport access vlan 50
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/12
shutdown
!
interface FastEthernet0/13
shutdown
!
interface FastEthernet0/14
shutdown
!
interface FastEthernet0/15
shutdown
!
interface FastEthernet0/16
shutdown
!
interface FastEthernet0/17
shutdown
!
interface FastEthernet0/18
shutdown
!
interface FastEthernet0/19
shutdown
!
interface FastEthernet0/20
shutdown
!
interface FastEthernet0/21
shutdown
!
interface FastEthernet0/22
shutdown
!
interface FastEthernet0/23
shutdown
!
interface FastEthernet0/24
shutdown
!
interface Vlan1
no ip address
shutdown
!
interface Vlan99
ip address 10.10.99.30 255.255.255.0
!
ip default-gateway 10.10.99.1
line con 0
!
line vty 0 4
login
line vty 5 15
login
!