Configuring Inter-VLAN Routing 152

Configuring Inter-VLAN Routing
By default, only hosts that are members of the same VLAN can communicate. To change this
and allow inter-VLAN communication to be possible, you need a router or a layer-3 switch.
To support ISL or 802.1Q routing on a Fast Ethernet interface, the router’s interface
is divided into logical interfaces—one for each VLAN. These are called subinterfaces.
Anyway, from a Fast Ethernet or Gigabit interface, you can set the interface to trunk with
the encapsulation command:
The configuration of the switch would look something like this:
2960#config t
2960(config)#int f0/1
2960(config-if)#switchport mode trunk
2960(config-if)#int f0/2
2960(config-if)#switchport access vlan 1
2960(config-if)#int f0/3
2960(config-if)#switchport access vlan 1
2960(config-if)#int f0/4
2960(config-if)#switchport access vlan 3
2960(config-if)#int f0/5
2960(config-if)#switchport access vlan 3
2960(config-if)#int f0/6
2960(config-if)#switchport access vlan 2
Before you configure the router, you need to design your logical network:
VLAN 1: 192.168.10.16/28
VLAN 2: 192.168.10.32/28
VLAN 3: 192.168.10.48/28
The configuration of the router would then look like this:
ISR#config t
ISR(config)#int f0/0
ISR(config-if)#no ip address
ISR(config-if)#no shutdown
ISR(config-if)#int f0/0.1
ISR(config-subif)#encapsulation dot1q 1
ISR(config-subif)#ip address 192.168.10.17 255.255.255.240
ISR(config-subif)#int f0/0.2
ISR(config-subif)#encapsulation dot1q 2
ISR(config-subif)#ip address 192.168.10.33 255.255.255.240
ISR(config-subif)#int f0/0.3
ISR(config-subif)#encapsulation dot1q 3
ISR(config-subif)#ip address 192.168.10.49 255.255.255.240
The hosts in each VLAN would be assigned an address from their subnet range, and the
default gateway would be the IP address assigned to the router’s subinterface in that VLAN.