Showing posts with label IPv6. Show all posts
Showing posts with label IPv6. Show all posts

Friday, February 21, 2020

How to configure IPv6 Automatic 6to4 Tunneling

Dynamic multipoint IPv6 tunnels are another migration technique we can use. It’s called dynamic because we don’t have to specify the end-point IPv4 address ourselves but its being automatically determined. The downside of multipoint IPv6 tunnels is that they don’t support IPv6 IGPs. You have to use static routes or BGP.
There are two different flavors:
Let’s dive in the automatic 6to4 tunnel to see how it works. We don’t configure the IPv4 end-point address ourselves but instead the IPv4 end-point address will be wrapped in the IPv6 destination address. Our IPv4 address is only 32-bit so it’s easy to fit it in a 128-bit IPv6 address right?
The 2002::/16 range has been reserved to use for tunneling. This IPv6 address space is only for tunneling and will never be used for IPv6 global unicast addresses. If we start with the 2002::/16 prefix we create a /48 prefix for each tunnel end-point. What we have to do is take the IPv4 address of the end-point and convert it into hexadecimal as bits 17 to 48.
The second step is that we can create subnets from /48 up to /64 prefixes for all the subnets behind the end-point.
IPv6 Tunneling Prefix
Here’s a graphical overview. 2002::/16 is the range we can use for the tunnels. The second part is the IPv4 end-point address converted to hexadecimal. Up to /64 we can use to create subnets. C0A8:1703 converts to IPv4 address 192.168.23.3. Do you have trouble calculating from hex to binary/decimal and vice versa?
R3(config)#ipv6 general-prefix MYPREFIX 6to4 fastEthernet 0/0

R3#show ipv6 general-prefix  
IPv6 Prefix MYPREFIX, acquired via 6to4
  2002:C0A8:1703::/48
There is a neat trick on Cisco routers that can do the work for you. First you have to configure an IPv4 address on an interface and then use the ipv6 general-prefix command. It will convert the IPv4 address in hexadecimal and give you the correct IPv6 tunnel prefix with the show ipv6 general-prefix command. I’m not sure if this is available on the CCNP ROUTE exam but it’s nice to know anyway! Let’s take a look at an actual configuration of automatic 6to4 tunneling, this is the topology:
ipv6 static tunneling
Let’s look at another example and configure automatic tunneling. The idea is that I don’t want to configure a tunnel destination on R1 nor R3…it should be created dynamically!
We’ll start with the configuration of the interfaces and IPv4 / IPv6 addresses:
R1(config)#interface loopback 0
R1(config-if)#ipv6 address 2001::1/128
R1(config-if)#exit
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 192.168.12.1 255.255.255.0
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 192.168.12.2 255.255.255.0
R2(config-if)#exit  
R2(config)#interface fastEthernet 1/0
R2(config-if)#ip address 192.168.23.2 255.255.255.0
R3(config)#interface fastEthernet 0/0
R3(config-if)#ip address 192.168.23.3 255.255.255.0
R3(config-if)#exit
R3(config)#interface loopback 0
R3(config-if)#ipv6 address 2001::3/128
Next step is to configure routing so that we have reachability in IPv4:
R1(config)#router eigrp 123
R1(config-router)#no auto-summary 
R1(config-router)#network 192.168.12.0
R2(config)#router eigrp 123
R2(config-router)#no auto-summary 
R2(config-router)#network 192.168.12.0
R2(config-router)#network 192.168.23.0
R3(config)#router eigrp 123
R3(config-router)#no auto-summary 
R3(config-router)#network 192.168.23.0
We will use the FastEthernet0/0 interfaces to build the tunnel. Since the tunnel is created automatically we need to know the IPv6 equivalent of the IPv4 addresses:
R1(config)#ipv6 general-prefix MYPREFIX 6to4 fastEthernet 0/0
R3(config)#ipv6 general-prefix MYPREFIX 6to4 fastEthernet 0/0
R1#show ipv6 general-prefix 
IPv6 Prefix MYPREFIX, acquired via 6to4
  2002:C0A8:C01::/48
R3#show ipv6 general-prefix 
IPv6 Prefix MYPREFIX, acquired via 6to4
  2002:C0A8:1703::/48

