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 <nat/nat64.h>
22 #include <nat/nat_inlines.h>
23 #include <vnet/fib/fib_table.h>
26 nat64_add_del_pool_addr_command_fn (vlib_main_t * vm,
27 unformat_input_t * input,
28 vlib_cli_command_t * cmd)
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;
38 /* Get a line of input. */
39 if (!unformat_user (input, unformat_line_input, line_input))
42 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
44 if (unformat (line_input, "%U - %U",
45 unformat_ip4_address, &start_addr,
46 unformat_ip4_address, &end_addr))
48 else if (unformat (line_input, "tenant-vrf %u", &vrf_id))
50 else if (unformat (line_input, "%U", unformat_ip4_address, &start_addr))
51 end_addr = start_addr;
52 else if (unformat (line_input, "del"))
56 error = clib_error_return (0, "unknown input '%U'",
57 format_unformat_error, line_input);
62 start_host_order = clib_host_to_net_u32 (start_addr.as_u32);
63 end_host_order = clib_host_to_net_u32 (end_addr.as_u32);
65 if (end_host_order < start_host_order)
67 error = clib_error_return (0, "end address less than start address");
71 count = (end_host_order - start_host_order) + 1;
72 this_addr = start_addr;
74 for (i = 0; i < count; i++)
76 rv = nat64_add_del_pool_addr (&this_addr, vrf_id, is_add);
80 case VNET_API_ERROR_NO_SUCH_ENTRY:
82 clib_error_return (0, "NAT64 pool address %U not exist.",
83 format_ip4_address, &this_addr);
85 case VNET_API_ERROR_VALUE_EXIST:
87 clib_error_return (0, "NAT64 pool address %U exist.",
88 format_ip4_address, &this_addr);
94 increment_v4_address (&this_addr);
98 unformat_free (line_input);
104 nat64_cli_pool_walk (snat_address_t * ap, void *ctx)
106 vlib_main_t *vm = ctx;
108 if (ap->fib_index != ~0)
111 fib = fib_table_get (ap->fib_index, FIB_PROTOCOL_IP6);
114 vlib_cli_output (vm, " %U tenant VRF: %u", format_ip4_address,
115 &ap->addr, fib->ft_table_id);
118 vlib_cli_output (vm, " %U", format_ip4_address, &ap->addr);
120 #define _(N, i, n, s) \
121 vlib_cli_output (vm, " %d busy %s ports", ap->busy_##n##_ports, s);
122 foreach_snat_protocol
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 vlib_cli_output (vm, "NAT64 pool:");
133 nat64_pool_addr_walk (nat64_cli_pool_walk, vm);
138 static clib_error_t *
139 nat64_interface_feature_command_fn (vlib_main_t * vm,
141 input, vlib_cli_command_t * cmd)
143 unformat_input_t _line_input, *line_input = &_line_input;
144 vnet_main_t *vnm = vnet_get_main ();
145 clib_error_t *error = 0;
147 u32 *inside_sw_if_indices = 0;
148 u32 *outside_sw_if_indices = 0;
152 /* Get a line of input. */
153 if (!unformat_user (input, unformat_line_input, line_input))
156 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
158 if (unformat (line_input, "in %U", unformat_vnet_sw_interface,
160 vec_add1 (inside_sw_if_indices, sw_if_index);
161 else if (unformat (line_input, "out %U", unformat_vnet_sw_interface,
163 vec_add1 (outside_sw_if_indices, sw_if_index);
164 else if (unformat (line_input, "del"))
168 error = clib_error_return (0, "unknown input '%U'",
169 format_unformat_error, line_input);
174 if (vec_len (inside_sw_if_indices))
176 for (i = 0; i < vec_len (inside_sw_if_indices); i++)
178 sw_if_index = inside_sw_if_indices[i];
179 rv = nat64_add_del_interface (sw_if_index, 1, is_add);
182 case VNET_API_ERROR_NO_SUCH_ENTRY:
184 clib_error_return (0, "%U NAT64 feature not enabled.",
185 format_vnet_sw_if_index_name, vnm,
188 case VNET_API_ERROR_VALUE_EXIST:
190 clib_error_return (0, "%U NAT64 feature already enabled.",
191 format_vnet_sw_if_index_name, vnm,
194 case VNET_API_ERROR_INVALID_VALUE:
195 case VNET_API_ERROR_INVALID_VALUE_2:
197 clib_error_return (0,
198 "%U NAT64 feature enable/disable failed.",
199 format_vnet_sw_if_index_name, vnm,
209 if (vec_len (outside_sw_if_indices))
211 for (i = 0; i < vec_len (outside_sw_if_indices); i++)
213 sw_if_index = outside_sw_if_indices[i];
214 rv = nat64_add_del_interface (sw_if_index, 0, is_add);
217 case VNET_API_ERROR_NO_SUCH_ENTRY:
219 clib_error_return (0, "%U NAT64 feature not enabled.",
220 format_vnet_sw_if_index_name, vnm,
223 case VNET_API_ERROR_VALUE_EXIST:
225 clib_error_return (0, "%U NAT64 feature already enabled.",
226 format_vnet_sw_if_index_name, vnm,
229 case VNET_API_ERROR_INVALID_VALUE:
230 case VNET_API_ERROR_INVALID_VALUE_2:
232 clib_error_return (0,
233 "%U NAT64 feature enable/disable failed.",
234 format_vnet_sw_if_index_name, vnm,
245 unformat_free (line_input);
246 vec_free (inside_sw_if_indices);
247 vec_free (outside_sw_if_indices);
253 nat64_cli_interface_walk (snat_interface_t * i, void *ctx)
255 vlib_main_t *vm = ctx;
256 vnet_main_t *vnm = vnet_get_main ();
258 vlib_cli_output (vm, " %U %s", format_vnet_sw_if_index_name, vnm,
260 (nat_interface_is_inside (i)
261 && nat_interface_is_outside (i)) ? "in out" :
262 nat_interface_is_inside (i) ? "in" : "out");
266 static clib_error_t *
267 nat64_show_interfaces_command_fn (vlib_main_t * vm,
269 input, vlib_cli_command_t * cmd)
271 vlib_cli_output (vm, "NAT64 interfaces:");
272 nat64_interfaces_walk (nat64_cli_interface_walk, vm);
277 static clib_error_t *
278 nat64_add_del_static_bib_command_fn (vlib_main_t *
281 * input, vlib_cli_command_t * cmd)
283 unformat_input_t _line_input, *line_input = &_line_input;
284 clib_error_t *error = 0;
286 ip6_address_t in_addr;
287 ip4_address_t out_addr;
290 u32 vrf_id = 0, protocol;
291 snat_protocol_t proto = 0;
295 if (!unformat_user (input, unformat_line_input, line_input))
298 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
300 if (unformat (line_input, "%U %u", unformat_ip6_address,
303 else if (unformat (line_input, "%U %u", unformat_ip4_address,
304 &out_addr, &out_port))
306 else if (unformat (line_input, "vrf %u", &vrf_id))
308 else if (unformat (line_input, "%U", unformat_snat_protocol, &proto))
312 (line_input, "%U %U %u", unformat_ip6_address, &in_addr,
313 unformat_ip4_address, &out_addr, &protocol))
315 else if (unformat (line_input, "del"))
319 error = clib_error_return (0, "unknown input: '%U'",
320 format_unformat_error, line_input);
330 clib_error_return (0, "inside port and address must be set");
337 clib_error_return (0, "outside port and address must be set");
341 p = snat_proto_to_ip_proto (proto);
345 nat64_add_del_static_bib_entry (&in_addr, &out_addr, (u16) in_port,
346 (u16) out_port, p, vrf_id, is_add);
350 case VNET_API_ERROR_NO_SUCH_ENTRY:
351 error = clib_error_return (0, "NAT64 BIB entry not exist.");
353 case VNET_API_ERROR_VALUE_EXIST:
354 error = clib_error_return (0, "NAT64 BIB entry exist.");
356 case VNET_API_ERROR_UNSPECIFIED:
357 error = clib_error_return (0, "Crerate NAT64 BIB entry failed.");
359 case VNET_API_ERROR_INVALID_VALUE:
361 clib_error_return (0, "Outside addres %U and port %u already in use.",
362 format_ip4_address, &out_addr, out_port);
364 case VNET_API_ERROR_INVALID_VALUE_2:
365 error = clib_error_return (0, "Invalid outside port.");
371 unformat_free (line_input);
377 nat64_cli_bib_walk (nat64_db_bib_entry_t * bibe, void *ctx)
379 vlib_main_t *vm = ctx;
382 fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
388 case IP_PROTOCOL_ICMP:
389 case IP_PROTOCOL_TCP:
390 case IP_PROTOCOL_UDP:
391 vlib_cli_output (vm, " %U %u %U %u protocol %U vrf %u %s %u sessions",
392 format_ip6_address, &bibe->in_addr,
393 clib_net_to_host_u16 (bibe->in_port),
394 format_ip4_address, &bibe->out_addr,
395 clib_net_to_host_u16 (bibe->out_port),
396 format_snat_protocol,
397 ip_proto_to_snat_proto (bibe->proto), fib->ft_table_id,
398 bibe->is_static ? "static" : "dynamic", bibe->ses_num);
401 vlib_cli_output (vm, " %U %U protocol %u vrf %u %s %u sessions",
402 format_ip6_address, &bibe->in_addr,
403 format_ip4_address, &bibe->out_addr,
404 bibe->proto, fib->ft_table_id,
405 bibe->is_static ? "static" : "dynamic", bibe->ses_num);
410 static clib_error_t *
411 nat64_show_bib_command_fn (vlib_main_t * vm,
412 unformat_input_t * input, vlib_cli_command_t * cmd)
414 nat64_main_t *nm = &nat64_main;
415 unformat_input_t _line_input, *line_input = &_line_input;
416 clib_error_t *error = 0;
421 if (!unformat_user (input, unformat_line_input, line_input))
424 if (unformat (line_input, "%U", unformat_snat_protocol, &proto))
425 p = snat_proto_to_ip_proto (proto);
426 else if (unformat (line_input, "unknown"))
428 else if (unformat (line_input, "all"))
432 error = clib_error_return (0, "unknown input: '%U'",
433 format_unformat_error, line_input);
438 vlib_cli_output (vm, "NAT64 BIB entries:");
440 vlib_cli_output (vm, "NAT64 %U BIB entries:", format_snat_protocol,
444 vec_foreach (db, nm->db)
445 nat64_db_bib_walk (db, p, nat64_cli_bib_walk, vm);
449 unformat_free (line_input);
454 typedef struct nat64_cli_st_walk_ctx_t_
458 } nat64_cli_st_walk_ctx_t;
461 nat64_cli_st_walk (nat64_db_st_entry_t * ste, void *arg)
463 nat64_cli_st_walk_ctx_t *ctx = arg;
464 vlib_main_t *vm = ctx->vm;
465 nat64_db_bib_entry_t *bibe;
468 bibe = nat64_db_bib_entry_by_index (ctx->db, ste->proto, ste->bibe_index);
472 fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
476 u32 vrf_id = fib->ft_table_id;
478 if (ste->proto == IP_PROTOCOL_ICMP)
479 vlib_cli_output (vm, " %U %U %u %U %U %u protocol %U vrf %u",
480 format_ip6_address, &bibe->in_addr,
481 format_ip6_address, &ste->in_r_addr,
482 clib_net_to_host_u16 (bibe->in_port),
483 format_ip4_address, &bibe->out_addr,
484 format_ip4_address, &ste->out_r_addr,
485 clib_net_to_host_u16 (bibe->out_port),
486 format_snat_protocol,
487 ip_proto_to_snat_proto (bibe->proto), vrf_id);
488 else if (ste->proto == IP_PROTOCOL_TCP || ste->proto == IP_PROTOCOL_UDP)
489 vlib_cli_output (vm, " %U %u %U %u %U %u %U %u protcol %U vrf %u",
490 format_ip6_address, &bibe->in_addr,
491 clib_net_to_host_u16 (bibe->in_port),
492 format_ip6_address, &ste->in_r_addr,
493 clib_net_to_host_u16 (ste->r_port),
494 format_ip4_address, &bibe->out_addr,
495 clib_net_to_host_u16 (bibe->out_port),
496 format_ip4_address, &ste->out_r_addr,
497 clib_net_to_host_u16 (ste->r_port),
498 format_snat_protocol,
499 ip_proto_to_snat_proto (bibe->proto), vrf_id);
501 vlib_cli_output (vm, " %U %U %U %U protocol %u vrf %u",
502 format_ip6_address, &bibe->in_addr,
503 format_ip6_address, &ste->in_r_addr,
504 format_ip4_address, &bibe->out_addr,
505 format_ip4_address, &ste->out_r_addr,
506 bibe->proto, vrf_id);
511 static clib_error_t *
512 nat64_show_st_command_fn (vlib_main_t * vm,
513 unformat_input_t * input, vlib_cli_command_t * cmd)
515 nat64_main_t *nm = &nat64_main;
516 unformat_input_t _line_input, *line_input = &_line_input;
517 clib_error_t *error = 0;
521 nat64_cli_st_walk_ctx_t ctx = {
525 if (!unformat_user (input, unformat_line_input, line_input))
528 if (unformat (line_input, "%U", unformat_snat_protocol, &proto))
529 p = snat_proto_to_ip_proto (proto);
530 else if (unformat (line_input, "unknown"))
532 else if (unformat (line_input, "all"))
536 error = clib_error_return (0, "unknown input: '%U'",
537 format_unformat_error, line_input);
542 vlib_cli_output (vm, "NAT64 sessions:");
544 vlib_cli_output (vm, "NAT64 %U sessions:", format_snat_protocol, proto);
546 vec_foreach (db, nm->db)
549 nat64_db_st_walk (db, p, nat64_cli_st_walk, &ctx);
554 unformat_free (line_input);
559 static clib_error_t *
560 nat64_add_del_prefix_command_fn (vlib_main_t * vm, unformat_input_t * input,
561 vlib_cli_command_t * cmd)
563 vnet_main_t *vnm = vnet_get_main ();
564 clib_error_t *error = 0;
565 unformat_input_t _line_input, *line_input = &_line_input;
567 u32 vrf_id = 0, sw_if_index = ~0;
568 ip6_address_t prefix;
572 if (!unformat_user (input, unformat_line_input, line_input))
575 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
578 (line_input, "%U/%u", unformat_ip6_address, &prefix, &plen))
580 else if (unformat (line_input, "tenant-vrf %u", &vrf_id))
582 else if (unformat (line_input, "del"))
586 (line_input, "interface %U", unformat_vnet_sw_interface, vnm,
591 error = clib_error_return (0, "unknown input: '%U'",
592 format_unformat_error, line_input);
599 error = clib_error_return (0, "NAT64 prefix must be set.");
603 rv = nat64_add_del_prefix (&prefix, (u8) plen, vrf_id, is_add);
607 case VNET_API_ERROR_NO_SUCH_ENTRY:
608 error = clib_error_return (0, "NAT64 prefix not exist.");
610 case VNET_API_ERROR_INVALID_VALUE:
611 error = clib_error_return (0, "Invalid prefix length.");
618 * Add RX interface route, whenNAT isn't running on the real input
621 if (sw_if_index != ~0)
624 fib_prefix_t fibpfx = {
626 .fp_proto = FIB_PROTOCOL_IP6,
634 fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6,
635 vrf_id, FIB_SOURCE_PLUGIN_HI);
636 fib_table_entry_update_one_path (fib_index, &fibpfx,
637 FIB_SOURCE_PLUGIN_HI,
641 NULL, FIB_ROUTE_PATH_INTF_RX);
645 fib_index = fib_table_find (FIB_PROTOCOL_IP6, vrf_id);
646 fib_table_entry_path_remove (fib_index, &fibpfx,
647 FIB_SOURCE_PLUGIN_HI,
650 FIB_ROUTE_PATH_INTF_RX);
651 fib_table_unlock (fib_index, FIB_PROTOCOL_IP6,
652 FIB_SOURCE_PLUGIN_HI);
657 unformat_free (line_input);
663 nat64_cli_prefix_walk (nat64_prefix_t * p, void *ctx)
665 vlib_main_t *vm = ctx;
667 vlib_cli_output (vm, " %U/%u tenant-vrf %u",
668 format_ip6_address, &p->prefix, p->plen, p->vrf_id);
673 static clib_error_t *
674 nat64_show_prefix_command_fn (vlib_main_t * vm,
675 unformat_input_t * input,
676 vlib_cli_command_t * cmd)
678 vlib_cli_output (vm, "NAT64 prefix:");
679 nat64_prefix_walk (nat64_cli_prefix_walk, vm);
684 static clib_error_t *
685 nat64_add_interface_address_command_fn (vlib_main_t * vm,
686 unformat_input_t * input,
687 vlib_cli_command_t * cmd)
689 vnet_main_t *vnm = vnet_get_main ();
690 unformat_input_t _line_input, *line_input = &_line_input;
694 clib_error_t *error = 0;
696 /* Get a line of input. */
697 if (!unformat_user (input, unformat_line_input, line_input))
700 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
703 (line_input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index));
704 else if (unformat (line_input, "del"))
708 error = clib_error_return (0, "unknown input '%U'",
709 format_unformat_error, line_input);
714 rv = nat64_add_interface_address (sw_if_index, is_add);
718 case VNET_API_ERROR_NO_SUCH_ENTRY:
719 error = clib_error_return (0, "entry not exist");
721 case VNET_API_ERROR_VALUE_EXIST:
722 error = clib_error_return (0, "entry exist");
729 unformat_free (line_input);
738 * @cliexstart{nat64 add pool address}
739 * Add/delete NAT64 pool address.
740 * To add single NAT64 pool address use:
741 * vpp# nat64 add pool address 10.1.1.10
742 * To add NAT64 pool address range use:
743 * vpp# nat64 add pool address 10.1.1.2 - 10.1.1.5
744 * To add NAT64 pool address for specific tenant use:
745 * vpp# nat64 add pool address 10.1.1.100 tenant-vrf 100
748 VLIB_CLI_COMMAND (nat64_add_pool_address_command, static) = {
749 .path = "nat64 add pool address",
750 .short_help = "nat64 add pool address <ip4-range-start> [- <ip4-range-end>] "
751 "[tenant-vrf <vrf-id>] [del]",
752 .function = nat64_add_del_pool_addr_command_fn,
757 * @cliexstart{show nat64 pool}
759 * vpp# show nat64 pool
761 * 10.1.1.3 tenant VRF: 0
762 * 10.1.1.10 tenant VRF: 10
765 VLIB_CLI_COMMAND (show_nat64_pool_command, static) = {
766 .path = "show nat64 pool",
767 .short_help = "show nat64 pool",
768 .function = nat64_show_pool_command_fn,
773 * @cliexstart{set interface nat64}
774 * Enable/disable NAT64 feature on the interface.
775 * To enable NAT64 feature with local (IPv6) network interface
776 * GigabitEthernet0/8/0 and external (IPv4) network interface
777 * GigabitEthernet0/a/0 use:
778 * vpp# set interface nat64 in GigabitEthernet0/8/0 out GigabitEthernet0/a/0
781 VLIB_CLI_COMMAND (set_interface_nat64_command, static) = {
782 .path = "set interface nat64",
783 .short_help = "set interface nat64 in|out <intfc> [del]",
784 .function = nat64_interface_feature_command_fn,
789 * @cliexstart{show nat64 interfaces}
790 * Show interfaces with NAT64 feature.
791 * To show interfaces with NAT64 feature use:
792 * vpp# show nat64 interfaces
794 * GigabitEthernet0/8/0 in
795 * GigabitEthernet0/a/0 out
798 VLIB_CLI_COMMAND (show_nat64_interfaces_command, static) = {
799 .path = "show nat64 interfaces",
800 .short_help = "show nat64 interfaces",
801 .function = nat64_show_interfaces_command_fn,
806 * @cliexstart{nat64 add static bib}
807 * Add/delete NAT64 static BIB entry.
808 * To create NAT64 satatic BIB entry use:
809 * vpp# nat64 add static bib 2001:db8:c000:221:: 1234 10.1.1.3 5678 tcp
810 * vpp# nat64 add static bib 2001:db8:c000:221:: 1234 10.1.1.3 5678 udp vrf 10
813 VLIB_CLI_COMMAND (nat64_add_del_static_bib_command, static) = {
814 .path = "nat64 add static bib",
815 .short_help = "nat64 add static bib <ip6-addr> <port> <ip4-addr> <port> "
816 "tcp|udp|icmp [vfr <table-id>] [del]",
817 .function = nat64_add_del_static_bib_command_fn,
822 * @cliexstart{show nat64 bib}
823 * Show NAT64 BIB entries.
824 * To show NAT64 TCP BIB entries use:
825 * vpp# show nat64 bib tcp
827 * fd01:1::2 6303 10.0.0.3 62303 tcp vrf 0 dynamic 1 sessions
828 * 2001:db8:c000:221:: 1234 10.1.1.3 5678 tcp vrf 0 static 2 sessions
829 * To show NAT64 UDP BIB entries use:
830 * vpp# show nat64 bib udp
832 * fd01:1::2 6304 10.0.0.3 10546 udp vrf 0 dynamic 10 sessions
833 * 2001:db8:c000:221:: 1234 10.1.1.3 5678 udp vrf 10 static 0 sessions
834 * To show NAT64 ICMP BIB entries use:
835 * vpp# show nat64 bib icmp
837 * fd01:1::2 6305 10.0.0.3 63209 icmp vrf 10 dynamic 1 sessions
840 VLIB_CLI_COMMAND (show_nat64_bib_command, static) = {
841 .path = "show nat64 bib",
842 .short_help = "show nat64 bib all|tcp|udp|icmp|unknown",
843 .function = nat64_show_bib_command_fn,
848 * @cliexstart{show nat64 session table}
849 * Show NAT64 session table.
850 * To show NAT64 TCP session table use:
851 * vpp# show nat64 session table tcp
852 * NAT64 tcp session table:
853 * fd01:1::2 6303 64:ff9b::ac10:202 20 10.0.0.3 62303 172.16.2.2 20 tcp vrf 0
854 * fd01:3::2 6303 64:ff9b::ac10:202 20 10.0.10.3 21300 172.16.2.2 20 tcp vrf 10
855 * To show NAT64 UDP session table use:
856 * #vpp show nat64 session table udp
857 * NAT64 udp session table:
858 * fd01:1::2 6304 64:ff9b::ac10:202 20 10.0.0.3 10546 172.16.2.2 20 udp vrf 0
859 * fd01:3::2 6304 64:ff9b::ac10:202 20 10.0.10.3 58627 172.16.2.2 20 udp vrf 10
860 * fd01:1::2 1235 64:ff9b::a00:3 4023 10.0.0.3 24488 10.0.0.3 4023 udp vrf 0
861 * fd01:1::3 23 64:ff9b::a00:3 24488 10.0.0.3 4023 10.0.0.3 24488 udp vrf 0
862 * To show NAT64 ICMP session table use:
863 * #vpp show nat64 session table icmp
864 * NAT64 icmp session table:
865 * fd01:1::2 64:ff9b::ac10:202 6305 10.0.0.3 172.16.2.2 63209 icmp vrf 0
868 VLIB_CLI_COMMAND (show_nat64_st_command, static) = {
869 .path = "show nat64 session table",
870 .short_help = "show nat64 session table all|tcp|udp|icmp|unknown",
871 .function = nat64_show_st_command_fn,
876 * @cliexstart{nat64 add prefix}
877 * Set NAT64 prefix for generating IPv6 representations of IPv4 addresses.
878 * To set NAT64 global prefix use:
879 * vpp# nat64 add prefix 2001:db8::/32
880 * To set NAT64 prefix for specific tenant use:
881 * vpp# nat64 add prefix 2001:db8:122:300::/56 tenant-vrf 10
884 VLIB_CLI_COMMAND (nat64_add_del_prefix_command, static) = {
885 .path = "nat64 add prefix",
886 .short_help = "nat64 add prefix <ip6-prefix>/<plen> [tenant-vrf <vrf-id>] "
887 "[del] [interface <interface]",
888 .function = nat64_add_del_prefix_command_fn,
893 * @cliexstart{show nat64 prefix}
895 * To show NAT64 prefix use:
896 * vpp# show nat64 prefix
898 * 2001:db8::/32 tenant-vrf 0
899 * 2001:db8:122:300::/56 tenant-vrf 10
902 VLIB_CLI_COMMAND (show_nat64_prefix_command, static) = {
903 .path = "show nat64 prefix",
904 .short_help = "show nat64 prefix",
905 .function = nat64_show_prefix_command_fn,
910 * @cliexstart{nat64 add interface address}
911 * Add/delete NAT64 pool address from specific (DHCP addressed) interface.
912 * To add NAT64 pool address from specific interface use:
913 * vpp# nat64 add interface address GigabitEthernet0/8/0
916 VLIB_CLI_COMMAND (nat64_add_interface_address_command, static) = {
917 .path = "nat64 add interface address",
918 .short_help = "nat64 add interface address <interface> [del]",
919 .function = nat64_add_interface_address_command_fn,
924 * fd.io coding-style-patch-verification: ON
927 * eval: (c-set-style "gnu")