2

I have a packet tracer file with 3 switches and 3 VLANs for a school. It is divided up into VLAN 10, 11 and 12. VLAN 10 is for classrooms 1 and 2, VLAN 11 is for classrooms 3 and 4, and VLAN 12 is for the principals office and secretary.

I am at the stage where I give each PC in each VLAN an IP address, but it does not seem to work for me as it keeps telling me APIPA is being used. I can show a configuration for each switch and I can attach a packet tracer file too if needed. I don't think I'm far from getting it working correctly. I just need someone to advise me on what I am doing wrong.

I have included DHCP pools for each VLAN in the DHCP server. Here is my switch config for each LAN switch.

hostname Lan-Switch1
!
!
!
enable secret 5 $1$mERr$nXufIEw80DqfKWVQo3J4O.
enable password 7 080C557E080A16001D1908
!
!
!
!
!
ip routing
!
!
!
!
!
!
!
!
!
!
!
!
ip ssh version 1
ip domain-name man.inishtrahill.ie
ip name-server 192.168.10.254
!
!
spanning-tree mode rapid-pvst
spanning-tree vlan 1-4094 priority 24576
!
!
!
!
!
!
interface FastEthernet0/1
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/2
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/3
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/4
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/5
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/6
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/7
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/8
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/9
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/10
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/11
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/12
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/13
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/14
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/15
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/16
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/17
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/18
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/19
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/20
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/21
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/22
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/23
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/24
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface GigabitEthernet0/1
 switchport trunk native vlan 999
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface GigabitEthernet0/2
 switchport trunk native vlan 999
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface Vlan1
 no ip address
 shutdown
!
interface Vlan10
 description classroom 1 and classroom 2
 ip address 192.168.10.1 255.255.255.0
 ip helper-address 192.168.10.254
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
logging 192.168.10.254
line con 0
 exec-timeout 6 50
 password 7 080C556D061716181E0E
 logging synchronous
 login
!
line aux 0
!
line vty 0 4
 exec-timeout 5 30
 password 7 080C557A0C150B1206
 logging synchronous
 login
line vty 5 15
 exec-timeout 5 30
 password 7 080C557E080A16001D1908
 logging synchronous
 login
!
!
ntp authentication-key 1 md5 0832494D1B1C112713181F13253920 7
ntp server 192.168.10.254 key 0
!
end

Lan-Switch2 Config

hostname Lan-Switch2
!
enable secret 5 $1$mERr$nXufIEw80DqfKWVQo3J4O.
!
!
!
!
!
spanning-tree mode rapid-pvst
!
interface FastEthernet0/1
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/2
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/3
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/4
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/5
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/6
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/7
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/8
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/9
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/10
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/11
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/12
 switchport access vlan 10
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/13
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/14
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/15
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/16
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/17
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/18
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/19
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/20
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/21
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/22
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/23
 switchport access vlan 11
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface FastEthernet0/24
 switchport access vlan 11
 switchport mode access
 spanning-tree portfast
 spanning-tree guard root
!
interface GigabitEthernet0/1
 switchport trunk native vlan 999
 switchport mode trunk
!
interface GigabitEthernet0/2
 switchport trunk native vlan 999
 switchport mode trunk
!
interface Vlan1
 no ip address
 shutdown
!
interface Vlan10
 description Interface to Netman
 ip address 192.168.10.2 255.255.255.0
!
interface Vlan11
 description classroom 3 and classroom 4
 ip address 192.168.10.2 255.255.255.0
 ip helper-address 192.168.10.254
!
logging 192.168.10.254
!
!
!
line con 0
 password 7 080C556D061716181E0E
 logging synchronous
 login
 exec-timeout 6 50
!
line vty 0 4
 login
line vty 5 15
 login
!
!
end

Lan-Switch3 Config

hostname Lan-Switch3
!
enable secret 5 $1$mERr$nXufIEw80DqfKWVQo3J4O.
!
!
!
!
!
spanning-tree mode rapid-pvst
!
interface FastEthernet0/1
 switchport access vlan 12
 switchport mode trunk
 spanning-tree portfast
!
interface FastEthernet0/2
 switchport access vlan 12
 switchport mode trunk
 spanning-tree portfast
!
interface FastEthernet0/3
 switchport access vlan 12
 switchport mode trunk
 spanning-tree portfast
!
interface FastEthernet0/4
 switchport access vlan 12
 switchport mode trunk
 spanning-tree portfast
!
interface FastEthernet0/5
 spanning-tree portfast
!
interface FastEthernet0/6
 spanning-tree portfast
!
interface FastEthernet0/7
 spanning-tree portfast
!
interface FastEthernet0/8
 spanning-tree portfast