This time I’m going to use the IP addresses on the FastEthernet0/0 interfaces to build the tunnel. Since the tunnel is created automatically we need to know the IPv6 equivalent of the IPv4 addresses.
R1(config)#interface tunnel 0
R1(config-if)#ipv6 address 2002:C0A8:C01::1/64
R1(config-if)#tunnel source fastEthernet 0/0
R1(config-if)#tunnel mode ipv6ip 6to4
R3(config)#interface tunnel 0
R3(config-if)#ipv6 address 2002:C0A8:1703::3/64
R3(config-if)#tunnel source fastEthernet 0/0
R3(config-if)#tunnel mode ipv6ip 6to4
Let me walk you through this configuration: The tunnel interface has an IPv6 address that starts with 2002: and then the IPv4 address in hex:
  • Router R1:        192.168.12.1 – C0A8:C01
  • Router R3:       192.168.23.3 – C0A8:1703
The tunnel is sourced from the FastEthernet interface (I could have used a loopback as well) and there is no destination. That’s why we need the tunnel mode ipv6ip 6to4 command for. It tells the router to get the IPv4 address from the IPv6 address.
Are we done? Well almost. The tunnel configuration is OK but we still have to tell our routers how to reach the loopback0 interfaces. It’s impossible to run an IGP on dynamic tunnel interfaces so we can use static routes or BGP. I’m going to use static routes.
R1(config)#ipv6 route 2001::3/128 2002:C0A8:1703::3   
R1(config)#ipv6 route 2002::/16 tunnel 0
R3(config)#ipv6 route 2001::1/128 2002:C0A8:C01::1   
R3(config)#ipv6 route 2002::/16 tunnel 0
The first static route we need to tell our routers how to reach the loopback0 interface of the other side. It points to the IPv6 address which has the IPv4 address in hex in it. The routers will have to do recursive routing to find an entry for 2002:: which is why we need the second static route. Since 2002::/16 is reserved for tunneling I’m creating a static that points directly to our tunnel0 interface.
R1#ping 2001::3 source loopback 0

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:3::3, timeout is 2 seconds:
Packet sent with a source address of 2001::1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/8/8 ms
A quick ping shows we can reach the loopback0 interface of the other side! That’s how it is done. If you have any more questions please leave a comment.
hostname R1
!
interface loopback 0
 ipv6 address 2001::1/128
!
interface fastEthernet 0/0
 ip address 192.168.12.1 255.255.255.0
!
interface tunnel 0
 ipv6 address 2002:C0A8:C01::1/64
 tunnel source fastEthernet 0/0
 tunnel mode ipv6ip 6to4
!
router eigrp 123
 no auto-summary 
 network 192.168.12.0
 network 1.1.1.0
!
ipv6 general-prefix MYPREFIX 6to4 fastEthernet 0/0
!
ipv6 route 2001::3/128 2002:C0A8:1703::3
ipv6 route 2002::/16 tunnel 0
!
end
hostname R2
!
interface fastEthernet 0/0
 ip address 192.168.12.2 255.255.255.0
!
interface fastEthernet 1/0
 ip address 192.168.23.2 255.255.255.0
!
router eigrp 123
 no auto-summary 
 network 192.168.12.0
 network 192.168.23.0
!
end
hostname R3
!
interface loopback 0
 ipv6 address 2001::3/128
!
interface fastEthernet 0/0
 ip address 192.168.23.3 255.255.255.0
!
interface tunnel 0
 ipv6 address 2002:C0A8:1703::3/64
 tunnel source fastEthernet 0/0
 tunnel mode ipv6ip 6to4
!
router eigrp 123
 no auto-summary 
 network 192.168.23.0
 network 3.3.3.0
!
ipv6 general-prefix MYPREFIX 6to4 fastEthernet 0/0
!
ipv6 route 2001::1/128 2002:C0A8:C01::1  
ipv6 route 2002::/16 tunnel 0
!
end

How to configure IPv6 tunneling over IPv4

Since IPv4 and IPv6 are not compatible with each other we need some migration strategies. One technique that we can use is tunneling. Basically it means that we encapsulate IPv6 packets into IPv4 packets (or the other way around) so that it can be routed. In this lesson I’ll show you how to configure IPv6 static tunneling over an IPv4 network, there are two methods:
  • Manual tunnels
  • GRE (Generic Routing Encapsulation) tunnels
Both tunnel types are very similar with just minor differences. Both support IPv6 IGPs through the tunnel interface and forwarding of multicast traffic. The manual tunnels refer to RFC 4213 which defines how to encapsulate IPv6 packets in IPv4. GRE is a generic encapsulation type that rides on top of IPv4 and isn’t only for IPv6. It can carry many different protocols and if you ever configured an IPSEC VPN with IGPs running through it you had to use GRE.
Let’s continue by looking at some examples and how to configure the static point-to-point IPv6 tunnels.
ipv6 static tunneling
This is the topology we’ll be using. Three routers are running IPv4. R1 and R3 also run IPv6 and we want connectivity between them without adding IPv6 support on R2.
R1(config)#interface loopback 0
R1(config-if)#ipv6 address 2001::1/128
R1(config-if)#exit
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 192.168.12.1 255.255.255.0
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 192.168.12.2 255.255.255.0
R2(config-if)#exit  
R2(config)#interface fastEthernet 1/0
R2(config-if)#ip address 192.168.23.2 255.255.255.0
R3(config)#interface fastEthernet 0/0
R3(config-if)#ip address 192.168.23.3 255.255.255.0
R3(config-if)#exit
R3(config)#interface loopback 0
R3(config-if)#ipv6 address 2001::3/128
First we’ll fix the IPv4 and IPv6 addresses on the interfaces. Next step is to create a tunnel interface between R1 and R3. They need to be able to reach each other through IPv4.
R1(config)#interface loopback 1
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#router eigrp 123
R1(config-router)#no auto-summary 
R1(config-router)#network 192.168.12.0
R1(config-router)#network 1.1.1.0
R2(config)#router eigrp 123
R2(config-router)#no auto-summary 
R2(config-router)#network 192.168.12.0
R2(config-router)#network 192.168.23.0
R3(config)#interface loopback 1
R3(config-if)#ip address 3.3.3.3 255.255.255.0
R3(config-if)#exit
R3(config)#router eigrp 123
R3(config-router)#no auto-summary 
R3(config-router)#network 192.168.23.0
R3(config-router)#network 3.3.3.0
I’ll create a new loopback interface on R1 and R3. I’ll use these loopback interfaces to establish a tunnel interface between the two routers. I could also use physical interfaces but they can go down. Whenever a physical interface goes down our IGP (EIGRP in this example) could find another path (if there is another path).
R1(config)#interface tunnel 0
R1(config-if)#tunnel source loopback 1
R1(config-if)#tunnel destination 3.3.3.3
R1(config-if)#tunnel mode ipv6ip
R3(config)#interface tunnel 0
R3(config-if)#tunnel source loopback 1
R3(config-if)#tunnel destination 1.1.1.1
R3(config-if)#tunnel mode ipv6ip
This is how we configure a tunnel interface. By default a tunnel interface is always GRE so by using the tunnel mode ipv6ip command I changed it to a “manual” tunnel per RFC 4213. You can also configure the tunnel interface between the physical interfaces but I like to use loopback interfaces. This will make sure that when a physical interface fails your IGP will try to find another route to the loopback interface of your neighbor.
R1#show interfaces tunnel 0
Tunnel0 is up, line protocol is up 
  Hardware is Tunnel
  MTU 1514 bytes, BW 9 Kbit, DLY 500000 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation TUNNEL, loopback not set
  Keepalive not set
  Tunnel source 1.1.1.1 (Loopback1), destination 3.3.3.3
  Tunnel protocol/transport IPv6/IP
R3#show interfaces tunnel 0
Tunnel0 is up, line protocol is up 
  Hardware is Tunnel
  MTU 1514 bytes, BW 9 Kbit, DLY 500000 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation TUNNEL, loopback not set
  Keepalive not set
  Tunnel source 3.3.3.3 (Loopback1), destination 1.1.1.1
  Tunnel protocol/transport IPv6/IP
