In this short lab, I use two Cisco Catalyst 3550 switches [IOS 12.2(44)SE6] to demonstrate the default port and VLAN behavior on a Cisco switch running IOS. Below is the network diagram for this lab.
As a side-note – by default, when a command in user or enable mode is entered on a Cisco IOS switch and the command is not recognized, the switch believes it is a host name and that the user is attempting to reach the respective host via telnet. In consequence, the switch tries to resolve the unrecognized command to an IP address by doing an IP domain lookup. If no domain server is configured on the switch, the switch will issue a broadcast for the command to be translated into an IP address as shown below; it can take several seconds for the switch prompt to return because the switch waits for a response from its Domain Name System (DNS) broadcast.
The “transport preferred none” command can be used on the vty/con/aux line(s) to prevent the switch from attempting to resolve an invalid command to an IP address. Below, I use the “no ip domain lookup” command in ‘config’ mode to globally disable the default behavior of the switch to attempt to resolve the invalid command to an IP address.
By default, on a Cisco switch running IOS, the port mode on all interfaces is set to “switchport mode dynamic desirable”; this means when two Cisco IOS devices are connected to each other, they will automatically try to negotiate and setup a trunk link. Note, this is not the case in all vendor switches and may or may not be desirable to the end-user. For example, on Dell Force10/FTOS switches, a trunk link is explicitly specified by declaring which VLANs can be trunked over the respective link. See my prior blog for more info “Trunking and DHCP Across Dell Force10 Switches.”
In this lab setup, port ‘FastEthernet 0/2’ on each switch is used to connect the switches to each other; since these switches are the older model and don’t auto-detect the cable type, I make sure to use a crossover Ethernet cable due to the fact that I’m connecting two devices of the same type. Below is a screenshot of the default configuration on switch Cisco_3550_Panther’s ‘FastEthernet 0/2’ interface. The configuration is identical on the other Cisco switch.
You can see all ‘switchport’ modes available via the “switchport mode ?” command as shown below.
To test that a trunk link is indeed created by default when connecting two Cisco switches, I create VLAN 5 on each switch and assign port ‘FastEthernet 0/5’ to it; I also assign the VLAN an IP address. Although, the ‘FastEthernet 0/5’ ports are not connected to each other, I should be able to ping both IP addresses from either Cisco switch via the auto-created trunk link. Below, I setup the test VLAN configuration on ‘Cisco_3550_Panther’ using IP address 5.0.0.1/24 and test pinging the IP address on the other switch. The same configuration is applied to the other switch, except an IP address of 5.0.0.2/24 is used instead. As you can see below, the results are as expected.
Looking at the output of the ‘show vlan’ command below, you can see that ‘Fa0/2’ is missing from the default VLAN all ports are initially placed in; this is because when the switches were connected to each other via port ‘FastEthernet 0/2’, the ports automatically negotiated to a trunk link as expected due to the “switchport mode dynamic desirable” command on each port. If the other port on the opposing switch would have been configured with the respective encapsulation method and as “switchport mode trunk”, the auto-configuration would have still worked. For the trunk link to be automatically formed, the opposing switch port must be set to either “switchport mode dynamic desirable” or “switchport mode trunk”.
Also, note all interfaces and VLANs are enabled by default. In this example, port ‘FastEthernet 0/5’ was placed in VLAN 5 on each switch, but this was not required for the test to pass; all that was required was an IP address on VLAN 5 on each switch and a trunk link connecting the switches together. If one of the ports on the trunk link is set to the wrong mode or disconnected, you’ll still see VLAN 5 as active, under the ‘Status’ field of the output, however, a log message will be shown stating the “Line protocol on Interface FastEthernet0/2, changed state to down”. When looking at the output of the “show ip interface brief” command, you’ll see that the VLAN 5 ‘Status’ field states ‘up’, but the ‘Protocol’ field states ‘down’. This is true even if there are no ports in VLAN 5.