Interface VLAN command on a Router
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2018 07:00 PM - edited 03-08-2019 02:55 PM
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.
- Labels:
-
Other Switching
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2018 08:45 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2018 10:07 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2018 04:38 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2018 10:12 AM
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
Rick
