First of all, we must define the difference between a VLAN and a VLAN Interface.
A VLAN is a virtual LAN found within the switch. It’s definition simply states that a subdivision of the switch exists within which a single subnet will function. A VLAN is created using the
vlan command such as
vlan 40. Such a command just defines the new VLAN with a VLAN ID.
A VLAN Interface, more correctly known as a Switched Virtual Interface (SVI) is a virtual interface that functions in the same way as a layer 3 physical interface. It is an interface that exists on the VLAN number it represents, and can be assigned an IP address, be shutdown or enabled, or have other configurations that can be applied to any interface. An SVI will most often function as the default gateway of the subnet that corresponds to the VLAN ID. In other words, the VLAN10 interface functions as the default gateway for all clients in the 10.10.10.0/24 subnet.
In order for a layer 3 switch to function correctly, you MUST configure both a VLAN and an SVI. By creating the VLAN interface, the VLAN is automatically created, but it doesn’t go the other way around.
So, in the above configuration, you have created an SVI in VLAN 10 (this automatically creates the VLAN as well) and assigned it an IP address. The same happend for VLAN 20, and yes you are correct, that interVLAN routing makes those two VLANs communicate.
Now you created another SVI for VLAN30, so VLAN 30 was also created. But, you haven’t assigned an IP address to this interface. That’s fine, but you won’t be able to have inter-VLAN routing between VLAN 30 and the other VLANs if you don’t, and SVIs are usually created for this purpose.
Finally, you created VLAN 40 but this does not automatically create a corresponding SVI, you must do that manually, so any ports on VLAN 40 will be isolated from any other networks.
None of the above configurations are wrong, it really depends on what you want to do. You may want VLAN 40 to be completely isolated from everything else, and that’s fine. I hope the above explanations have made the various entities you create for VLANs clearer for you. If you have any other questions for clarification, please feel free to ask!
I hope this has been helpful!