Use the show interfaces tunnel command to check if the tunnel is working. You can see mine is up and the encapsulation type is TUNNEL. At this moment our tunnel is working but we have some things left to do.
R1(config)#ipv6 unicast-routing
R1(config)#ipv6 router rip RIPNG
R1(config-rtr)#exit
R1(config)#interface loopback 0
R1(config-if)#ipv6 rip RIPNG enable 
R1(config-if)#exit
R1(config)#interface tunnel 0
R1(config-if)#ipv6 enable
R1(config-if)#ipv6 rip RIPNG enable
R3(config)#ipv6 unicast-routing 
R3(config)#ipv6 router rip RIPNG
R3(config-rtr)#exit
R3(config)#interface loopback 0
R3(config-if)#ipv6 rip RIPNG enable
R3(config-if)#exit
R3(config)#interface tunnel 0
R3(config-if)#ipv6 enable 
R3(config-if)#ipv6 rip RIPNG enable
I enabled RIPNG (could have chosen OSPFv3 or EIGRP as well) on the loopback0 and tunnel0 interface. You can see I also added an IPv6 address on the tunnel0 interfaces. We don’t need any IPv4 addresses on our tunnel0 interfaces.
R1#show ipv6 route rip           
IPv6 Routing Table - 4 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
       U - Per-user Static route
       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
       O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R   2001::3/128 [120/2]
     via FE80::303:303, Tunnel0
R3#show ipv6 route rip  
IPv6 Routing Table - 4 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
       U - Per-user Static route
       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
       O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R   2001::1/128 [120/2]
     via FE80::101:101, Tunnel0
You can see both routers learned about each other IPv6 networks.
R1#ping 2001::3 source loopback 0

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001::2, timeout is 2 seconds:
Packet sent with a source address of 2001::1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/8/8 ms
A quick ping proves us that we have connectivity.
That’s all you have to do to create a manual tunnel and encapsulate IPv6 packets in IPv4 packets. Not that bad right? How about GRE?
R1(config)#interface tunnel 0
R1(config-if)#tunnel mode gre ip
R3(config)#interface tunnel 0
R3(config-if)#tunnel mode gre ip
Use tunnel mode gre ip or type no tunnel mode ipv6ip so it switches back to the default (GRE).
R1#show interfaces tunnel 0
Tunnel0 is up, line protocol is up 
  Hardware is Tunnel
  MTU 1514 bytes, BW 9 Kbit, DLY 500000 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation TUNNEL, loopback not set
  Keepalive not set
  Tunnel source 1.1.1.1 (Loopback1), destination 3.3.3.3
  Tunnel protocol/transport GRE/IP
It looks pretty much the same except it now says GRE. The only difference between GRE and the manual tunnel is that GRE has a higher MTU by default and there’s something with the link-local IPv6 address of the tunnel interface:
  • The link-local address for the GRE tunnel is created with EUI-64 and takes the lowest numbered interface’s MAC address.
  • The link-local address for the manual tunnel is FE80::/96 + 32 bits from tunnel source IPv4 address.
hostname R2
!
interface fastEthernet 0/0
 ip address 192.168.12.2 255.255.255.0
!
interface fastEthernet 1/0
 ip address 192.168.23.2 255.255.255.0
!
router eigrp 123
 no auto-summary 
 network 192.168.12.0
 network 192.168.23.0
!
end
hostname R3
!
ipv6 unicast-routing
!
interface loopback 0
 ipv6 address 2001::3/128
 ipv6 rip RIPNG enable 
!
interface loopback 1
 ip address 3.3.3.3 255.255.255.0
!
interface fastEthernet 0/0
 ip address 192.168.23.3 255.255.255.0
!
interface tunnel 0
 tunnel source loopback 1
 tunnel destination 1.1.1.1
 tunnel mode ipv6ip
 tunnel mode gre ip
 ipv6 rip RIPNG enable
!
router eigrp 123
 no auto-summary 
 network 192.168.23.0
 network 3.3.3.0
!
ipv6 router rip RIPNG
!
ipv6 general-prefix MYPREFIX 6to4 fastEthernet 0/0
!
end
hostname R1
!
ipv6 unicast-routing
!
interface loopback 0
 ipv6 address 2001::1/128
 ipv6 rip RIPNG enable 
!
interface loopback 1
 ip address 1.1.1.1 255.255.255.0
!
interface fastEthernet 0/0
 ip address 192.168.12.1 255.255.255.0
!
interface tunnel 0
 tunnel source loopback 1
 tunnel destination 3.3.3.3
 tunnel mode ipv6ip
 tunnel mode gre ip
 ipv6 rip RIPNG enable
!
router eigrp 123
 no auto-summary 
 network 192.168.12.0
 network 1.1.1.0
!
ipv6 router rip RIPNG
!
ipv6 general-prefix MYPREFIX 6to4 fastEthernet 0/0
!
end

And that’s how you configure IPv6 static tunneling. If you have any questions just leave a comment!

IPv6 Access-list on Cisco IOS