!
interface FastEthernet0/9
 spanning-tree portfast
!
interface FastEthernet0/10
 spanning-tree portfast
!
interface FastEthernet0/11
 spanning-tree portfast
!
interface FastEthernet0/12
 spanning-tree portfast
!
interface FastEthernet0/13
 spanning-tree portfast
!
interface FastEthernet0/14
 spanning-tree portfast
!
interface FastEthernet0/15
 spanning-tree portfast
!
interface FastEthernet0/16
 spanning-tree portfast
!
interface FastEthernet0/17
 spanning-tree portfast
!
interface FastEthernet0/18
 spanning-tree portfast
!
interface FastEthernet0/19
 spanning-tree portfast
!
interface FastEthernet0/20
 spanning-tree portfast
!
interface FastEthernet0/21
 spanning-tree portfast
!
interface FastEthernet0/22
 spanning-tree portfast
!
interface FastEthernet0/23
 switchport access vlan 12
 switchport mode access
 spanning-tree portfast
!
interface FastEthernet0/24
 switchport access vlan 12
 switchport mode access
 spanning-tree portfast
!
interface GigabitEthernet0/1
 switchport trunk native vlan 999
 switchport mode trunk
!
interface GigabitEthernet0/2
 switchport trunk native vlan 999
 switchport mode trunk
!
interface Vlan1
 no ip address
 shutdown
!
interface Vlan10
 description Interface to Netman
 ip address 192.168.10.3 255.255.255.0
!
interface Vlan12
 description secretary and principal
 ip address 192.168.10.3 255.255.255.0
 ip helper-address 192.168.10.254
!
logging 192.168.10.254
!
!
!
line con 0
 password 7 080C556D061716181E0E
 logging synchronous
 login
 exec-timeout 6 50
!
line vty 0 4
 login
line vty 5 15
 login
!
!
end
14
  • Do you have a router (or a layer-3 switch that has routing enabled)? You need that to get traffic from one VLAN to another VLAN.
    – Ron Maupin
    Nov 2, 2017 at 14:02
  • I have 3 switches.
    – GreenCoder
    Nov 2, 2017 at 14:03
  • I have a 3560 switch and 2 x 2960 switches
    – GreenCoder
    Nov 2, 2017 at 14:04
  • VLANs can only communicate via layer-3, either a router, or a layer-3 switch that has routing enabled.
    – Ron Maupin
    Nov 2, 2017 at 14:05
  • Im able to ping across vlans though. with no gateway. its strange
    – GreenCoder
    Nov 2, 2017 at 14:08

3 Answers 3

3

The correct way to do what you want is to put the SVIs on the layer-3 switch that is doing the routing, and place the ip helper-address command on the SVIs for the VLANs which do not have the DHCP server.

You also have a problem where you have all three VLANs using the same layer-3 network (192.168.10.0.0/24). Each VLAN should be have a different network, e.g. VLAN 10 192.168.10.0/24, VLAN 11 192.168.11.0/24, and VLAN 12 192.168.12.0/24.

