32cc30c4275183f96b0db48c0ad469c1692edefa
[vpp.git] / docs / reference / cmdreference / ip / ip.rst
1 .. _ip1:
2
3 .. toctree::
4
5 .. note:: For a complete list of CLI Debug commands refer to the Debug CLI section of the `Source Code Documents <https://docs.fd.io/vpp/18.07/clicmd.html>`_ .
6
7 IP Route
8 ==========
9
10 Summary/Usage
11 --------------
12
13 `ip route [add|del] [count <*n*>] <*dst-ip-addr*>/<*width*> [table <*table-id*>] via [next-hop-address] [next-hop-interface] [next-hop-table <*value*>] [weight <*value*>] [preference <*value*>] [udp-encap-id <*value*>] [ip4-lookup-in-table <*value*>] [ip6-lookup-in-table <*value*>] [mpls-lookup-in-table <*value*>] [resolve-via-host] [resolve-via-connected] [rx-ip4 <*interface*>] [out-labels <*value value value*>]`
14
15 Description
16 ------------
17
18 This command is used to add or delete IPv4 or IPv6 routes. All IP Addresses ('<*dst-ip-addr*>/<*width*>', '<*next-hop-ip-addr*>' and '<*adj-hop-ip-addr*>') can be IPv4 or IPv6, but all must be of the same form in a single command. To display the current set of routes, use the commands 'show ip fib' and 'show ip6 fib'.
19
20 Example Usage
21 --------------
22
23 Example of how to add a straight forward static route:
24
25 .. code-block:: console
26
27     vpp# ip route add 6.0.1.2/32 via 6.0.0.1 GigabitEthernet2/0/0
28
29 Example of how to delete a straight forward static route:
30
31 .. code-block:: console
32
33     vpp# ip route del 6.0.1.2/32 via 6.0.0.1 GigabitEthernet2/0/0
34
35 Mainly for route add/del performance testing, one can add or delete multiple routes by adding 'count N' to the previous item:
36
37 .. code-block:: console
38
39     vpp# ip route add count 10 7.0.0.0/24 via 6.0.0.1 GigabitEthernet2/0/0
40
41 Add multiple routes for the same destination to create equal-cost multipath:
42
43 .. code-block:: console
44
45     vpp# ip route add 7.0.0.1/32 via 6.0.0.1 GigabitEthernet2/0/0
46
47     vpp# ip route add 7.0.0.1/32 via 6.0.0.2 GigabitEthernet2/0/0
48
49 For unequal-cost multipath, specify the desired weights. This combination of weights results in 3/4 of the traffic following the second path, 1/4 following the first path:
50
51 .. code-block:: console
52
53     vpp# ip route add 7.0.0.1/32 via 6.0.0.1 GigabitEthernet2/0/0 weight 1
54
55     vpp# ip route add 7.0.0.1/32 via 6.0.0.2 GigabitEthernet2/0/0 weight 3
56
57 To add a route to a particular FIB table (VRF), use:
58
59 .. code-block:: console
60
61     vpp# ip route add 172.16.24.0/24 table 7 via GigabitEthernet2/0/0
62
63 Declaration and Implementation
64 ---------------------------------
65
66 **Declaration:** ip_route_command (src/vnet/ip/lookup.c line 641)
67
68 **Implementation:** vnet_ip_route_cmd
69
70 Ping
71 =====
72
73 Summary/Usage
74 --------------
75
76 ping {<*ip-addr*> | ipv4 <*ip4-addr*> | ipv6 <*ip6-addr*>} [ipv4 <*ip4-addr*> | ipv6 <*ip6-addr*>] [source <*interface*>] [size <*pktsize*>] [interval <*sec*>] [repeat <*cnt*>] [table-id <*id*>] [verbose]
77
78 Description
79 ------------
80
81 This command sends an ICMP ECHO_REQUEST to network hosts. The address can be an IPv4 or IPv6 address (or both at the same time).
82
83 Example Usage
84 --------------
85
86 Example of how ping an IPv4 address:
87
88 .. code-block:: console
89
90     vpp# ping 172.16.1.2 source GigabitEthernet2/0/0 repeat 2
91
92     64 bytes from 172.16.1.2: icmp_seq=1 ttl=64 time=.1090 ms
93     64 bytes from 172.16.1.2: icmp_seq=2 ttl=64 time=.0914 ms
94
95     Statistics: 2 sent, 2 received, 0% packet loss
96
97     Example of how ping both an IPv4 address and IPv6 address at the same time:
98
99     vpp# ping 172.16.1.2 ipv6 fe80::24a5:f6ff:fe9c:3a36 source GigabitEthernet2/0/0 repeat 2 verbose
100
101     Adjacency index: 10, sw_if_index: 1
102     Adj: ip6-discover-neighbor
103     Adj Interface: 0
104     Forced set interface: 1
105     Adjacency index: 0, sw_if_index: 4294967295
106     Adj: ip4-miss
107     Adj Interface: 0
108     Forced set interface: 1
109     Source address: 172.16.1.1
110     64 bytes from 172.16.1.2: icmp_seq=1 ttl=64 time=.1899 ms
111     Adjacency index: 10, sw_if_index: 1
112     Adj: ip6-discover-neighbor
113     Adj Interface: 0
114     Forced set interface: 1
115     Adjacency index: 0, sw_if_index: 4294967295
116     Adj: ip4-miss
117     Adj Interface: 0
118     Forced set interface: 1
119     Source address: 172.16.1.1
120     64 bytes from 172.16.1.2: icmp_seq=2 ttl=64 time=.0910 ms
121
122     Statistics: 4 sent, 2 received, 50% packet loss
123
124 Declaration and Implementation
125 -------------------------------
126
127 Declaration: ping_command (src/vnet/ip/ping.c line 899)
128
129 Implementation: ping_ip_address
130
131 Set Interface IP Address
132 =========================
133
134 `Set Interface IP Address <../interface/setinterface.html#set-interface-ip-address>`_
135
136 Show IP Arp
137 =============
138
139 `Show IP-Arp <../show/show.html#show-ip-arp>`_
140
141
142 Show IP Fib
143 ============
144
145 `Show IP-Fib <../show/show.html#show-ip-fib>`_