Assign the switch IP address
By default, Cisco switches perform Ethernet frames forwarding without any configuration. This means that you can buy a Cisco switch, plug in the right cables to connect various devices to the switch, power it on, and the switch should work. However, to perform switch managent over the network or use protocols such as SNMP, your switch will need to have an IP address.
The IP address is configured under a logical interface, known as the management domain or VLAN. Usually, the default VLAN 1 acts like the switch’s own NIC for connecting into a LAN to send IP packets. Here are the steps to configure an IP address under VLAN 1:
- enter the VLAN 1 configuration mode with the interface vlan 1 global configuration command.
- assign an IP address with the ip address IP_ADDRESS SUBNET_MASK interface subcommand.
- enable the VLAN 1 interface with the no shutdown interface subcommand.
- (Optional) use the ip default-gateway IP_ADDRESS global configuration command to configure the default gateway.
- (Optional) Add the ip name-server IP_ADDRESS global configuration command to configure the DNS server.
Here is a simple example:
We have a simple network of a single host and a switch. We can assign the switch with an IP address to enable IP communication between the two devices:
To verify the IP address set on a switch, we can use the show int vlan 1 command:
We can now ping SW1 from Host A: