Switch IP Configuration Facts
Keep in mind the following facts about IP addresses configured on switches:
- Basic switches operate at Layer 2, and therefore do not need an IP address to function. In fact, a switch performs switching functions just fine without an IP address set.
- You only need to configure a switch IP address if you want to manage the switch from a Telnet or Web session.
- The switch itself has only a single (active) IP address. Each switch port does not have an IP address (unless the switch is performing Layer 3 switching, a function which is not supported on all switches). The IP address identifies the switch as a host on the network but is not required for switching functions.
To configure the switch IP address, you set the address on the VLAN interface. This is a logical interface defined on the switch to allow management functions. By default, this VLAN is VLAN 1. Use the following commands to configure the switch IP address:
switch#config terminal
switch(config)#interface vlan 1
switch(config-if)#ip address 1.1.1.1 255.255.255.0
switch(config-if)#no shutdown
To enable management from a remote network, you will also need to configure the default gateway. Use the following command in global configuration mode:
switch(config)#ip default-gateway 1.1.1.254
Note: You can use the ip address dhcp command to configure a switch (or a router) to get its IP address from a DHCP server. The DHCP server can be configured to deliver the default gateway and DNS server addresses to the Cisco device as well. The manually-configured default gateway address overrides any address received from DHCP.
Credit: Testout 640-802 CCNA Notes