Yesterday I had a look at my router configuration, and I saw that my office's local LAN gateway's IP address is written on the router's VLAN1 interface.
- What is a VLAN1 interface in a router?
- Is it different from a switch's VLAN?
- Why is it not configured on a gigabit interface?
- Does it mean that all interfaces refer to VLAN1?
- If yes, how can we assign each port to VLAN1?
- How can we create VLANs?
Best Answer
Since you have not included the router model, I will assume it is a Cisco router, something like an ISR with a built-in switch module.
Some Cisco routers can have a built-in or optional, add-on switch modules. The interfaces for this module are switch interfaces, not router interfaces. You need to create VLAN interfaces to link the layer-2 switch to the layer-3 router.
You configure the switch interfaces the same way that you do for a layer-2 switch. They are switch interfaces, not router interfaces, so you cannot configure layer-3 on those interfaces. That is where the SVIs come in. You assign a VLAN to each switch interface, and create an SVI for each VLAN. The SVIs get configured with the layer-3 information for the VLAN. The layer-3 addresses configured on the SVIs will be the gateways for the VLANs.
The router will also have some router interfaces that get configured for layer-3. Routers will, by default, route everything between its layer-3 interfaces, including SVIs configured for layer-3.
Let's assume you have eight switch interfaces (GigabitEthernet0 - 7), and two router interfaces (GigabitEthernet8 - 9), like a Cisco 892 router. There are two connections to other routers, and there are four VLANs (two switch interfaces on each VLAN). The first eight interfaces are switch interfaces, and they are configured like a layer-2 switch. The last two interfaces are router interfaces, and they are configured with layer-3. The four VLAN interfaces are configured as layer-3 interfaces. Routing between the VLANs and the router interfaces will happen, as long as they are configured for layer-3, and there are no other configurations to block, e.g. ACLs. The gateways for the VLANs will be the addresses configured on the VLAN interfaces.
You could have something like this: