13 ADDRESS TRANSLATION USING L2NAT This chapter describes the L2NAT ( Layer 2 Network Address Translation ) technique and the basics of configuring network address translation using L2NAT.

13.1 Introduction to L2NAT

L2NAT ( Layer 2 Network Address Translation ) allows a unique public IP (global) address to be assigned to an existing private IP address, providing the ability to communicate private subnets with public subnets.

L2NAT supports two translation tables: one stores the translation definitions of private addresses to public (global) addresses, and the other stores the translation definitions of public (global) addresses to private addresses. The translations are defined based on the physical addresses of the end devices.

The limitations of the L2NAT service are as follows:

 Cisco IOS version15.0 (2)EB minimum required,

 only IPv4 addresses can be translated,

 if L2NAT translation is configured for a host, it should not be configured as a DHCP client.

Requirements:

 you must use a switch that includes the L2NAT service (in Packet Tracer, this is the IE 2000 switch),

 you must configure so-called instances that define address translations,

 L2NAT instances must be assigned to an interface or VLAN.

13.2 L2NAT Operating Diagram

Figure 13.1 L2NAT operating diagram.

Assumption: PC1 performs a ping to the global address of PC2. ping 10.1.1.2

Step-by-step analysis of the L2NAT translation operation:

1 – packet in the direction from PC1 to PC2 before translation

Figure 13.2 Packet from PC1 to PC2 before translation is performed. 2 – Packet in the direction from PC1 to PC2 after translation

Figure 13.3 Packet from PC1 to PC2 after translation.

3 - Return packet in the direction from PC2 to PC1 before translation.

Figure 13.4 Packet from PC2 to PC1 before translation.

4 - Return packet in PC2 to PC1 direction after translation

Figure 13.5 Packet from PC2 to PC1 after translation.

Operations in the direction from PC1 to PC2:

 A frame arrives from the internal network and is to be forwarded to the external network.

 The switch searches the Layer 2 NAT table.

 The Layer 2 NAT table contains an entry that matches the local source address

 inside from host 10.1.1.1 to 100.1.1.1

 The switch converts the local address to a global address, which is 100.1.1.1 .

 The switch searches the Layer 2 NAT table.

 The Layer 2 NAT table contains an entry that matches the global destination address

 outside from host 100.1.1.2 to 10.1.1.2

 The switch converts the global address to the local address, which is 10.1.1.2 .

Operations in the direction from PC2 to PC1:

 A frame arrives from the external network and is to be forwarded to the internal network.

 The switch searches the Layer2 NAT table.

 The Layer 2 NAT table contains an entry that matches the local source address

 outside from host 100.1.1.2 to 10.1.1.2

 The switch converts the local address to a global address, which is 100.1.1.2 .

 The switch searches the Layer2 NAT table.

 The Layer 2 NAT table contains an entry that matches the global destination address.

 inside from host 10.1.1.1 to 100.1.1.1

 The switch converts the global address to a local address, that is, to 10.1.1.1 .

13.2.1 Example of the Simple L2NAT Configuration

Addressing table

Table 13.1 Addressing table.

Topology

Figure 13.6 L2NAT topology.

Configuring a simple topology with L2NAT is done in the following steps. Step 1. Connect two computers to the IE 2000 switch according to the topology. Step 2. Configure the IP addresses of the computers according to the addressing table Step 3. Configure an L2NAT instance named OUTSIDE on the IE 2000 switch. enable

conf t

l2nat instance OUTSIDE

inside from host 10.1.1.1 to 100.1.1.1 outside from host 100.1.1.2 to 10.1.1.2

Step 4. Assign the OUTSIDE instance to an interface on the IE 2000 interface Gi1/1

l2nat OUTSIDE

Step 5 . Check with the ping command the communication between the computers From the command line of PC1 (global address of PC2), execute: ping 10.1.1.2

From the command line of PC2 (global address PC1), execute: ping 100.1.1.1

13.2.2 Handling repeating IP addresses in L2NAT

The following example shows how, using the L2NAT service, you can configure repeating IP addresses (duplicate IP addresses). Here we will use two IE 2000 switches and one 2950 switch.

Addressing table

Table 13.2 Addressing table.

Switch configuration table - Part 1

Table 13.3 Switch configuration table - Part 1.

Switch configuration table – Part 2

--

--

Table 13.4 Switch configuration table - Part 2.

Topology

Figure 13.7 Network topology.

Configuring the above topology with L2NAT is done in the following steps. Step 1. Connect the devices according to the topology.

Step 2. Configure the IP addresses of the computers according to the addressing table, switch configuration tables (Part 1, 2).

Step 3. Configure the L2NAT service named A-Subnet on the SW-A switch according to the switch configuration table (Part 2).

enable

conf t

l2nat instance A-Subnet

inside from network 192.168.1.0 to 10.1.1.16 mask

255.255.255.240

outside from host 0.1.1.254 to 192.168.1.254 outside from network 10.1.1.32 to 192.168.1.32 mask

255.255.255.240

Step 4. Assign the A-Subnet instance to an interface on the SW-A switch. interface Gi 1/1

l2nat A-Subnet

Step 5. Configure the L2NAT service named B-Subnet on switch SW-B according to the switch configuration table (Part 2).

en

conf t

l2nat instance B-Subnet

inside from network 192.168.1.0 to 10.1.1.32 mask

255.255.255.240

outside from host 10.1.1.254 to 192.168.1.254 outside from network 10.1.1.32 to 192.168.1.0 mask

255.255.255.240

outside from network 10.1.1.16 to 192.168.1.16 mask

255.255.255.240

Step 6 . Assign the B-Subnet instance to an interface on switch SW-B. interface Gi1/1

l2nat B-Subnet

Step 7 . Check that PC-A1  PC-B1, PC-A2  PC-B2, PC-A3  PC-B3, can ping each other.