Cisco – VLAN, Trunk and OSPF

ciscoospfswitchtrunkvlan

So I have this problem in trunking that the outside hosts cant ping one another. Here is my configuration please help me and what network should I put in my OSPF?

enter image description here

VLAN Number – Port assignment

10 - Fa0/4
20 – Fa0/3, Fa0/1   
30 - FA0/2  
60 - VLAN 60    

Switch 0:

vlan 10
name Servers
!
vlan 20
name PC1, PC4
!
vlan 30
name Native
!
vlan 60
name Management
!
int f0/4
 sw mode access
 sw access vlan 10
!
int f0/3
 sw mode access
 sw access vlan 20
!
int f0/1
 sw mode access
 sw access vlan 20
!
int f0/2
 sw mode access
 sw access vlan 30
!
int vlan 60
 ip add 172.20.0.209 255.255.255.248
 no shut
!
ip default-gateway 172.20.0.1
!
int f0/2
 sw mode trunk
 sw trunk allowed vlan 10,20,30,60
!

Best Answer

you really should start reading a bit more about what you're doing. A VLAN is a broadcast domain, so computers on separate VLANs are unable to communicate without the intervention of a routing device. Any device that supports Layer 3 routing, such as a router or a multilayer switch, can be used to perform the necessary routing functionality. Regardless of the device used, the process of forwarding network traffic from one VLAN to another VLAN using routing is known as inter-VLAN routing.

I will show you an example:

Inter-Vlan Router on a stick

This called a Router-on-a-Stick, if you ping from PC1 to PC2 it goes through the router. You need to configure the VLANs on the subinterfaces on the router.

interface GigabitEthernet0/0.10
 encapsulation dot1Q 10
 ip address 172.20.0.1 255.255.255.128
!
interface GigabitEthernet0/0.20
 encapsulation dot1Q 20
 ip address 192.168.0.1 255.255.255.0

This is my subinterface configuration on the router.

With the router-on-a-stick option, appropriate IP addressing and VLAN information must be configured on each logical subinterface and a trunk encapsulation must be configured to match that of the trunking interface of the switch.

Related Topic