As explained in my first tutorial that introduces access-lists, we can use access-lists for filtering (blocking packets) or selecting traffic (for VPNs, NAT, etc).
This also applies to IPv6 access-lists which are very similar to IPv4 access-lists. There are two important differences however:
  • IPv4 access-lists can be standard or extended, numbered or named. IPv6 only has named extended access-lists.
  • IPv4 access-lists have an invisible implicit deny any at the bottom of every access-list. IPv6 access-lists have three invisible statements at the bottom:
    • permit icmp any any nd-na
    • permit icmp any any nd-ns
    • deny ipv6 any any
The two permit statements are required for neighbor discovery which is an important protocol in IPv6, it’s the replacement for ARP.
When you use a deny ipv6 any any at the bottom of your access-list, make sure you also add the two permit statements for neighbor discovery just before the final statement or this traffic will be dropped.
Having said that, let’s take a look at the configuration.

Configuration

For this demonstration we only need two routers:
R1 R2 2001 DB8 0 12
I’ll use subnet 2001:DB8:0:12::/64 in between R1 and R2. To demonstrate the access-list, I’ll create one inbound on R2 and we will try to filter some packets from R1. Let’s take a look at the access-list:
R2(config)#ipv6 access-list ?
  WORD        User selected string identifying this access list
  log-update  Control access list log updates
As you can see above the only option is the named access-list. There’s also no option for standard or extended access-list. Let’s create that access-list:
R2(config)#ipv6 access-list R1_TRAFFIC
I’ll call it “R1_TRAFFIC”. Here are our options when we create a statement:
R2(config-ipv6-acl)#permit ?
  <0-255>             An IPv6 protocol number
  X:X:X:X::X/<0-128>  IPv6 source prefix x:x::y/<z>
  ahp                 Authentication Header Protocol
  any                 Any source prefix
  esp                 Encapsulation Security Payload
  host                A single source host
  icmp                Internet Control Message Protocol
  ipv6                Any IPv6
  pcp                 Payload Compression Protocol
  sctp                Streams Control Transmission Protocol
  tcp                 Transmission Control Protocol
  udp                 User Datagram Protocol
This is similar to IPv4 access-lists. You can pick any protocol you like. Let’s see if we can permit telnet traffic from R1 and deny everything else:
R2(config-ipv6-acl)#permit tcp ?
  X:X:X:X::X/<0-128>  IPv6 source prefix x:x::y/<z>
  any                 Any source prefix
  host                A single source host
Let’s permit telnet traffic from R1:
R2(config-ipv6-acl)#permit tcp host 2001:db8:0:12::1 ?
  X:X:X:X::X/  IPv6 destination prefix x:x::y/
  any                 Any destination prefix
  eq                  Match only packets on a given port number
  gt                  Match only packets with a greater port number
  host                A single destination host
  lt                  Match only packets with a lower port number
  neq                 Match only packets not on a given port number
  range               Match only packets in the range of port numbers
After specifying the source IP I also have to select the destination IP, let’s do that:
R2(config-ipv6-acl)#permit tcp host 2001:db8:0:12::1 any eq 23
This should permit telnet traffic from R1. Let’s take a look at our access-list:
R2#show access-lists 
IPv6 access list R1_TRAFFIC
    permit tcp host 2001:DB8:0:12::1 any eq telnet sequence 10
Above you see our statement. One cosmetic difference with IPv4 access-lists is that the sequence number is behind the statement. Let’s apply this access-list on the interface:
R2(config)#interface FastEthernet 0/0
R2(config-if)#ipv6 traffic-filter R1_TRAFFIC in
Instead of using the access-group command you have to use the ipv6 traffic-filter command. Let’s see if it works:
R1#telnet 2001:db8:0:12::2
Trying 2001:DB8:0:12::2 ... Open
R1 is able to telnet to R2. Let’s see if we find any matches on our access-list:
R2#show access-lists 
IPv6 access list R1_TRAFFIC
    permit tcp host 2001:DB8:0:12::1 any eq telnet (10 matches) sequence 10