I will assume the above IP/VLAN addressing, and that your DHCP server is on VLAN 10 at 192.168.10.254. I will also assume that you want to manage the switches on VLAN 10, and that Switch 1 G0/1 connects to Switch 2 G0/1 and Switch 1 G0/2 connects to Switch 3 G0/1. Switch 1 is configured with all its FastEthernet interfaces in VLAN 10, Switch 2 is configured with all its FastEthernet interfaces in VLAN 11, and Switch 3 is configured with all its FastEthernet interfaces in VLAN 12. (Because you are trunking, you can put any VLAN on any of the switch FastEthernet interfaces, but I am simplifying it to start because I don't actually have a diagram.) Globally enabling portfast and bpduguard will enable them on all access interface, but not the trunk interfaces (normally what you want). You should also define the VLANs at layer-2, not just on the SVI and switch interfaces.

You need to configure the DHCP scopes so that each VLAN has a gateway pointing to the Switch 1 SVI address for that VLAN. VLAN 10 192.168.10.1, VLAN 11 192.168.11.1, and VLAN 12 192.168.12.1.

Switch 1 configuration changes:

spanning-tree portfast default
spanning-tree portfast bpduguard default
!
Vlan10
 name Classroom_1_and_2
!
Vlan11
 name Classroom_3_and_4
!
Vlan12
 name Secretary_and_Principal
!
interface range FastEthernet0/1 - 24
 switchport access vlan 10
 switchport mode access
!
interface GigabitEthernet0/1
 description Connection to Switch 2 GigabitEthernet0/1
 switchport trunk native vlan 999
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface GigabitEthernet0/2
 description Connection to Switch 3 GigabitEthernet0/1
 switchport trunk native vlan 999
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface Vlan10
 description classroom 1 and classroom 2
 ip address 192.168.10.1 255.255.255.0
 no ip helper-address 192.168.10.254
!
interface Vlan11
 description classroom 3 and classroom 4
 ip address 192.168.11.1 255.255.255.0
 ip helper-address 192.168.10.254
!
interface Vlan12
 description secretary and principal
 ip address 192.168.12.1 255.255.255.0
 ip helper-address 192.168.10.254
!

Switch 2 configuration changes:

spanning-tree portfast default
spanning-tree portfast bpduguard default
!
Vlan10
 name Classroom_1_and_2
!
Vlan11
 name Classroom_3_and_4
!
Vlan12
 name Secretary_and_Principal
!
interface range FastEthernet0/1 - 24
 switchport access vlan 11
 switchport mode access
!
interface GigabitEthernet0/1
 description Connection to Switch 1 GigabitEthernet0/1
 switchport trunk native vlan 999
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface GigabitEthernet0/2
 description UNUSED
 shutdown
!
interface Vlan10
 description classroom 1 and classroom 2
 ip address 192.168.10.2 255.255.255.0
 no ip helper-address 192.168.10.254
!
no interface Vlan11
!

Switch 3 configuration changes:

spanning-tree portfast default
spanning-tree portfast bpduguard default
!
Vlan10
 name Classroom_1_and_2
!
Vlan11
 name Classroom_3_and_4
!
Vlan12
 name Secretary_and_Principal
!
interface range FastEthernet0/1 - 24
 switchport access vlan 12
 switchport mode access
!
interface GigabitEthernet0/1
 description Connection to Switch 1 GigabitEthernet0/2
 switchport trunk native vlan 999
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface GigabitEthernet0/2
 description UNUSED
 shutdown
!
interface Vlan10
 description classroom 1 and classroom 2
 ip address 192.168.10.3 255.255.255.0
 no ip helper-address 192.168.10.254
!
no interface Vlan12
!
11
  • Ok i made the changes. Should my DHCP server 192.168.10.254 have pools in it for switch 2 or 3 ? How should that be set up
    – GreenCoder
    Nov 2, 2017 at 18:01
  • You need a DHCP pool for each VLAN network. That would be three separate DHCP pools.
    – Ron Maupin
    Nov 2, 2017 at 18:04
  • Ok Gotcha. I will put those in now and test it.
    – GreenCoder
    Nov 2, 2017 at 18:05
  • Ok vlan 11 and 12 are now receiving ip addresses from the DHCP server and they are recognising their default gateways. hosts on vlan 10 are not recognising their default gateway of 192.168.10.1. Each host on vlan has an ip address though and can ping switch 1
    – GreenCoder
    Nov 2, 2017 at 18:19
  • There must be a problem with the VLAN 10 DHCP pool for 192.168.10.0/24. Unfortunately, questions about protocols above OSI layer-4, e.g. DHCP, and host configurations are off-topic here. What I gave you is what should work for the network, which is what is on-topic here.
    – Ron Maupin
    Nov 2, 2017 at 18:22
0

You need to have a DHCP server on each VLAN to make dynamic addresses work. All VLANs have to be connected by a router to enable communication between them.

Alternatively to connecting a central DHCP server to each VLAN, many switches support DHCP relay where the switch helps a VLAN client by forwarding the DHCP traffic to the server and back. The exact setup procedure depends on the type of switch you're using.

Feel free to add switch and router configurations, a network chart and similar to your question and I'll expand the answer.

3
  • I managed to get a DHCP server put into each vlan. It is giving out IP addresses now. Still no Default gateway being put onto each host though.
    – GreenCoder
    Nov 2, 2017 at 14:02
  • You need to configure the DHCP options on the scope to set the default gateway for your clients.
    – Zac67
    Nov 2, 2017 at 20:22
  • It works for VLAN 11 and VLAN 12 but not VLAN 10. I dont understand why it isnt working. I have checked the DHCP pool in the DHCP server.
    – GreenCoder
    Nov 2, 2017 at 20:39
0

For assigning ip address dynamically on PCs connected on access-switch(layer2) Vlan 10 configured interface .DHCP scope configuration is required on core switch where SVI are configured .

In layer3 switch (core switch)

DHCP configuration is required in core switch for allocation ip address dynamically to clients

Switch(config)#ip DHCP pool Vlan10 Switch(config#network 192 .168.10.0 255.255.255.0 Switch(config)# default-gateway 192 .168.10.1 Switch(config)# dns server 8.8.8 8 Switch(config) # lease time X.X X X Switch(config)# no shutdown

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.