Hà Nội: NTT03, Line 1, Thống Nhất Complex, 82 Nguyễn Tuân, Thanh Xuân, Hà Nội. ● HCM: Số 31B, Đường 1, Phường An Phú, Quận 2 (Thủ Đức), TP HCM. ===> Đơn Vị Hàng Đầu Trong Lĩnh Vực Cung Cấp Thiết Bị Security - Network - Wifi - CCTV - Conference - Máy chủ Server - Lưu trữ Storge.
Danh mục sản phẩm

Configure an IP Address

An IP address is a 32-bit number which uniquely identifies a network device that runs the IP protocol on the Internet.

An IP address consists of the following two parts:

  • Network number (Net-id): It identifies the network in which the device is located.
  • Host number (Host-id): It specifies the host number in the device network.

To facilitate IP address management, IP addresses are categorized into five classes, and each IP address class has its own functions. IP addresses of classes A to C are used for address allocation, IP addresses of class D is used in multicast applications, and IP addresses of class E are used for test purpose. The following table shows the IP addresses classes and their ranges.

Table 2-2 IP Address Classes and Their Ranges

Address Type

Available Network Address Range

Description

A

1.0.0.0-127.0.0.0

Network number 127 is used for loopback interfaces.

B

128.0.0.0-191.255.0.0

-

C

192.0.0.0-223.255.255.0

-

D

224.0.0.0-239.255.255.255

Class D addresses are used for multicast.

E

240.0.0.0-255.255.255.254

Class E addresses are used for test purpose.

With the development of the Internet, IP address resources have gradually been consumed up. Address allocation based on classes causes address waste, so the concept of "subnet" is introduced. "Subnet" takes some host numbers in the IP addresses as subnet numbers. In this way, a large network is divided into multiple subnets. This facilitates network planning and deployment.

The three address segments, 10.0.0.0-10.255.255.255, 172.16.0.0-172.31.255.255, and 192.168.0.0-192.168.255.255 are private and reserved addresses, and they cannot be allocated to the public network.

This section describes how to configure an interface IP address and how to configure an unnumbered interface IP address.

Configuration Condition

None

Configure an IP Address for an Interface

An IP address can only be configured for an interface that supports the IP protocol. One interface can only be configured with one primary IP address but it can be configured with multiple secondary IP addresses.

Table 2-3 Configuring an IP Address for an Interface

Step

Command

Description

Enter the global configuration mode.

configure terminal

-

Enter the interface configuration mode.

interface interface-name

-

Configure an IP address for an interface.

ip address ip-address { network-mask | mask-len } [ secondary ]

Mandatory.

note

  • One interface can only be configured with one primary IP address, therefore, the newly configured primary IP address replaces the original primary IP address.
  • Before an interface is configured with secondary IP addresses, the interface must be configured a primary IP address. An interface can be configured with a maximum of 100 secondary IP addresses.
  • The IP addresses of different interfaces must not in the same network segment, but the primary and secondary IP addresses of one interface can be in the same network segment.

Configure an Unnumbered IP Address for an Interface

Unnumbered IP addresses save IP addresses. In the case of unnumbered IP addresses, the IP addresses of other interfaces can be borrowed instead of allocated independently. If an unnumbered interface generates an IP packet, the source IP address of the packet is the primary IP address of a borrowed interface. In configuring an unnumbered IP address for an interface, the interface to be borrowed must be specified, so that the IP address of the interface can be borrowed.

Table 2-4 Configuring an Unnumbered IP Address for an Interface

Step

Command

Description

Enter the global configuration mode.

configure terminal

-

Enter the interface configuration mode.

interface interface-name

-

Configure an unnumbered IP address for an interface.

ip unnumbered reference-interface

Mandatory.

note


  • The borrowed interface must be configured with the primary IP address, and the interface must not be configured with an unnumbered IP address.
  • The primary IP address of an interface can be borrowed by multiple interfaces, but only the primary IP address of the interface can be borrowed.