Configuring an IP address for the device
You must configure at least one IP address using the serial connection to the CLI before you can manage the device using the other management interfaces. You can use the classical IP network masks (Class A, B, and C subnet masks, and so on) or Classless Interdomain Routing (CIDR) network prefix masks.
- To enter a classical IP network mask, enter the mask in IP address format. For example, enter "10.157.22.99 255.255.255.0" for an IP address with a Class C subnet mask.
- To enter a prefix number for a network mask, enter a forward slash (/) and the number of bits in the mask immediately after the IP address. For example, enter "10.157.22.99/24" for an IP address that has a network mask with 24 significant ("mask") bits.
- At the opening CLI prompt, enter the following commands.
device> enable device# erase startup-config device# configure terminalNOTEUse the erase startup-config command only for new systems. If you enter this command on a system you have already configured, the command erases the configuration. If you accidentally erase the configuration on a configured system, enter the write memory command to save the running configuration to the startup-config file.
- Enter the following commands to assign an IP address for a device running Layer 2 software.
device(config)# ip address 10.22.3.44 255.255.255.0 device(config)# ip default-gateway 10.22.3.1 device(config)# write memoryNOTEYou do not need to assign a default gateway address for single subnet networks.
Enter the following commands to add an IP address and mask to a router port on a device running Layer 3 software.
device(config)# interface ethernet 1 device(config)# ip address 10.22.3.44 255.255.255.0 device(config)# write memoryNOTEBefore attaching any equipment to a device running Layer 3 software, you must assign an interface IP address to the subnet on which the device will be located. You must use the serial connection to assign the first IP address. For subsequent addresses, you can use the CLI through Telnet.
- Assign an interface IP address to the out-of-band management Ethernet port.
device(config)# interface management 1 device(config)# ip address 10.22.3.45 255.255.255.0 device(config)# write memory
The management port number is always 1.