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 (0, &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);
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 nat_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_nat_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 = nat_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,
362 "Outside address %U and port %u already in use.",
363 format_ip4_address, &out_addr, out_port);
365 case VNET_API_ERROR_INVALID_VALUE_2:
366 error = clib_error_return (0, "Invalid outside port.");
372 unformat_free (line_input);
378 nat64_cli_bib_walk (nat64_db_bib_entry_t * bibe, void *ctx)
380 vlib_main_t *vm = ctx;
383 fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
389 case IP_PROTOCOL_ICMP:
390 case IP_PROTOCOL_TCP:
391 case IP_PROTOCOL_UDP:
392 vlib_cli_output (vm, " %U %u %U %u protocol %U vrf %u %s %u sessions",
393 format_ip6_address, &bibe->in_addr,
394 clib_net_to_host_u16 (bibe->in_port),
395 format_ip4_address, &bibe->out_addr,
396 clib_net_to_host_u16 (bibe->out_port),
398 ip_proto_to_nat_proto (bibe->proto), fib->ft_table_id,
399 bibe->is_static ? "static" : "dynamic", bibe->ses_num);
402 vlib_cli_output (vm, " %U %U protocol %u vrf %u %s %u sessions",
403 format_ip6_address, &bibe->in_addr,
404 format_ip4_address, &bibe->out_addr,
405 bibe->proto, fib->ft_table_id,
406 bibe->is_static ? "static" : "dynamic", bibe->ses_num);
411 static clib_error_t *
412 nat64_show_bib_command_fn (vlib_main_t * vm,
413 unformat_input_t * input, vlib_cli_command_t * cmd)
415 nat64_main_t *nm = &nat64_main;
416 unformat_input_t _line_input, *line_input = &_line_input;
417 clib_error_t *error = 0;
418 u32 proto = NAT_PROTOCOL_OTHER;
422 if (!unformat_user (input, unformat_line_input, line_input))
425 if (unformat (line_input, "%U", unformat_nat_protocol, &proto))
426 p = nat_proto_to_ip_proto (proto);
427 else if (unformat (line_input, "unknown"))
429 else if (unformat (line_input, "all"))
433 error = clib_error_return (0, "unknown input: '%U'",
434 format_unformat_error, line_input);
439 vlib_cli_output (vm, "NAT64 BIB entries:");
441 vlib_cli_output (vm, "NAT64 %U BIB entries:", format_nat_protocol, proto);
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),
487 ip_proto_to_nat_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),
499 ip_proto_to_nat_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;
518 u32 proto = NAT_PROTOCOL_OTHER;
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_nat_protocol, &proto))
529 p = nat_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_nat_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, nat_fib_src_hi);
636 fib_table_entry_update_one_path (fib_index, &fibpfx,
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,
650 FIB_ROUTE_PATH_INTF_RX);
651 fib_table_unlock (fib_index, FIB_PROTOCOL_IP6, nat_fib_src_hi);
656 unformat_free (line_input);
662 nat64_cli_prefix_walk (nat64_prefix_t * p, void *ctx)
664 vlib_main_t *vm = ctx;
666 vlib_cli_output (vm, " %U/%u tenant-vrf %u",
667 format_ip6_address, &p->prefix, p->plen, p->vrf_id);
672 static clib_error_t *
673 nat64_show_prefix_command_fn (vlib_main_t * vm,
674 unformat_input_t * input,
675 vlib_cli_command_t * cmd)
677 vlib_cli_output (vm, "NAT64 prefix:");
678 nat64_prefix_walk (nat64_cli_prefix_walk, vm);
683 static clib_error_t *
684 nat64_add_interface_address_command_fn (vlib_main_t * vm,
685 unformat_input_t * input,
686 vlib_cli_command_t * cmd)
688 vnet_main_t *vnm = vnet_get_main ();
689 unformat_input_t _line_input, *line_input = &_line_input;
693 clib_error_t *error = 0;
695 /* Get a line of input. */
696 if (!unformat_user (input, unformat_line_input, line_input))
699 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
702 (line_input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index));
703 else if (unformat (line_input, "del"))
707 error = clib_error_return (0, "unknown input '%U'",
708 format_unformat_error, line_input);
713 rv = nat64_add_interface_address (sw_if_index, is_add);
717 case VNET_API_ERROR_NO_SUCH_ENTRY:
718 error = clib_error_return (0, "entry not exist");
720 case VNET_API_ERROR_VALUE_EXIST:
721 error = clib_error_return (0, "entry exist");
728 unformat_free (line_input);
737 * @cliexstart{nat64 add pool address}
738 * Add/delete NAT64 pool address.
739 * To add single NAT64 pool address use:
740 * vpp# nat64 add pool address 10.1.1.10
741 * To add NAT64 pool address range use:
742 * vpp# nat64 add pool address 10.1.1.2 - 10.1.1.5
743 * To add NAT64 pool address for specific tenant use:
744 * vpp# nat64 add pool address 10.1.1.100 tenant-vrf 100
747 VLIB_CLI_COMMAND (nat64_add_pool_address_command, static) = {
748 .path = "nat64 add pool address",
749 .short_help = "nat64 add pool address <ip4-range-start> [- <ip4-range-end>] "
750 "[tenant-vrf <vrf-id>] [del]",
751 .function = nat64_add_del_pool_addr_command_fn,
756 * @cliexstart{show nat64 pool}
758 * vpp# show nat64 pool
760 * 10.1.1.3 tenant VRF: 0
761 * 10.1.1.10 tenant VRF: 10
764 VLIB_CLI_COMMAND (show_nat64_pool_command, static) = {
765 .path = "show nat64 pool",
766 .short_help = "show nat64 pool",
767 .function = nat64_show_pool_command_fn,
772 * @cliexstart{set interface nat64}
773 * Enable/disable NAT64 feature on the interface.
774 * To enable NAT64 feature with local (IPv6) network interface
775 * GigabitEthernet0/8/0 and external (IPv4) network interface
776 * GigabitEthernet0/a/0 use:
777 * vpp# set interface nat64 in GigabitEthernet0/8/0 out GigabitEthernet0/a/0
780 VLIB_CLI_COMMAND (set_interface_nat64_command, static) = {
781 .path = "set interface nat64",
782 .short_help = "set interface nat64 in|out <intfc> [del]",
783 .function = nat64_interface_feature_command_fn,
788 * @cliexstart{show nat64 interfaces}
789 * Show interfaces with NAT64 feature.
790 * To show interfaces with NAT64 feature use:
791 * vpp# show nat64 interfaces
793 * GigabitEthernet0/8/0 in
794 * GigabitEthernet0/a/0 out
797 VLIB_CLI_COMMAND (show_nat64_interfaces_command, static) = {
798 .path = "show nat64 interfaces",
799 .short_help = "show nat64 interfaces",
800 .function = nat64_show_interfaces_command_fn,
805 * @cliexstart{nat64 add static bib}
806 * Add/delete NAT64 static BIB entry.
807 * To create NAT64 satatic BIB entry use:
808 * vpp# nat64 add static bib 2001:db8:c000:221:: 1234 10.1.1.3 5678 tcp
809 * vpp# nat64 add static bib 2001:db8:c000:221:: 1234 10.1.1.3 5678 udp vrf 10
812 VLIB_CLI_COMMAND (nat64_add_del_static_bib_command, static) = {
813 .path = "nat64 add static bib",
814 .short_help = "nat64 add static bib <ip6-addr> <port> <ip4-addr> <port> "
815 "tcp|udp|icmp [vfr <table-id>] [del]",
816 .function = nat64_add_del_static_bib_command_fn,
821 * @cliexstart{show nat64 bib}
822 * Show NAT64 BIB entries.
823 * To show NAT64 TCP BIB entries use:
824 * vpp# show nat64 bib tcp
826 * fd01:1::2 6303 10.0.0.3 62303 tcp vrf 0 dynamic 1 sessions
827 * 2001:db8:c000:221:: 1234 10.1.1.3 5678 tcp vrf 0 static 2 sessions
828 * To show NAT64 UDP BIB entries use:
829 * vpp# show nat64 bib udp
831 * fd01:1::2 6304 10.0.0.3 10546 udp vrf 0 dynamic 10 sessions
832 * 2001:db8:c000:221:: 1234 10.1.1.3 5678 udp vrf 10 static 0 sessions
833 * To show NAT64 ICMP BIB entries use:
834 * vpp# show nat64 bib icmp
836 * fd01:1::2 6305 10.0.0.3 63209 icmp vrf 10 dynamic 1 sessions
839 VLIB_CLI_COMMAND (show_nat64_bib_command, static) = {
840 .path = "show nat64 bib",
841 .short_help = "show nat64 bib all|tcp|udp|icmp|unknown",
842 .function = nat64_show_bib_command_fn,
847 * @cliexstart{show nat64 session table}
848 * Show NAT64 session table.
849 * To show NAT64 TCP session table use:
850 * vpp# show nat64 session table tcp
851 * NAT64 tcp session table:
852 * fd01:1::2 6303 64:ff9b::ac10:202 20 10.0.0.3 62303 172.16.2.2 20 tcp vrf 0
853 * fd01:3::2 6303 64:ff9b::ac10:202 20 10.0.10.3 21300 172.16.2.2 20 tcp vrf 10
854 * To show NAT64 UDP session table use:
855 * #vpp show nat64 session table udp
856 * NAT64 udp session table:
857 * fd01:1::2 6304 64:ff9b::ac10:202 20 10.0.0.3 10546 172.16.2.2 20 udp vrf 0
858 * fd01:3::2 6304 64:ff9b::ac10:202 20 10.0.10.3 58627 172.16.2.2 20 udp vrf 10
859 * fd01:1::2 1235 64:ff9b::a00:3 4023 10.0.0.3 24488 10.0.0.3 4023 udp vrf 0
860 * fd01:1::3 23 64:ff9b::a00:3 24488 10.0.0.3 4023 10.0.0.3 24488 udp vrf 0
861 * To show NAT64 ICMP session table use:
862 * #vpp show nat64 session table icmp
863 * NAT64 icmp session table:
864 * fd01:1::2 64:ff9b::ac10:202 6305 10.0.0.3 172.16.2.2 63209 icmp vrf 0
867 VLIB_CLI_COMMAND (show_nat64_st_command, static) = {
868 .path = "show nat64 session table",
869 .short_help = "show nat64 session table all|tcp|udp|icmp|unknown",
870 .function = nat64_show_st_command_fn,
875 * @cliexstart{nat64 add prefix}
876 * Set NAT64 prefix for generating IPv6 representations of IPv4 addresses.
877 * To set NAT64 global prefix use:
878 * vpp# nat64 add prefix 2001:db8::/32
879 * To set NAT64 prefix for specific tenant use:
880 * vpp# nat64 add prefix 2001:db8:122:300::/56 tenant-vrf 10
883 VLIB_CLI_COMMAND (nat64_add_del_prefix_command, static) = {
884 .path = "nat64 add prefix",
885 .short_help = "nat64 add prefix <ip6-prefix>/<plen> [tenant-vrf <vrf-id>] "
886 "[del] [interface <interface]",
887 .function = nat64_add_del_prefix_command_fn,
892 * @cliexstart{show nat64 prefix}
894 * To show NAT64 prefix use:
895 * vpp# show nat64 prefix
897 * 2001:db8::/32 tenant-vrf 0
898 * 2001:db8:122:300::/56 tenant-vrf 10
901 VLIB_CLI_COMMAND (show_nat64_prefix_command, static) = {
902 .path = "show nat64 prefix",
903 .short_help = "show nat64 prefix",
904 .function = nat64_show_prefix_command_fn,
909 * @cliexstart{nat64 add interface address}
910 * Add/delete NAT64 pool address from specific (DHCP addressed) interface.
911 * To add NAT64 pool address from specific interface use:
912 * vpp# nat64 add interface address GigabitEthernet0/8/0
915 VLIB_CLI_COMMAND (nat64_add_interface_address_command, static) = {
916 .path = "nat64 add interface address",
917 .short_help = "nat64 add interface address <interface> [del]",
918 .function = nat64_add_interface_address_command_fn,
923 * fd.io coding-style-patch-verification: ON
926 * eval: (c-set-style "gnu")