2 * Copyright (c) 2017 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
20 #include <snat/nat64.h>
21 #include <snat/snat.h>
22 #include <vnet/fib/fib_table.h>
25 nat64_add_del_pool_addr_command_fn (vlib_main_t * vm,
26 unformat_input_t * input,
27 vlib_cli_command_t * cmd)
29 nat64_main_t *nm = &nat64_main;
30 unformat_input_t _line_input, *line_input = &_line_input;
31 ip4_address_t start_addr, end_addr, this_addr;
32 u32 start_host_order, end_host_order;
36 clib_error_t *error = 0;
39 return clib_error_return (0,
40 "NAT64 disabled, multi thread not supported");
42 /* Get a line of input. */
43 if (!unformat_user (input, unformat_line_input, line_input))
46 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
48 if (unformat (line_input, "%U - %U",
49 unformat_ip4_address, &start_addr,
50 unformat_ip4_address, &end_addr))
52 else if (unformat (line_input, "tenant-vrf %u", &vrf_id))
54 else if (unformat (line_input, "%U", unformat_ip4_address, &start_addr))
55 end_addr = start_addr;
56 else if (unformat (line_input, "del"))
60 error = clib_error_return (0, "unknown input '%U'",
61 format_unformat_error, line_input);
66 start_host_order = clib_host_to_net_u32 (start_addr.as_u32);
67 end_host_order = clib_host_to_net_u32 (end_addr.as_u32);
69 if (end_host_order < start_host_order)
71 error = clib_error_return (0, "end address less than start address");
75 count = (end_host_order - start_host_order) + 1;
76 this_addr = start_addr;
78 for (i = 0; i < count; i++)
80 rv = nat64_add_del_pool_addr (&this_addr, vrf_id, is_add);
84 case VNET_API_ERROR_NO_SUCH_ENTRY:
86 clib_error_return (0, "NAT64 pool address %U not exist.",
87 format_ip4_address, &this_addr);
89 case VNET_API_ERROR_VALUE_EXIST:
91 clib_error_return (0, "NAT64 pool address %U exist.",
92 format_ip4_address, &this_addr);
98 increment_v4_address (&this_addr);
102 unformat_free (line_input);
108 nat64_cli_pool_walk (snat_address_t * ap, void *ctx)
110 vlib_main_t *vm = ctx;
112 if (ap->fib_index != ~0)
115 fib = fib_table_get (ap->fib_index, FIB_PROTOCOL_IP6);
118 vlib_cli_output (vm, " %U tenant VRF: %u", format_ip4_address,
119 &ap->addr, fib->ft_table_id);
122 vlib_cli_output (vm, " %U", format_ip4_address, &ap->addr);
127 static clib_error_t *
128 nat64_show_pool_command_fn (vlib_main_t * vm,
129 unformat_input_t * input,
130 vlib_cli_command_t * cmd)
132 nat64_main_t *nm = &nat64_main;
135 return clib_error_return (0,
136 "NAT64 disabled, multi thread not supported");
138 vlib_cli_output (vm, "NAT64 pool:");
139 nat64_pool_addr_walk (nat64_cli_pool_walk, vm);
144 static clib_error_t *
145 nat64_interface_feature_command_fn (vlib_main_t * vm,
147 input, vlib_cli_command_t * cmd)
149 nat64_main_t *nm = &nat64_main;
150 unformat_input_t _line_input, *line_input = &_line_input;
151 vnet_main_t *vnm = vnet_get_main ();
152 clib_error_t *error = 0;
154 u32 *inside_sw_if_indices = 0;
155 u32 *outside_sw_if_indices = 0;
160 return clib_error_return (0,
161 "NAT64 disabled, multi thread not supported");
163 /* Get a line of input. */
164 if (!unformat_user (input, unformat_line_input, line_input))
167 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
169 if (unformat (line_input, "in %U", unformat_vnet_sw_interface,
171 vec_add1 (inside_sw_if_indices, sw_if_index);
172 else if (unformat (line_input, "out %U", unformat_vnet_sw_interface,
174 vec_add1 (outside_sw_if_indices, sw_if_index);
175 else if (unformat (line_input, "del"))
179 error = clib_error_return (0, "unknown input '%U'",
180 format_unformat_error, line_input);
185 if (vec_len (inside_sw_if_indices))
187 for (i = 0; i < vec_len (inside_sw_if_indices); i++)
189 sw_if_index = inside_sw_if_indices[i];
190 rv = nat64_add_del_interface (sw_if_index, 1, is_add);
193 case VNET_API_ERROR_NO_SUCH_ENTRY:
195 clib_error_return (0, "%U NAT64 feature not enabled.",
196 format_vnet_sw_interface_name, vnm,
197 vnet_get_sw_interface (vnm, sw_if_index));
199 case VNET_API_ERROR_VALUE_EXIST:
201 clib_error_return (0, "%U NAT64 feature already enabled.",
202 format_vnet_sw_interface_name, vnm,
203 vnet_get_sw_interface (vnm, sw_if_index));
205 case VNET_API_ERROR_INVALID_VALUE:
206 case VNET_API_ERROR_INVALID_VALUE_2:
208 clib_error_return (0,
209 "%U NAT64 feature enable/disable failed.",
210 format_vnet_sw_interface_name, vnm,
211 vnet_get_sw_interface (vnm, sw_if_index));
220 if (vec_len (outside_sw_if_indices))
222 for (i = 0; i < vec_len (outside_sw_if_indices); i++)
224 sw_if_index = outside_sw_if_indices[i];
225 rv = nat64_add_del_interface (sw_if_index, 0, is_add);
228 case VNET_API_ERROR_NO_SUCH_ENTRY:
230 clib_error_return (0, "%U NAT64 feature not enabled.",
231 format_vnet_sw_interface_name, vnm,
232 vnet_get_sw_interface (vnm, sw_if_index));
234 case VNET_API_ERROR_VALUE_EXIST:
236 clib_error_return (0, "%U NAT64 feature already enabled.",
237 format_vnet_sw_interface_name, vnm,
238 vnet_get_sw_interface (vnm, sw_if_index));
240 case VNET_API_ERROR_INVALID_VALUE:
241 case VNET_API_ERROR_INVALID_VALUE_2:
243 clib_error_return (0,
244 "%U NAT64 feature enable/disable failed.",
245 format_vnet_sw_interface_name, vnm,
246 vnet_get_sw_interface (vnm, sw_if_index));
256 unformat_free (line_input);
257 vec_free (inside_sw_if_indices);
258 vec_free (outside_sw_if_indices);
264 nat64_cli_interface_walk (snat_interface_t * i, void *ctx)
266 vlib_main_t *vm = ctx;
267 vnet_main_t *vnm = vnet_get_main ();
269 vlib_cli_output (vm, " %U %s", format_vnet_sw_interface_name, vnm,
270 vnet_get_sw_interface (vnm, i->sw_if_index),
271 i->is_inside ? "in" : "out");
275 static clib_error_t *
276 nat64_show_interfaces_command_fn (vlib_main_t * vm,
278 input, vlib_cli_command_t * cmd)
280 nat64_main_t *nm = &nat64_main;
283 return clib_error_return (0,
284 "NAT64 disabled, multi thread not supported");
286 vlib_cli_output (vm, "NAT64 interfaces:");
287 nat64_interfaces_walk (nat64_cli_interface_walk, vm);
292 static clib_error_t *
293 nat64_add_del_static_bib_command_fn (vlib_main_t *
296 * input, vlib_cli_command_t * cmd)
298 nat64_main_t *nm = &nat64_main;
299 unformat_input_t _line_input, *line_input = &_line_input;
300 clib_error_t *error = 0;
302 ip6_address_t in_addr;
303 ip4_address_t out_addr;
306 u32 vrf_id = 0, protocol;
307 snat_protocol_t proto = 0;
312 return clib_error_return (0,
313 "NAT64 disabled, multi thread not supported");
315 if (!unformat_user (input, unformat_line_input, line_input))
318 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
320 if (unformat (line_input, "%U %u", unformat_ip6_address,
323 else if (unformat (line_input, "%U %u", unformat_ip4_address,
324 &out_addr, &out_port))
326 else if (unformat (line_input, "vrf %u", &vrf_id))
328 else if (unformat (line_input, "%U", unformat_snat_protocol, &proto))
332 (line_input, "%U %U %u", unformat_ip6_address, &in_addr,
333 unformat_ip4_address, &out_addr, &protocol))
335 else if (unformat (line_input, "del"))
339 error = clib_error_return (0, "unknown input: '%U'",
340 format_unformat_error, line_input);
350 clib_error_return (0, "inside port and address must be set");
357 clib_error_return (0, "outside port and address must be set");
361 p = snat_proto_to_ip_proto (proto);
365 nat64_add_del_static_bib_entry (&in_addr, &out_addr, in_port, out_port, p,
370 case VNET_API_ERROR_NO_SUCH_ENTRY:
371 error = clib_error_return (0, "NAT64 BIB entry not exist.");
373 case VNET_API_ERROR_VALUE_EXIST:
374 error = clib_error_return (0, "NAT64 BIB entry exist.");
376 case VNET_API_ERROR_UNSPECIFIED:
377 error = clib_error_return (0, "Crerate NAT64 BIB entry failed.");
379 case VNET_API_ERROR_INVALID_VALUE:
381 clib_error_return (0, "Outside addres %U and port %u already in use.",
382 format_ip4_address, &out_addr, out_port);
389 unformat_free (line_input);
395 nat64_cli_bib_walk (nat64_db_bib_entry_t * bibe, void *ctx)
397 vlib_main_t *vm = ctx;
400 fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
406 case IP_PROTOCOL_ICMP:
407 case IP_PROTOCOL_TCP:
408 case IP_PROTOCOL_UDP:
409 vlib_cli_output (vm, " %U %u %U %u protocol %U vrf %u %s %u sessions",
410 format_ip6_address, &bibe->in_addr,
411 clib_net_to_host_u16 (bibe->in_port),
412 format_ip4_address, &bibe->out_addr,
413 clib_net_to_host_u16 (bibe->out_port),
414 format_snat_protocol,
415 ip_proto_to_snat_proto (bibe->proto), fib->ft_table_id,
416 bibe->is_static ? "static" : "dynamic", bibe->ses_num);
419 vlib_cli_output (vm, " %U %U protocol %u vrf %u %s %u sessions",
420 format_ip6_address, &bibe->in_addr,
421 format_ip4_address, &bibe->out_addr,
422 bibe->proto, fib->ft_table_id,
423 bibe->is_static ? "static" : "dynamic", bibe->ses_num);
428 static clib_error_t *
429 nat64_show_bib_command_fn (vlib_main_t * vm,
430 unformat_input_t * input, vlib_cli_command_t * cmd)
432 nat64_main_t *nm = &nat64_main;
433 unformat_input_t _line_input, *line_input = &_line_input;
434 clib_error_t *error = 0;
439 return clib_error_return (0,
440 "NAT64 disabled, multi thread not supported");
442 if (!unformat_user (input, unformat_line_input, line_input))
445 if (unformat (line_input, "%U", unformat_snat_protocol, &proto))
446 p = snat_proto_to_ip_proto (proto);
447 else if (unformat (line_input, "unknown"))
449 else if (unformat (line_input, "all"))
453 error = clib_error_return (0, "unknown input: '%U'",
454 format_unformat_error, line_input);
459 vlib_cli_output (vm, "NAT64 BIB entries:");
461 vlib_cli_output (vm, "NAT64 %U BIB entries:", format_snat_protocol,
463 nat64_db_bib_walk (&nm->db, p, nat64_cli_bib_walk, vm);
466 unformat_free (line_input);
471 static clib_error_t *
472 nat64_set_timeouts_command_fn (vlib_main_t * vm, unformat_input_t * input,
473 vlib_cli_command_t * cmd)
475 nat64_main_t *nm = &nat64_main;
476 unformat_input_t _line_input, *line_input = &_line_input;
477 clib_error_t *error = 0;
478 u32 timeout, tcp_trans, tcp_est, tcp_incoming_syn;
480 tcp_trans = nat64_get_tcp_trans_timeout ();
481 tcp_est = nat64_get_tcp_est_timeout ();
482 tcp_incoming_syn = nat64_get_tcp_incoming_syn_timeout ();
485 return clib_error_return (0,
486 "NAT64 disabled, multi thread not supported");
488 if (!unformat_user (input, unformat_line_input, line_input))
491 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
493 if (unformat (line_input, "udp %u", &timeout))
495 if (nat64_set_udp_timeout (timeout))
497 error = clib_error_return (0, "Invalid UDP timeout value");
501 else if (unformat (line_input, "icmp %u", &timeout))
503 if (nat64_set_icmp_timeout (timeout))
505 error = clib_error_return (0, "Invalid ICMP timeout value");
509 else if (unformat (line_input, "tcp-trans %u", &tcp_trans))
511 if (nat64_set_tcp_timeouts (tcp_trans, tcp_est, tcp_incoming_syn))
514 clib_error_return (0, "Invalid TCP transitory tiemout value");
518 else if (unformat (line_input, "tcp-est %u", &tcp_est))
520 if (nat64_set_tcp_timeouts (tcp_trans, tcp_est, tcp_incoming_syn))
523 clib_error_return (0,
524 "Invalid TCP established tiemout value");
529 if (unformat (line_input, "tcp-incoming-syn %u", &tcp_incoming_syn))
531 if (nat64_set_tcp_timeouts (tcp_trans, tcp_est, tcp_incoming_syn))
534 clib_error_return (0,
535 "Invalid TCP incoming SYN tiemout value");
539 else if (unformat (line_input, "reset"))
541 nat64_set_udp_timeout (0);
542 nat64_set_icmp_timeout (0);
543 nat64_set_tcp_timeouts (0, 0, 0);
547 error = clib_error_return (0, "unknown input '%U'",
548 format_unformat_error, line_input);
554 unformat_free (line_input);
559 static clib_error_t *
560 nat64_show_timeouts_command_fn (vlib_main_t * vm, unformat_input_t * input,
561 vlib_cli_command_t * cmd)
563 nat64_main_t *nm = &nat64_main;
566 return clib_error_return (0,
567 "NAT64 disabled, multi thread not supported");
569 vlib_cli_output (vm, "NAT64 session timeouts:");
570 vlib_cli_output (vm, " UDP %usec", nat64_get_udp_timeout ());
571 vlib_cli_output (vm, " ICMP %usec", nat64_get_icmp_timeout ());
572 vlib_cli_output (vm, " TCP transitory %usec",
573 nat64_get_tcp_trans_timeout ());
574 vlib_cli_output (vm, " TCP established %usec",
575 nat64_get_tcp_est_timeout ());
576 vlib_cli_output (vm, " TCP incoming SYN %usec",
577 nat64_get_tcp_incoming_syn_timeout ());
583 nat64_cli_st_walk (nat64_db_st_entry_t * ste, void *ctx)
585 vlib_main_t *vm = ctx;
586 nat64_main_t *nm = &nat64_main;
587 nat64_db_bib_entry_t *bibe;
590 bibe = nat64_db_bib_entry_by_index (&nm->db, ste->proto, ste->bibe_index);
594 fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
598 u32 vrf_id = fib->ft_table_id;
600 if (ste->proto == IP_PROTOCOL_ICMP)
601 vlib_cli_output (vm, " %U %U %u %U %U %u protocol %U vrf %u",
602 format_ip6_address, &bibe->in_addr,
603 format_ip6_address, &ste->in_r_addr,
604 clib_net_to_host_u16 (bibe->in_port),
605 format_ip4_address, &bibe->out_addr,
606 format_ip4_address, &ste->out_r_addr,
607 clib_net_to_host_u16 (bibe->out_port),
608 format_snat_protocol,
609 ip_proto_to_snat_proto (bibe->proto), vrf_id);
610 else if (ste->proto == IP_PROTOCOL_TCP || ste->proto == IP_PROTOCOL_UDP)
611 vlib_cli_output (vm, " %U %u %U %u %U %u %U %u protcol %U vrf %u",
612 format_ip6_address, &bibe->in_addr,
613 clib_net_to_host_u16 (bibe->in_port),
614 format_ip6_address, &ste->in_r_addr,
615 clib_net_to_host_u16 (ste->r_port),
616 format_ip4_address, &bibe->out_addr,
617 clib_net_to_host_u16 (bibe->out_port),
618 format_ip4_address, &ste->out_r_addr,
619 clib_net_to_host_u16 (ste->r_port),
620 format_snat_protocol,
621 ip_proto_to_snat_proto (bibe->proto), vrf_id);
623 vlib_cli_output (vm, " %U %U %U %U protocol %u vrf %u",
624 format_ip6_address, &bibe->in_addr,
625 format_ip6_address, &ste->in_r_addr,
626 format_ip4_address, &bibe->out_addr,
627 format_ip4_address, &ste->out_r_addr,
628 bibe->proto, vrf_id);
633 static clib_error_t *
634 nat64_show_st_command_fn (vlib_main_t * vm,
635 unformat_input_t * input, vlib_cli_command_t * cmd)
637 nat64_main_t *nm = &nat64_main;
638 unformat_input_t _line_input, *line_input = &_line_input;
639 clib_error_t *error = 0;
644 return clib_error_return (0,
645 "NAT64 disabled, multi thread not supported");
647 if (!unformat_user (input, unformat_line_input, line_input))
650 if (unformat (line_input, "%U", unformat_snat_protocol, &proto))
651 p = snat_proto_to_ip_proto (proto);
652 else if (unformat (line_input, "unknown"))
654 else if (unformat (line_input, "all"))
658 error = clib_error_return (0, "unknown input: '%U'",
659 format_unformat_error, line_input);
664 vlib_cli_output (vm, "NAT64 sessions:");
666 vlib_cli_output (vm, "NAT64 %U sessions:", format_snat_protocol, proto);
667 nat64_db_st_walk (&nm->db, p, nat64_cli_st_walk, vm);
670 unformat_free (line_input);
675 static clib_error_t *
676 nat64_add_del_prefix_command_fn (vlib_main_t * vm, unformat_input_t * input,
677 vlib_cli_command_t * cmd)
679 nat64_main_t *nm = &nat64_main;
680 clib_error_t *error = 0;
681 unformat_input_t _line_input, *line_input = &_line_input;
684 ip6_address_t prefix;
689 return clib_error_return (0,
690 "NAT64 disabled, multi thread not supported");
692 if (!unformat_user (input, unformat_line_input, line_input))
695 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
698 (line_input, "%U/%u", unformat_ip6_address, &prefix, &plen))
700 else if (unformat (line_input, "tenant-vrf %u", &vrf_id))
702 else if (unformat (line_input, "del"))
706 error = clib_error_return (0, "unknown input: '%U'",
707 format_unformat_error, line_input);
714 error = clib_error_return (0, "NAT64 prefix must be set.");
718 rv = nat64_add_del_prefix (&prefix, (u8) plen, vrf_id, is_add);
722 case VNET_API_ERROR_NO_SUCH_ENTRY:
723 error = clib_error_return (0, "NAT64 prefix not exist.");
725 case VNET_API_ERROR_INVALID_VALUE:
726 error = clib_error_return (0, "Invalid prefix length.");
733 unformat_free (line_input);
739 nat64_cli_prefix_walk (nat64_prefix_t * p, void *ctx)
741 vlib_main_t *vm = ctx;
743 vlib_cli_output (vm, " %U/%u tenant-vrf %u",
744 format_ip6_address, &p->prefix, p->plen, p->vrf_id);
749 static clib_error_t *
750 nat64_show_prefix_command_fn (vlib_main_t * vm, unformat_input_t * input,
751 vlib_cli_command_t * cmd)
753 nat64_main_t *nm = &nat64_main;
756 return clib_error_return (0,
757 "NAT64 disabled, multi thread not supported");
759 vlib_cli_output (vm, "NAT64 prefix:");
760 nat64_prefix_walk (nat64_cli_prefix_walk, vm);
769 * @cliexstart{nat64 add pool address}
770 * Add/delete NAT64 pool address.
771 * To add single NAT64 pool address use:
772 * vpp# nat64 add pool address 10.1.1.10
773 * To add NAT64 pool address range use:
774 * vpp# nat64 add pool address 10.1.1.2 - 10.1.1.5
775 * To add NAT64 pool address for specific tenant use:
776 * vpp# nat64 add pool address 10.1.1.100 tenant-vrf 100
779 VLIB_CLI_COMMAND (nat64_add_pool_address_command, static) = {
780 .path = "nat64 add pool address",
781 .short_help = "nat64 add pool address <ip4-range-start> [- <ip4-range-end>] "
782 "[tenant-vrf <vrf-id>] [del]",
783 .function = nat64_add_del_pool_addr_command_fn,
788 * @cliexstart{show nat64 pool}
790 * vpp# show nat64 pool
792 * 10.1.1.3 tenant VRF: 0
793 * 10.1.1.10 tenant VRF: 10
796 VLIB_CLI_COMMAND (show_nat64_pool_command, static) = {
797 .path = "show nat64 pool",
798 .short_help = "show nat64 pool",
799 .function = nat64_show_pool_command_fn,
804 * @cliexstart{set interface nat64}
805 * Enable/disable NAT64 feature on the interface.
806 * To enable NAT64 feature with local (IPv6) network interface
807 * GigabitEthernet0/8/0 and external (IPv4) network interface
808 * GigabitEthernet0/a/0 use:
809 * vpp# set interface nat64 in GigabitEthernet0/8/0 out GigabitEthernet0/a/0
812 VLIB_CLI_COMMAND (set_interface_nat64_command, static) = {
813 .path = "set interface nat64",
814 .short_help = "set interface nat64 in|out <intfc> [del]",
815 .function = nat64_interface_feature_command_fn,
820 * @cliexstart{show nat64 interfaces}
821 * Show interfaces with NAT64 feature.
822 * To show interfaces with NAT64 feature use:
823 * vpp# show nat64 interfaces
825 * GigabitEthernet0/8/0 in
826 * GigabitEthernet0/a/0 out
829 VLIB_CLI_COMMAND (show_nat64_interfaces_command, static) = {
830 .path = "show nat64 interfaces",
831 .short_help = "show nat64 interfaces",
832 .function = nat64_show_interfaces_command_fn,
837 * @cliexstart{nat64 add static bib}
838 * Add/delete NAT64 static BIB entry.
839 * To create NAT64 satatic BIB entry use:
840 * vpp# nat64 add static bib 2001:db8:c000:221:: 1234 10.1.1.3 5678 tcp
841 * vpp# nat64 add static bib 2001:db8:c000:221:: 1234 10.1.1.3 5678 udp vrf 10
844 VLIB_CLI_COMMAND (nat64_add_del_static_bib_command, static) = {
845 .path = "nat64 add static bib",
846 .short_help = "nat64 add static bib <ip6-addr> <port> <ip4-addr> <port> "
847 "tcp|udp|icmp [vfr <table-id>] [del]",
848 .function = nat64_add_del_static_bib_command_fn,
853 * @cliexstart{show nat64 bib}
854 * Show NAT64 BIB entries.
855 * To show NAT64 TCP BIB entries use:
856 * vpp# show nat64 bib tcp
858 * fd01:1::2 6303 10.0.0.3 62303 tcp vrf 0 dynamic 1 sessions
859 * 2001:db8:c000:221:: 1234 10.1.1.3 5678 tcp vrf 0 static 2 sessions
860 * To show NAT64 UDP BIB entries use:
861 * vpp# show nat64 bib udp
863 * fd01:1::2 6304 10.0.0.3 10546 udp vrf 0 dynamic 10 sessions
864 * 2001:db8:c000:221:: 1234 10.1.1.3 5678 udp vrf 10 static 0 sessions
865 * To show NAT64 ICMP BIB entries use:
866 * vpp# show nat64 bib icmp
868 * fd01:1::2 6305 10.0.0.3 63209 icmp vrf 10 dynamic 1 sessions
871 VLIB_CLI_COMMAND (show_nat64_bib_command, static) = {
872 .path = "show nat64 bib",
873 .short_help = "show nat64 bib all|tcp|udp|icmp|unknown",
874 .function = nat64_show_bib_command_fn,
879 * @cliexstart{set nat64 timeouts}
880 * Set NAT64 session timeouts (in seconds).
881 * To set NAT64 session timeoutes use use:
882 * vpp# set nat64 timeouts udp 200 icmp 30 tcp-trans 250 tcp-est 7450
883 * To reset NAT64 session timeoutes to default values use:
884 * vpp# set nat64 timeouts reset
887 VLIB_CLI_COMMAND (set_nat64_timeouts_command, static) = {
888 .path = "set nat64 timeouts",
889 .short_help = "set nat64 timeouts udp <sec> icmp <sec> tcp-trans <sec> "
890 "tcp-est <sec> tcp-incoming-syn <sec> | reset",
891 .function = nat64_set_timeouts_command_fn,
896 * @cliexstart{show nat64 tiemouts}
897 * Show NAT64 session timeouts:
898 * vpp# show nat64 tiemouts
899 * NAT64 session timeouts:
902 * TCP transitory 240sec
903 * TCP established 7440sec
904 * TCP incoming SYN 6sec
907 VLIB_CLI_COMMAND (show_nat64_timeouts_command, static) = {
908 .path = "show nat64 tiemouts",
909 .short_help = "show nat64 tiemouts",
910 .function = nat64_show_timeouts_command_fn,
915 * @cliexstart{show nat64 session table}
916 * Show NAT64 session table.
917 * To show NAT64 TCP session table use:
918 * vpp# show nat64 session table tcp
919 * NAT64 tcp session table:
920 * fd01:1::2 6303 64:ff9b::ac10:202 20 10.0.0.3 62303 172.16.2.2 20 tcp vrf 0
921 * fd01:3::2 6303 64:ff9b::ac10:202 20 10.0.10.3 21300 172.16.2.2 20 tcp vrf 10
922 * To show NAT64 UDP session table use:
923 * #vpp show nat64 session table udp
924 * NAT64 udp session table:
925 * fd01:1::2 6304 64:ff9b::ac10:202 20 10.0.0.3 10546 172.16.2.2 20 udp vrf 0
926 * fd01:3::2 6304 64:ff9b::ac10:202 20 10.0.10.3 58627 172.16.2.2 20 udp vrf 10
927 * fd01:1::2 1235 64:ff9b::a00:3 4023 10.0.0.3 24488 10.0.0.3 4023 udp vrf 0
928 * fd01:1::3 23 64:ff9b::a00:3 24488 10.0.0.3 4023 10.0.0.3 24488 udp vrf 0
929 * To show NAT64 ICMP session table use:
930 * #vpp show nat64 session table icmp
931 * NAT64 icmp session table:
932 * fd01:1::2 64:ff9b::ac10:202 6305 10.0.0.3 172.16.2.2 63209 icmp vrf 0
935 VLIB_CLI_COMMAND (show_nat64_st_command, static) = {
936 .path = "show nat64 session table",
937 .short_help = "show nat64 session table all|tcp|udp|icmp|unknown",
938 .function = nat64_show_st_command_fn,
943 * @cliexstart{nat64 add prefix}
944 * Set NAT64 prefix for generating IPv6 representations of IPv4 addresses.
945 * To set NAT64 global prefix use:
946 * vpp# nat64 add prefix 2001:db8::/32
947 * To set NAT64 prefix for specific tenant use:
948 * vpp# nat64 add prefix 2001:db8:122:300::/56 tenant-vrf 10
951 VLIB_CLI_COMMAND (nat64_add_del_prefix_command, static) = {
952 .path = "nat64 add prefix",
953 .short_help = "nat64 add prefix <ip6-prefix>/<plen> [tenant-vrf <vrf-id>] "
955 .function = nat64_add_del_prefix_command_fn,
960 * @cliexstart{show nat64 prefix}
962 * To show NAT64 prefix use:
963 * vpp# show nat64 prefix
965 * 2001:db8::/32 tenant-vrf 0
966 * 2001:db8:122:300::/56 tenant-vrf 10
969 VLIB_CLI_COMMAND (show_nat64_prefix_command, static) = {
970 .path = "show nat64 prefix",
971 .short_help = "show nat64 prefix",
972 .function = nat64_show_prefix_command_fn,
978 * fd.io coding-style-patch-verification: ON
981 * eval: (c-set-style "gnu")