ip host

Function

The ip host command configures the mappings between host names and IP addresses.

The undo ip host command deletes the mappings between host names and IP addresses.

By default, host names and IP addresses do not have mapping relationships.

Format

ip host host-name ip-address [ vpn-instance vpn-instance-name ]

undo ip host host-name [ ip-address ] [ vpn-instance vpn-instance-name ]

Parameters

Parameter Description Value
host-name

Specifies a host name.

The value is a string of 1 to 255 case-insensitive characters.

ip-address

Specifies an IP address corresponding to a host name.

The value is in dotted decimal notation.

vpn-instance vpn-instance-name

Specifies the name of a VPN instance.

The value is a string of 1 to 31 case-sensitive characters, spaces not supported. In addition, the VPN instance name must not be _public_. When double quotation marks are used around the string, spaces are allowed in the string.

Views

System view

Default Level

2: Configuration level

Task Name and Operations

Task Name Operations
dns write

Usage Guidelines

Usage Scenario

If you want to use static DNS for domain name resolution, you must run the ip host command to configure the mappings between host names and IP addresses first.

Precautions

When using the ip host command, note the following:

  • A VS allows you to configure a maximum of 1024 static DNS entries using the ip host command.
  • Each host name corresponds to only one IP address. If multiple IP addresses are assigned to a host, the latest configured IP address overrides the previous ones.

Example

# Set the IP address corresponding to host name RTA in the VPN named vpn1 to 10.110.0.2.
<HUAWEI> system-view
[~HUAWEI] ip vpn-instance vpn1
[*HUAWEI-vpn-instance-vpn1] ipv4-family
[*HUAWEI-vpn-instance-vpn1-af-ipv4] quit
[*HUAWEI-vpn-instance-vpn1] quit
[*HUAWEI] ip host RTA 10.110.0.2 vpn-instance vpn1
# Set the IP address corresponding to host name huawei to 10.110.0.1.
<HUAWEI> system-view
[~HUAWEI] ip host huawei 10.110.0.1
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >