cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

2 Switches 1 Router using Dynamic IP Addressing

751
Views
0
Helpful
5
Comments

Screenshot 2020-04-11 at 16.27.40.png

 

 

Hello, the router is unable to assign IP address to the 192.168.20 subnet

Here are what I did

1 - On SW1 

Create clan 10 - HR

int fa0/1 - 2 switch port mode access

switch port access vlan 10

int fa0/24 - switchport mode access, switchport mode trunk

int gi0/1 switchport mode access, switchport mode trunk

2 - On SW2 

Created VLAN 20 - IT

int fa0/3 - 4 Switchport mode access, switchport access clan 20

int gi0/1 switchport mode access, switchport mode trunk

3 - On the Router

int gi0/0/0

no shut

int gi0/0/0.10

encapsulation dot1q 10

IP address 192.168.10.254 255.255.255.0

exit

int gi0/0/0.20

encapsulation dot1q 20

IP address 192.168.20.254 255.255.255.0

exit

ip dhcp pool HR

default-router 192.168.10.254

network 192.168.10.0 255.255.255.0

exit

ip dhcp pool IT

default-router 192.168.20.254

network 192.168.20.0 255.255.255.0

exit

Now select PC 1 - PC2 on switch1 and enabled DHCP

Result - IP assigned as expected within 192.168.10.1 - etc

Now on PC3 - PC4 on Switch2

Selected DHCP

Result - Failed to assign IP address and APIPA was used

So what am doing wrong, I have tried removing the trunk on gi0/1 from SW2 but switch does not come on when removed. thanks in advance 

Comments

If you can, please upload the project so I can double-check, but it appears that you haven't added VLAN0020 to Switch 1, right? This is likely the issue, as I've sent his be an issue in production. Add VLAN0020 to the switch and activate and see if the trunks allow the VLAN. 

 

If not, upload the project and I can take a look.

Beginner

@SammyAko79750 wrote:

Screenshot 2020-04-11 at 16.27.40.png

 

 

Hello, the router is unable to assign IP address to the 192.168.20 subnet

Here are what I did

1 - On SW1 

Create clan 10 - HR

int fa0/1 - 2 switch port mode access

switch port access vlan 10

int fa0/24 - switchport mode access, switchport mode trunk

int gi0/1 switchport mode access, switchport mode trunk

2 - On SW2 

Created VLAN 20 - IT

int fa0/3 - 4 Switchport mode access, switchport access clan 20

int gi0/1 switchport mode access, switchport mode trunk

3 - On the Router

int gi0/0/0

no shut

int gi0/0/0.10

encapsulation dot1q 10

IP address 192.168.10.254 255.255.255.0

exit

int gi0/0/0.20

encapsulation dot1q 20

IP address 192.168.20.254 255.255.255.0

exit

ip dhcp pool HR

default-router 192.168.10.254

network 192.168.10.0 255.255.255.0

exit

ip dhcp pool IT

default-router 192.168.20.254

network 192.168.20.0 255.255.255.0

exit

Now select PC 1 - PC2 on switch1 and enabled DHCP

Result - IP assigned as expected within 192.168.10.1 - etc

Now on PC3 - PC4 on Switch2

Selected DHCP

Result - Failed to assign IP address and APIPA was used

So what am doing wrong, I have tried removing the trunk on gi0/1 from SW2 but switch does not come on when removed. thanks in advance 


Hello Steven,

Please can you explain why I should add VLAN 20 to SW1, when SW1 is VLAN 10. Also do you mean to say I should create VLAN 20 in SW1 and also give switchport access to clan 20, even though the clients are assigned to VLAN 10?

When you create a VLAN, it creates a virtual interface for that VLAN. If the virtual interface doesn't exist, it doesn't get passed, even when tagged. I suppose it's to keep the whole 4094 VLAN thing from going nuts and being able to be passed at all times. Probably a security thing somewhere too - I don't profess to know everything about the interworkings of these things.

 

Anyway, I just did a trial run on Packet Tracer and it appears to reflect my statement. All you have to do on Switch 1 is the following commands:

 

vlan 20

name {whatever, or leave blank}

int vlan 20

end

 

I did have to recycle the port on the PC object before it worked (because … you know... realistic in no scenario - should just let you do a renew...) but it came right up afterwards. No other config necessary, as it appears the rest is golden.

Beginner

@SammyAko79750 wrote:

Screenshot 2020-04-11 at 16.27.40.png

 

 

Hello, the router is unable to assign IP address to the 192.168.20 subnet

Here are what I did

1 - On SW1 

Create clan 10 - HR

int fa0/1 - 2 switch port mode access

switch port access vlan 10

int fa0/24 - switchport mode access, switchport mode trunk

int gi0/1 switchport mode access, switchport mode trunk

2 - On SW2 

Created VLAN 20 - IT

int fa0/3 - 4 Switchport mode access, switchport access clan 20

int gi0/1 switchport mode access, switchport mode trunk

3 - On the Router

int gi0/0/0

no shut

int gi0/0/0.10

encapsulation dot1q 10

IP address 192.168.10.254 255.255.255.0

exit

int gi0/0/0.20

encapsulation dot1q 20

IP address 192.168.20.254 255.255.255.0

exit

ip dhcp pool HR

default-router 192.168.10.254

network 192.168.10.0 255.255.255.0

exit

ip dhcp pool IT

default-router 192.168.20.254

network 192.168.20.0 255.255.255.0

exit

Now select PC 1 - PC2 on switch1 and enabled DHCP

Result - IP assigned as expected within 192.168.10.1 - etc

Now on PC3 - PC4 on Switch2

Selected DHCP

Result - Failed to assign IP address and APIPA was used

So what am doing wrong, I have tried removing the trunk on gi0/1 from SW2 but switch does not come on when removed. thanks in advance 


Steven,

Thanks for your time - I created and named clan 20 in SW1 and int clan 20 - the SW2 clients were able to get dynamic IPs as expected - maybe you might to enlighten me bit about the 4094 concept - I am just studying/ learning Networking at the moment 

Thanks again cheers bro 

All good.

 

As far as the 4094 concept, it's an easy thing: there are 4094 possible VLANs (from 1 - 4094). There are several reserved VLANs in there for legacy stuff like FDDI and whatnot, but ultimately that's the total number of VLANs you can use. Naturally, that's a bunch to have on a switch if you don't need them, so the VLAN database (typically vlan.dat in flash) only has entries of what you specify. If you do not specify the VLAN (by going into "vlan #") it will not be available to switch forward or back. Even then, if you don't initialize the port ("interface vlan #"), the line protocol is down - even stranger, it doesn't even show up in "show interface vlan #" on some models.

 

Anyway, that's the 4094 VLAN thing.

Content for Community-Ad