I try to explain in simple steps how to do inter vlan routing.
Due to the lack of real equipment @home I used dynamips from the GNS3 package.
I built the folowing setup using 3725 routers.
R0 is the real router.
R2 is used as switch. In Slot1 I inserted a NM-16ESW which simulates the switch.
Host1 and Host2 are used as host only.
I will only post non-auto config lines.
R0
hostname R0
!
interface FastEthernet0/0
no ip address
speed 100
full-duplex
!
interface FastEthernet0/0.100
encapsulation dot1Q 100
ip address 10.0.100.1 255.255.255.0
!
interface FastEthernet0/0.200
encapsulation dot1Q 200
ip address 10.0.200.1 255.255.255.0
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
ip route 10.0.100.0 255.255.255.0 FastEthernet0/0.100
ip route 10.0.200.0 255.255.255.0 FastEthernet0/0.200
For each VLAN a subinterface has to be created. I recommend using the VLAN number but there are no rule for it.When configuring the subinterfaces enter first the encapsulation command.
encapsulation dot1Q <vlan ID>
To enable routing between VLANs you need either static routes or a routing protocol. I used static routes pointing for each subnet to its related subinterface.
R2
hostname R2
!
interface FastEthernet1/0
description Link to R0
switchport mode trunk
duplex full
speed 100
!
interface FastEthernet1/5
description Link to Host1
switchport access vlan 100
duplex full
speed 100
!
interface FastEthernet1/10
description Link to Host2
switchport access vlan 200
duplex full
speed 100
Due to this router is used as Switch only, there are no IP addresses configured. In a real scenario there would be at least a management IP normaly bound on a VLAN.Host1
hostname Host1
!
interface FastEthernet0/0
ip address 10.0.100.100 255.255.255.0
speed 100
full-duplex
!
ip route 0.0.0.0 0.0.0.0 FastEthernet0/0
Due to these routers are (mis)used as host, the have an default gateway pointing at the outgoing interface.
Host2
hostname Host2
!
interface FastEthernet0/0
ip address 10.0.200.200 255.255.255.0
speed 100
full-duplex
!
ip route 0.0.0.0 0.0.0.0 FastEthernet0/0
I highly recommend (in every environment) to use the
speed
and duplex
settings to avoid running in mismatch errors!For questions just use the comment section.
Regards,
Zif
Just a quick note for dynamips users.
AntwortenLöschenSince the dynamips build in switch can do trunking and vlan tagging it is possible to replace router R2 with this switch.
cheers NWG