There we go, we see it matches the access-list. Anything else should be dropped…let’s try a simple ping:
R1#ping 2001:db8:0:12::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:0:12::2, timeout is 2 seconds:
AAAAA
Success rate is 0 percent (0/5)
The AAAAAs that you see above indicate that the destination is administratively unreachable, it means that an access-list is dropping our packets.
Usually, this output indicates that an access list is blocking traffic. For security reasons it might be a bad idea to tell someone that traffic has been dropped. If you want you can disable this:
R2(config)#interface FastEthernet 0/0
R2(config-if)#no ipv6 unreachables 
Use the no ipv6 unreachables command to disable this. When we send another ping now you will see this:
R1#ping 2001:db8:0:12::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:0:12::2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R2 is no longer informing R1 that the packets have been dropped. That’s all I have for now, have fun configuring IPv6 access-lists.
hostname R1
!
ipv6 unicast-routing
!
interface FastEthernet0/0
 no ip address
 ipv6 address 2001:DB8:0:12::1/64
!
end
hostname R2
!
ipv6 unicast-routing
!
interface FastEthernet0/0
 no ip address
 ipv6 address 2001:DB8:0:12::2/64
 no ipv6 unreachables
 ipv6 traffic-filter R1_TRAFFIC in        
!
ipv6 access-list R1_TRAFFIC
 permit tcp host 2001:DB8:0:12::1 any eq telnet
!
end

You can also add an IPv6 access-list on a switchport (L2) interface with the PACL.
If you have any questions just leave a comment.

Cisco NAT64 Static Configuration

In this lesson we’ll take a look how to configure NAT64 so that an IPv4 host can communicate with an IPv6 host. Here’s the topology I will use:
R1 R2 R3 IPv4 IPv6 addressing
On the left side we have R1 where we use IPv4, on the right side we use R3 which only uses IPv6.
R2 in the middle will be configured for static NAT64 so that these two routers can communicate with each other.
NAT64 is a bit more complicated than “regular” NAT that you know from IPv4. When we use IPv4 NAT for internet connectivity then you only need to translate the source address, with NAT64 we have to translate everything.
When we send a packet from R1 to R3, what destination address will we use? R1 only understands IPv4 and R3 only understands IPv6.
To make this work, R1 needs to think it’s talking to an IPv4 address and R3 needs to think it’s talking with an IPv6 address. We’ll need some “mapping” between addresses and protocols on our NAT64 router.
Let’s take a look how it works…

Configuration

I will configure everything from scratch, let’s start with the interfaces:
R1(config)#interface FastEthernet 0/0
R1(config-if)#ip address 192.168.12.1 255.255.255.0
R2(config)#interface FastEthernet 0/0
R2(config-if)#ip address 192.168.12.2 255.255.255.0

R2(config)#interface FastEthernet 1/0
R2(config-if)#ipv6 address 2001:DB8:2323:2323::2/64
R3(config)#interface FastEthernet 0/0
R3(config-if)#ipv6 address 2001:DB8:2323:2323::3/64
That’s all we need. R2 will require unicast routing or it won’t do any NAT64 at all:
R2(config)#ipv6 unicast-routing
R3 will require a default route to R2, you’ll see why when we configure NAT64:
R3(config)#ipv6 route ::/0 2001:DB8:2323:2323::2
Before we configure NAT64, let’s do a quick test to make sure R2 can reach both routers:
R2#ping 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/2 ms
R2#ping 2001:DB8:2323:2323::3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:2323:2323::3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/2 ms
So far so good, now we can enable NAT64. First we have to enable it on the interfaces:
R2(config)#interface FastEthernet 0/0
R2(config-if)#nat64 enable
R2(config)#interface FastEthernet 1/0
R2(config-if)#nat64 enable 
Once you enable this you will see a syslog message that tells us that a virtual interface has been created:
%LINEPROTO-5-UPDOWN: Line protocol on Interface NVI0, changed state to up
Now we can configure the actual translation rules. We will use a fake IPv4 address that R1 can use as its destination and a fake IPv6 address that R3 can use as its destination.
IANA has allocated prefix 64:FF9B::/96 for NAT64 translations. When R2 receives anything that starts with this prefix then it will be processed by NAT64. We can use this prefix or we can use another one, I’ll show you how to choose your own prefix:
R2(config)#nat64 prefix stateful 3001::/96
Now we can use prefix 3001::/96 for our translation.
Let’s configure the actual translation rule:
R2(config)#nat64 v6v4 static 2001:DB8:2323:2323::3 192.168.12.3
This tells R2 that whenever we receive an IPv4 packet with destination address 192.168.12.3 that it has to be translated and forwarded to 2001:DB8:2323:2323::3. Let’s see if this works…

Verification

