Saturday, December 10, 2005

Cisco - Port Forwarding On Cisco Routers (inbound NAT)

A lot of other router manufacturers use the term Port Forwarding. In Cisco terminology, this is known as Inbound Network Address Translation (Inbound NAT). It is pretty easy to set up once you know how.

Lets assume you want to 'forward' tcp port 666 on your outside interface (ie your Internet accessible interface) to port 777 on a machine behind the router that has the address 192.168.1.10.

If you had a static public IP address, you would bind it to that address. But in our case, the IP address we get is dynamicly assigned by the ISP, so we instead bind it to our Dialer interface.

interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
! We define the FE interface as inside
ip nat inside
!
interface Dialer0
! This address is assigned by the ISP
ip address negotiated
! We define the dialer interface as outside
ip nat outside
!
! This is for outbound NAT (actually PAT)
ip nat inside source list 1 interface Dialer0 overload
! This binds outbound 192.168.1.10:777 to the public IP address on port 666 for TCP
! It also does the opposite (implied): This binds the public IP address on port 666 to 192.168.1.10:777
ip nat inside source static tcp 192.168.1.10 777 interface Dialer0 666

Info:

Cisco IOS Network Address Translation Overview

Configuring Network Address Translation: Getting Started
NAT Order of Operation

No comments: