- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
02-IP Address Commands | 38.58 KB |
Chapter 1 IP Address Configuration Commands
1.1 IP Address Configuration Commands
1.1.1 display ip host
Syntax
display ip host
View
Any view
Parameters
None
Description
Use the display ip host command to display all the host names and the corresponding IP addresses.
Examples
# Display all host names and the corresponding IP addresses of the hosts.
<H3C> display ip host
Host Age Flags Address
My 0 static 1.1.1.1
Aa 0 static 2.2.2.4
Table 1-1 Description on the fields of the display ip host command
Field |
Description |
Host |
Host name |
Age |
Valid period |
Flags |
Indicates the relationship between the host name and the IP address. If you configure the host name by using the ip host command, the relationship between the host name and the IP address is static. If you resolve the host name through DNS, the relationship between the host name and the IP address is dynamic. |
Address |
Host IP address |
1.1.2 display ip interface
Syntax
display ip interface [ brief ] [ interface-type interface-number ]
View
Any view
Parameters
interface-type interface-number: Specifies a port.
brief: Displays the brief port configuration information.
Description
Use the display ip interface command to display brief information about a port.
Examples
# Display the brief configuration information of the interfaces in the current system.
<H3C> display ip interface brief
Interface IP Address Physical Protocol
Aux6/0/1 unassigned down down
LoopBack11 99.88.77.66 up up(spoofing)
M-Ethernet6/0/0 192.168.0.91 up up
Vlan-interface2 2.2.2.2 up up
Vlan-interface105 10.5.0.5 up up
Vlan-interface140 192.168.140.5 up up
# Display information about interface VLAN-interface 1.
<H3C> display ip interface vlan-interface 1
Vlan-interface1 current state : DOWN
Line protocol current state : DOWN
Internet Address is 1.1.1.1/8 Primary
Broadcast address : 1.255.255.255
The Maximum Transmit Unit : 1500 bytes
input packets : 0, bytes : 0, multicasts : 0
output packets : 0, bytes : 0, multicasts : 0
TTL invalid packet number: 0
ICMP packet input number: 0
Echo reply: 0
Unreachable: 0
Source quench: 0
Routing redirect: 0
Echo request: 0
Router advert: 0
Router solicit: 0
Time exceed: 0
IP header bad: 0
Timestamp request: 0
Timestamp reply: 0
Information request: 0
Information reply: 0
Netmask request: 0
Netmask reply: 0
Unknown type: 0
DHCP packet deal mode: global
Table 1-2 Description on the fields of the display ip interface vlan-interface command
Field |
Description |
Vlan-interface1 current state |
Current state of the VLAN-interface 1 |
Line protocol current state |
Current state of the Line protocol |
Internet Address |
IP address |
Broadcast address |
Broadcast address |
The Maximum Transmit Unit |
Maximum transmission unit |
input packets : 0, bytes : 0, multicasts : 0 output packets : 0, bytes : 0, multicasts : 0 |
The numbers of input/output unicast packets, bytes, and multicast packets are all 0. |
TTL invalid packet number |
The number of the received packets with invalid TTLs |
ICMP packet input number Echo reply: Unreachable: Source quench: Routing redirect: Echo request: Router advert: Router solicit: Time exceed: IP header bad: Timestamp request: Timestamp reply: Information request: Information reply: Netmask request: Netmask reply: Unknown type: |
Total received ICMP packets, including: Echo reply packets, unreachable packets, source quench packets, routing redirect packets, echo request packets, route advertisement packets, route solicitation packets, packets that exceed the time, packets with bad IP headers, timestamp request packets, timestamp reply packets, information request packets, information reply packets, netmask request packets, netmask reply packets and unknown packets. |
DHCP packet deal mode |
DHCP packet processing mode |
1.1.3 ip address
Syntax
ip address ip-address { mask | mask-length } [ sub ] [ direct-broadcast { forward | drop } ]
undo ip address [ ip-address { mask | mask-length } [ sub ] ]
View
VLAN interface view, Loopback interface view, console port view
Parameters
ip-address: IP address of the VLAN interface in dotted decimal format.
mask: Subnet mask in dotted decimal format.
mask-length: Mask length. That is, the number of bits with a value of 1.
sub: Specifies the IP address to be a secondary IP address of the VLAN interface/Loopback interface.
direct-broadcast: Specifies a handling policy for directed broadcasts destined for the VLAN where the configured IP address resides
forward: Forwards directed broadcasts in the VLAN where the configured IP address resides.
drop: Drops directed broadcasts destined for the VLAN where the configured IP address resides.
The direct-broadcast, forward, and drop keywords can be specified only in VLAN interface view.
Description
Use the ip address command to assign an IP address and subnet mask to the VLAN interface/Loopback interface/console port.
Use the undo ip address command to remove the configuration.
When configuring an IP address for a VLAN interface, you can specify a handling policy for directed broadcasts destined for the VLAN.
l With the forward keyword specified, after receiving directed broadcasts, the interface will broadcast the packets in the VLAN to which the interface belongs.
l With the drop keyword specified, the interface will discard the received directed broadcasts.
By default, a VLAN interface/Loopback interface/console port does not have an IP address configured.
Normally, a VLAN interface/Loopback interface/console port only needs to be configured with one IP address. But you can also assign up to 21 IP addresses to a VLAN interface/Loopback interface/console port to enable it to connect to multiple subnets. Of all the IP addresses assigned to a VLAN interface/Loopback interface/console port, one is the primary IP address, and the others are secondary IP addresses. When you configure a primary IP address for an interface which already has a primary IP address configured, the new one replaces the old one.
Note that:
l The execution of the undo ip address command removes both primary and secondary IP addresses of the interface.
l The execution of the undo ip address [ ip-address { mask | mask-length } command removes the primary IP address.
l The execution of the undo ip address [ ip-address { mask | mask-length } sub command removes a secondary IP address.
& Note:
l If you re-configure an IP address for a VLAN-interface and the new IP address is not in the same network segment as the previous one, the system will display whether to continue. If you continue, the IP address of the VLAN interface will be modified. In addition, if the ARP entries (including dynamic ARP entries and static ARP entries) in the original network segment match the new network segment, they will not be removed; otherwise, the ARP entries in the original network segment will be removed.
l A policy for handling directed broadcasts, if specified for an IP address on a VLAN interface, will be removed when the IP address is removed from the VLAN interface.
Related commands: display ip interface.
Examples
# Assign 129.12.0.1 to VLAN-interface 1, with a subnet mask of 255.255.255.0.
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] interface vlan-interface 1
[H3C-Vlan-interface1] ip address 129.12.0.1 255.255.255.0
# Configure the IP address and subnet mask of VLAN-interface 1 as 129.12.0.1 and 255.255.255.0 respectively, and enable the interface to forward directed broadcasts in the VLAN to which the interface belongs.
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] interface vlan-interface 1
[H3C-Vlan-interface1] ip address 129.12.0.1 255.255.255.0 direct-broadcast forward
# Assign 129.12.0.10 to Ethernet 4/0/0, with a 24-bit subnet mask.
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] interface M-Ethernet 4/0/0
[H3C-M-Ethernet4/0/0] ip address 129.12.0.10 24
1.1.4 ip host
Syntax
ip host hostname ip-address
undo ip host hostname [ ip-address ]
View
System view
Parameters
hostname: Name of the host. It is a character string that consists of 1 to 20 characters, including letters, numbers, "_", or ",", and it must contain at least one letter.
ip-address: Host IP address (the corresponding IP address for the host name) in dotted decimal notation.
Description
Use the ip host command to configure the name and IP address for a host.
Use the undo ip host command to remove the configuration.
By default, no mapping between a name and an IP address is configured by default.
Related commands: display ip host.
Examples
# Set Lanswitch1’s IP address to 10.110.0.1.
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] ip host Lanswitch1 10.110.0.1
1.1.5 ip-protect enable
Syntax
ip-protect enable
undo ip-protect
View
VLAN interface view
Parameters
None
Description
Use the ip-protect enable command to enable IP address protection.
Use the undo ip-protect command to disable IP address protection.
After IP address protection is enabled, the current interface will no longer dynamically learn ARP mapping entries, and existing dynamic ARP mapping entries will be removed. At the same time, the switch will enable the MAC address auto filling function, and then you can configure static ARP entries that have only IP address.
By default, IP address protection is disabled.
You can use the display this command to view the status of IP address protection (enabled/disabled) for the current VLAN interface.
Examples
# Enable IP address protection for VLAN-interface 2.
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] interface Vlan-interface 2
[H3C-Vlan-interface2] ip-protect enable