cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
729
Views
0
Helpful
4
Replies

Interface VLAN command on a Router

DaveU
Level 1
Level 1

I don't understand how this works on a router. If i configure two of these, how can a device know what interface they are connecting to? In the example below, how can the router know what vlan a connecting device must be on?

 

Interface Vlan10

ip address 192.168.10.1 255.255.255.0

 

interface Vlan20

ip address 192.168.20.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

 

And also, I tried configuring this on packet tracer with a simple network and the PCs can't seem to have dhcp address.

4 Replies 4

Francesco Molino
VIP Alumni
VIP Alumni
Hi

This is based on vlan where devices are attached to.
Your router is connected to a switch, then you should have a trunk passing vlan id you've allowed.
Or your router has switch ports then you have configure vlan on these access ports where devices belongs to.

Based on this dot1q tag, they'll belong to a vlan and they'll get the right ip from this vlan.

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

Thanks for replying Francesco. What if there's no switch involved? Can you give me an example?

If there's two users connect to that network, what vlan are they going to belong to?

 

I already know how vlan work on a switch where you need to associate a port to a vlan but how does that work on a router? I'm confused.

Which switch platform are you using and what's the config?
Do you have any switching port on your router?
It works the same way when talking about vlans.

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

Let me approach answering this question from a different perspective. What is given in the original post might work on some routers and would not work on other routers. Some routers have interfaces that operate as switch ports, such as some of the 800 series routers. Other routers may have a switch module as part of the router. On these types of routers you could configure some interfaces to belong to vlan 10 and some interfaces to belong to vlan 20. To determine what address a host would receive you need to check what physical port they are connected to and determine what vlan that port is assigned to.

 

Other routers have only routed ports. On these routers you can not configure vlan interfaces as is suggested in the original post.

 

HTH

 

Rick

HTH

Rick
Review Cisco Networking for a $25 gift card