Sunday, August 17, 2008

NAT - Port forwarding telnet

Here is the topology:

R1---->R3---->R4---->R5

R1 and R3 are on the 172.12.123.0/24 network.
R3 and R4 are on the 172.12.34.0/24 network.
R4 and R5 are on the 172.12.45.0/24 network.

The goal of this scenario is:

R1 uses R4's address and port 23 to telnet to R4
R1 uses R4's address and port 3001 to telnet to R5.
R1 does not have knowledge of R4-R5 network so NAT is necessary.
R5 uses R4 as default route.

When R1 enters "telnet 172.12.34.4" it should enter R4.
When R1 enters "telnet 172.12.34.4 3001" it should enter R5.

First set up R4 and R5 for vty access, remember to use rotary command on R5 to set up port 3001.

R4(config)#line vty 0 4
R4(config-line)#password cisco
R4(config-line)#login

R5(config)#line vty 5
R5(config-line)#rotary 1
R5(config-line)#password cisco
R5(config-line)#login

Also make R4's interface to R3 "ip nat outside", and R4's interface to R5 "ip nat inside."

On R4 we only need one more command now:

R4(config)#ip nat inside source static tcp 172.12.45.5 3001 172.12.34.4 3001

Now Let's try it:

R1#telnet 172.12.34.4
Trying 172.12.34.4 ... Open

User Access Verification

Password:
R4>


Perfect, we are in R4 now. Let's exit and try port 3001:

R1#telnet 172.12.34.4 3001
Trying 172.12.34.4, 3001 ... Open

User Access Verification

Password:
R5>


We are in R5 here. This was a lot easier than I thought :)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.