You must assign an IP address to the switch to gain management access
over the network. You may also need to a establish a default gateway
between the switch and management stations that exist on another network
segment. You can statically configure a specific IP address or direct
the switch to obtain an address from a Boot Protocol (BOOTP) or Dynamic
Host Configuration Protocol (DHCP) server when it is powered on. Valid
IP addresses consist of four decimal numbers, 0 to 255, separated by
periods. Anything outside this format is not accepted by the CLI
program.
NOTICE: By default, the IP address is assigned to VLAN 1 through DHCP.
If you select the
bootp or
dhcp
option, IP is enabled but does not function until a BOOTP or DHCP reply
has been received. Requests are broadcast periodically by the switch in
an effort to learn its IP address. (BOOTP and DHCP values can include
the IP address, default gateway, and subnet mask).
To display assigned IP settings using the CLI:
- From the Privileged Exec or Normal Exec level mode, type show ip interface and
press <Enter>.
The assigned IP address and subnet mask displays.
- From the Privileged Exec mode, type show ip redirects to display the assigned
gateway IP address. Press <Enter>.
The following example displays IP settings assigned by
bootp or
dhcp using the CLI.
Console#show ip interface
IP address and netmask: 10.1.0.1 255.255.252.0 on VLAN 1,
and address mode: User specified.
Console# show ip redirects
ip default gateway 10.1.0.254
Console#
Before you can assign a static IP address to
the switch, you must obtain the following information from your network
administrator:
- IP address for the switch
- Default gateway for the network
- Network mask for the network
To assign a static IP address to the switch:
- From the Privileged Exec level global configuration mode prompt, type interface
vlan 1 to access the interface-configuration mode. Press <Enter>.
- Type ip address ip-address netmask, where ip-address is the switch IP
address and netmask is the network mask for the network.
- Type exit to return to the global configuration mode prompt. Press <Enter>.
- To set the IP address of the default gateway for the network to which the switch
belongs, type ip default-gateway gateway, where gateway is the IP address of the
default gateway. Press <Enter>.
- To save your configuration changes, type copy running-config startup-config
and then press <Enter>.
NOTICE: Only one VLAN can be assigned an IP address. If you assign an address to any other
VLAN, the new address overrides the original IP address.
The following example shows how to set a static IP address using the CLI.
Console(config)# interface vlan 1
Console(config-if)# ip address 192.168.1.5 255.255.255.0
Console(config-if)# exit
Console(config)# ip default-gateway 192.168.1.254
Console(config)#
To configure the switch for DHCP or BOOTP:
- From the Privileged Exec level global configuration mode prompt, type interface
vlan 1 to access the interface-configuration mode. Press <Enter>.
- At the next prompt, use one of the following commands:
- To obtain IP settings through DHCP, type ip address dhcp
- To obtain IP setting through BOOTP, type ip address bootp
- Press <Enter>.
- To save your configuration changes, type copy running-config startup-config,
and then press <Enter>.
×