Before I try some pings, let’s enable a debug. This allows us to see what source and destination addresses are used:
R1#debug ip icmp 
ICMP packet debugging is on
R3#debug ipv6 icmp 
  ICMP Packet debugging is on
Now let’s send a ping from R1 to our fake IPv4 destination address:
R1#ping 192.168.12.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/16 ms
Great it’s working, the debugs tell us what addresses were used:
R1#
ICMP: echo reply rcvd, src 192.168.12.3, dst 192.168.12.1, topology BASE, dscp 0 topoid 0
R1 thinks it received a packet from 192.168.12.3. What about R3?
R3#
ICMPv6: Received echo request, Src=3001::C0A8:C01, Dst=2001:DB8:2323:2323::3
ICMPv6: Sent echo reply, Src=2001:DB8:2323:2323::3, Dst=3001::C0A8:C01
R3 thinks it’s talking with 3001::C0A8:C01. Where did this address come from? The first part looks familiar, that’s the 3001::/96 prefix that we configured. The last part is the IPv4 address of R1 in hexadecimal:
  • C0 = 192
  • A8 = 168
  • C = 12
  • 1 = 1
In case you are wondering, this works in both directions:
R3#ping 3001::C0A8:C01
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3001::C0A8:C01, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms
We can also use some show commands on R2 to verify things:
R2#show nat64 mappings static  

Static mappings configured: 1

Direction Protocol Address (Port, if any)
   Non-key Address (Port, if any)
   RG ID Mapping ID Is Valid

v6v4      ---      2001:DB8:2323:2323::3
   192.168.12.3
   0     0          FALSE
Above you can see what we have configured. The next show command is a bit more interesting:
R2#show nat64 statistics 
NAT64 Statistics

Total active translations: 1 (1 static, 0 dynamic; 0 extended)
Sessions found: 90
Sessions created: 13
Expired translations: 13
Global Stats:
   Packets translated (IPv4 -> IPv6)
      Stateless: 0
      Stateful: 63
      MAP-T: 0
   Packets translated (IPv6 -> IPv4)
      Stateless: 0
      Stateful: 40
      MAP-T: 0

Interface Statistics
   FastEthernet0/0 (IPv4 configured, IPv6 not configured):
      Packets translated (IPv4 -> IPv6)
         Stateless: 0
         Stateful: 63
         MAP-T: 0
      Packets translated (IPv6 -> IPv4)
         Stateless: 0
         Stateful: 0
         MAP-T: 0
      Packets dropped: 0
   FastEthernet1/0 (IPv4 not configured, IPv6 configured):
      Packets translated (IPv4 -> IPv6)
         Stateless: 0
         Stateful: 0
         MAP-T: 0
      Packets translated (IPv6 -> IPv4)
         Stateless: 0
         Stateful: 40
         MAP-T: 0
      Packets dropped: 10
Dynamic Mapping Statistics
   v6v4
Limit Statistics
The output above shows us how many translations were done and in what direction. The last show command is the most interesting one:
R2#show nat64 translations 

Proto  Original IPv4         Translated IPv4
       Translated IPv6       Original IPv6 
----------------------------------------------------------------------------

---    ---                   ---                                             
       192.168.12.3          2001:db8:2323:2323::3                           
icmp   192.168.12.1:15       [3001::c0a8:c01]:15                             
       192.168.12.3:15       [2001:db8:2323:2323::3]:15                      

Total number of translations: 2
Above you can see the dynamically created 3001::C0A8:C01 address that was created.

Conclusion

NAT64 can be pretty complex and this is one of those “last resort” methods. You should probably always use dual stack and/or tunneling instead of trying to translate entire protocols.
hostname R1
!
interface FastEthernet0/0
 ip address 192.168.12.1 255.255.255.0
 duplex auto
 speed auto
!
end
hostname R2
!
ipv6 unicast-routing
!
interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.0
 negotiation auto
 nat64 enable
!
interface FastEthernet1/0
 no ip address
 negotiation auto
 nat64 enable
 ipv6 address 2001:DB8:2323:2323::2/64
!
nat64 prefix stateful 3001::/96
nat64 v6v4 static 2001:DB8:2323:2323::3 192.168.12.3
!
end
hostname R3
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 2001:DB8:2323:2323::3/64
!         
ipv6 route ::/0 2001:DB8:2323:2323::2
!
end

If you have any questions, feel free to leave a comment!