IP address command
directory
You
can use command in this chapter to configure and check the addressing of IP
network. If you want to know more information about the configuration of IP
addressing, please refer to chapter “the configuration of IP addressing”.
When configuring static ARP map, the static ARP map will be
permanently saved in ARP cache. If you want to delete the configured static ARP
map, use command “no arp”.
arp ip-address
hardware-address [alias]
no arp ip-address
Parameter:
ip-address |
IP address of local data link interface. |
hardware-address |
Physical address of
local data link interface. |
alias |
(Optional) the router
responds to the ARP request of this IP address, just like it owns this IP
address. |
Default:
Permanent
ARP map does not exist in ARP cache.
global
configuration mode
All general hosts can support
dynamic ARP analysis, so generally user does not need to specifically configure
static ARP map for the host.
The
following command configures the MAC address of host with IP address of 1.1.1.1
as 00:12:34:56:78:90.
arp
1.1.1.1 00:12:34:56:78:90
Configure the duration of dynamic ARP entry in ARP cache. If you
want to reset it to default value, use command no arp
timeout or default arp timeout.
arp timeout seconds
no arp timeout
default arp timeout
seconds |
Duration
(second) of dynamic ARP entry in ARP cache. 0 means that ARP cache
dynamically resoluted from this interface will not be released timeout. |
Default:
14400 seconds (4 hours)
Command mode:
Interface configuration mode
Explanation:
If you do not configure on interface without (with)ARP, then the configuration will not be effective.
Command “show interface” will display the ARP entry timeout
configured on this interface, it is shown as follows:
ARP type: ARPA,
ARP timeout 04:00:00
Example:
The following command configures the
duration of dynamic ARP map as 900 seconds on interface Ethernet 1/0, in order
to more quickly refresh ARP cache.
interface ethernet
1/0
arp
timeout 900
Ralated command:
show interface
Clear all
dynamic ARP cache.
clear
arp-cache
Parameter:
none
Command mode:
Supervisor mode
Example:
The
following command clears all dynamic ARP caches.
clear
arp-cache
Ralated command:
Configure interface IP address, meanwhile configure network mask. Currently we do not classify A.B.C IP addresses seriously, yet do not use multicast address and broadcast address (all “1” for host part). Except Ethernet, various interfaces of other types can be on the same network. But, network configured on the Ethernet interface cannot be the same as any types of interfaces, except unnumbered interfaces . Normally you can configure one primary address and infinite secondary addresses on one interface. Secondary address can only be configured after the configuration of primary address, you can only delete primary address after delete all secondary address. IP address generated by the system itself, if the upper layer application does not designate the source address, the router will use the IP address on the same network as the gateway and configured on the outgoing interface, as the source address, if you are not sure about this IP address (such as interface router), then you can use the primary address of the outgoing interface. If one interface is not a configured IP address, and is not unnumbered interface, then this interface does not process IP packet.
If you want to delete an IP address,
or stop the IP packet processing by a certain interface, you can use command
“no ip address” to clear one or all IP addresses on the interface.
ip
address ip-address mask [secondary]
no ip
address
ip-address mask
no ip
address
Parameter:
ip-address |
IP address |
mask
|
IP network
mask |
secondary |
(optional)
Designate that it is a configured IP secondary address, if there is no
designation, it is a configured
IP primary address. |
Default:
No configuration of any IP address on the interface
Command mode:
Interface configuration mode
Explanation:
If the router configures secondary IP address on certain physical segment, other systems on the same physical segment should also be configured the secondary address of the same logical network, or it will easily result in a route loop.
When using OSPFprotocol, you should guarantee that the secondary address
and its primary address are in the same OSPF area.
Example:
The following command configures the primary address 202.0.0.1, network
mask 255.255.255.0 on Ethernet 1/0 interface, in addition, configures two IP
secondary address 203.0.0.1 and 204.0.0.1.
interface ethernet1/0
ip address 202.0.0.1 255.255.255.0
ip address 203.0.0.1 255.255.255.0 secondary
ip address 204.0.0.1 255.255.255.0 secondary
Forward IP direct broadcast, and send the packet in physical broadcast form.
ip
directed-broadcast [access-list-namer]
no ip directed-broadcast
Parameter:
access-list-name |
(Optional)
access list name. If the access list is defined, only the broadcast packet
permits by the access list will be forwarded. |
Default:
It does not forward IP direct broadcast by default.
Command mode:
Interface configuration
mode
Example:
The following
example configures forwarding of IP direct broadcast on interface ethernet1/0.
interface ethernet 1/0
ip directed-broadcast
When the interface
is configured ip helper-address, used to designate that which UDP protocol
limited broadcast packets should be forwarded.
ip
forward-protocol udp [port]
no ip
forward-protocol udp [port]
default
ip forward-protocol udp
Parameter:
port (Optional) the destination port which needs
forwarded UDP packets.
Default:
Forward the NETBIOS name service packet.
Command mode:
global
configuration mode
Explanation:
Forward NETBIOS name service packet by default currently, if you do not want it to forward NETBIOS name service packet, you can use any of these commands:
no ip
forward-protocol udp netbios-ns
no ip
forward-protocol udp 137
Use the following command to stop all UDP limited broadcast packet:
no ip
forward-protocol udp
Example:
Router_config#ip forward-protocol udp 137
相关命令:
Forward the IP directed broadcast
packets to the IP helper address designated by the command, it can be unicast
or broadcast address. Each interface can be configured many helper addresses.
ip
helper-address address
no ip
helper-address [address]
Parameter:
address IP helper address
Default:
IP helper
address not configured
Command mode:
Interface configuration mode
Explanation:
This command is not effective on X.25 interface, because the router can
not discern physical broadcast.
Example:
The following command configures IP
helper address 1.0.0.1 on interface Ethernet 1/0.
interface ethernet 1/0
ip helper-address 1.0.0.1
Ralated command:
Define static host name-address map. If you want to delete host
name-address map, use command “no ip host”.
ip host name address
no ip host name
Parameter:
name Host name
Address IP address.
Default:
No maps configured
Command mode:
global configuration mode
Example:
The
following example configures the host name as dns-server with IP address
202.96.1.3.
ip
host dns-server 202.96.1.3
To enable Agent ARP on the
interface. If you want to close this function, use command “no ip proxy arp”.
ip proxy-arp
no ip
proxy-arp
Parameter:
none
Default:
Agent ARP.
Command mode:
Interface
configuration mode
Explanation:
When the
router receives ARP request, if the router has a route to the address requests
IP, and the routing interface is different from the interface received request,
the router will send ARP response from its own MAC address, then, when it
receives actual data packets, it forwards. So, even a host does not fully
realize the topological structure of the network, or it is not configured the
correct(exact) route, and can
communicate with the remote port. For it, remote host directly connects with it
in the same physical subnetwork.
If the host requires the router to provide this service,
it should be in the same IP network as the router is, or, at least its IP
address should make the router consider them in the same IP subnetwork, that is
to say, it can use different masks. Or, the router will not provide this
service.
Example:
The following example turns on the
function of agent ARP on interface ethernet1/0:
interface ethernet 1/0
ip proxy-arp
Configure an interface as an interface with unnumbered, you can start IP process function without configuration of IP address. In order to stop IP process on this interface, use command “no ip unnumbered”.
ip unnumbered type number
no ip unnumbered
Parameter:
type number |
The type and number of
another interface configured IP address. This interface cannot be unnumbered
interface using IP address of other interface. |
Default:
This function not
started.
Command mode:
Interface
configuration mode
Explanation:
For point-to-point link interface, you can start IP process on this interface with this command instead of configuring the exclusive IP address, and designate valid IP address on other interfaces as the source address for this interface to send packet, in order to save IP address. This kind of point-to-point interface can be called unnumbered interface. The IP packet generated on unnumbered interface, such as routing refresh packet, will use the valid IP address configured on the designated interface in the command. It also uses this address to make sure that which routing processes send update packets on this interface. But, it has the following restrictions:
1. Serial
interface and tunnel interface encapsulated by HDLC, PPP, LAPB, SLIP and frame
relay can be configured as unnumbered interface with this command. But, X.25
and SMDS interface cannot use this command.
2.
No way to check whether this interface could normally operating by
command “ping”. You can use “SNMP” to check the mode of this interface remotely.
This command can be realized according to the restriction
that the interface cannot configure valid IP address in RFC1195.
Example:
The following
command configures interface serial1/0 as unnumbered interface, uses valid IP
address 1.0.0.1 configured on interface ethernet1/1 as the source address to
send packet on this interface:
ip address 1.0.0.1 255.255.255.0
interface serial 1/0
ip unnumbered ethernet 1/0
Check the availability of the host and the connectivity of the network. This is achieved by sending ICMP response request packet to the opposite port, and wait for ICMP response packet from opposite port.
ping [-f] [-i {source-ip-address ][-m
{source-interface}] [-j host1 [host2 host3 …]] [–k host1
[host2, host3 …]] [-l length] [-n number]
[-r hops] [-s tos] [-t ttl] [-v]
[-w waittime] host
Parameter:
-f |
Place DF (non-fragrant packet)
position. If he packet the user wants to send is greater than path MTU, the
packet will be scattered by the router on the path, and send ICMP error
packet to source host. If you find a network performance problem, it may be caused
by smaller MTU configured on one of the nodes. You can use this option to
define the minimum MTU on the path.
default:Position not placed |
-I |
Set the source IP address
default: Send main IP address of the
interface. |
source-ip-address |
The packet uses
source-ip-address as source IP address |
-m |
Set the IP address of certain
interface adopted by the packets |
source-interface |
The packet uses IP address on
source-interface interface as the source address. |
-j host1 [host2 host3…] |
Set loose source router. default:Not configured. |
-k host1 [host2 host3…] |
Set serious source router. default:Not configured. |
-l length |
Set the length of ICMP data in
the packet. default:556 bytes. |
-n number |
Set the number of total packet
sent default:5 packets. |
-r hops |
Record routes, record hops
routes maximum. default:Do not record the
route. |
-s tos |
Set IP TOS of packet as tos. default:0。 |
-t ttl |
Set IP TTL of the packet as
ttl. default:255。 |
-v |
Detailed output. default:Brief output. |
-w waittime |
Response time to wait for each
packet. default:2 seconds. |
host |
Destination host. |
Command
mode:
Configure mode, global configuration mode and
interface configuration mode
Explanation:
Command “ping” supports destination address of broadcast address and
multicast address. If it is limited broadcast (255.255.255.255) or multicast
address, it will send ICMP response request packet on all available interfaces
support broadcast or multicast. The router will output addresses of all
response hosts. The user can directly acquire all hosts support multicast
convert on directly connected session by a ping of multicast address 224.0.0.1.
Brief output by default:
Character |
Description |
! |
Receive a response packet. |
. |
It does not receive a response in the timeout. |
U |
It receives ICMP destination unreachable packet |
Q |
It receives ICMP source refrain packet. |
R |
It receives ICMP redirect packet. |
T |
It receives ICMP timeout packet. |
P |
It receives ICMP parameter problem packet. |
Statistical information output:
Output |
Description |
packets transmitted |
Packets sent. |
packets received |
Packets received, not including other ICMP packets. |
packet loss |
Packet percentage not responded. |
round-trip min/avg/max |
Minimum/average/maximum trip time (mille-second) |
Example:
Router#ping
-l 10000 -n 30 192.168.20.125
PING
192.168.20.125 (192.168.20.125): 10000 data bytes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
---
192.168.20.125 ping statistics ---
30
packets transmitted, 30 packets received, 0% packet loss
round-trip
min/avg/max = 50/64/110 ms
Show all ARP entrys(entries), including ARP map of interface IP address, static ARP map, dynamic ARP map configured by the user.
show
arp
Parameter:
none
Command mode:
Supervisor mode
Explanation:
Displayed information includes:
Protocol |
Type of network address maps
physical address, such as IP. |
Address |
Address, network address maps
physical address, such as IP address. |
Age |
Survival time, the time between
the generation and current of ARP entry, minute as the unit. The router use
this ARP entry will not affect this value. |
Hardware Address |
Physical address, the physical
address corresponds to the network address, for irresoluted entry the value
is empty. |
Type |
Type, means the packet encapsulation
type used by the interface, including ARPA, SNAP and etc… |
Interface |
Interface, the interface
related to this network address. |
Example:
The
following command shows ARP cache
router#show
arp
Protocol IP Address Age(min) Hardware Address Type Interface
IP 192.168.20.77
11 00:30:80:d5:37:e0 ARPA Ethernet1/0
IP 192.168.20.33 0 Incomplete
IP 192.168.20.22 - 08:00:3e:33:33:8a ARPA Ethernet1/0
IP 192.168.20.124 0 00:a0:24:9e:53:36 ARPA Ethernet1/0
IP 192.168.0.22 - 08:00:3e:33:33:8b ARPA Ethernet1/1
Show host name—all entrys in address cache.
show hosts
Parameter:
This command
has no parameter or keyword.
Command mode:
Configure mode
Example:
The following command displays all host name/address map:
show hosts
Ralated command:
Show IP configuration on the interface.
show ip interface [type number]
Parameter:
type |
(Optional) interface type |
number |
(Optional) interface serial. |
Command mode:
Configure mode
Explanation:
If the link layer of the interface can effectively send or receive data, it is a usable interface and the mode is “protocol up”. If you configure IP address on this interface, the router will add a directly connected route in the routing table. If the link layer protocol disconnects, which is “protocol down”, this directly connected route will be deleted. If you designate interface type and serial, it only displays interface information. Or, it displays IP configuration information of all interfaces.
Example:
The
following command shows the IP configuration on interface f0/0:
Ethernet1/0 is up, line protocol is up
IP address : 192.168.20.167/24
Broadcast address : 192.168.20.255
Helper address : not set
MTU : 1500(byte)
Forward Directed broadcast : OFF
Multicast reserved groups joined:
224.0.0.9 224.0.0.6
224.0.0.5 224.0.0.2
224.0.0.1
Outgoing ACL : not set
Incoming ACL : not set
IP fast switching : ON
IP fast switching on the same
interface : OFF
ICMP unreachables : ON
ICMP mask replies : OFF
ICMP redirects : ON
Show
description:
Domain |
Description |
FastEthernet0/0 is up |
If the interface hardware is usable, the interface is tagged “up”. If the interface is usable, its hardware and line protocol must all be “up”. |
line protocol is up |
If the interface can provide intercommunication, its line protocol would be tagged “up”. If the interface is usable, both the interface hardware and line protocol must be “up”. |
Internet address |
Interface IP address and network mask. |
Broadcast address |
Show broadcast address. |
MTU |
Show IP MTU configured on the interface. |
Helper address |
Show helper address/ |
Directed broadcast forwarding |
Whether to forward directed broadcast packet. |
Multicast reserved groups joined |
Reserved multicast group interface joined |
Outgoing access list |
Outgoing access control list used by the interface. |
Inbound access list |
Inbound access control list used by the interface. |
Proxy ARP |
Whether the interface supports proxy ARP |
ICMP redirects |
Whether to send ICMP redirect packet on the interface |
ICMP unreachables |
Whether to send ICMP unreachable packets on the interface |
ICMP mask replies |
Whether to send ICMP mask reply packets on the interface. |