A good thing about the Cisco IOS is that it works quite similarly on both the routers as well as switches. However, there is a difference in the commands that we use for each one of them. For example, some specific commands are meant only for the switches while others for routers as per the device’s functionality.
Basic Switch configuration
To assign an IP address to the VLAN1 interface, we have to enter into interface configuration mode. While configuring switch for basic functionality, we should also assign a default gateway to the switch. It is important to remember that the VLAN1 interface and default gateway IP address must be on the same network. This enables the switch to redirect traffic to other networks.
To save configuration on Cisco devices we can type the command ‘write’. It copies running config to the startup config.
While configuring Cisco devices, we can make some typing mistakes. If we mistype a command then Cisco device would try to resolve the name to the IP address. This makes Cisco devices to freeze for about 60 seconds as it resolves IP address in the background. One minute is the maximum time taken by the device. Now, we have to wait until the device allows us to type something again. This can be very annoying. It happens because the domain name lookup is enabled by default in Cisco devices. Hence, to solve this problem we can disable domain lookup by entering the command ‘No IP Domain Lookup’.
Now, let us talk about the status messages received on Cisco devices. When we receive status messages on Cisco devices the message kind-of mixes with the text that we type on the CLI. This can also be very confusing sometimes. So, to solve this problem we can type the command ‘logging synchronous’. This command synchronizes the status messages. Hence, the message does not interfere with our typing.
- Assign IP address of the switch – 192.168.4.2/24
- Set default gateway of the switch to 192.168.4.1
- Save configuration
- Disable domain lookup
- Synchronize switch’s status messages
Switch(config)#interface vlan 1
Switch(config-if)#ip address 192.168.4.2 255.255.255.0
Switch(config)#ip default-gateway 192.168.4.1
Router(config)#no ip domain lookup
Switch(config)#line con 0