cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2237
Views
5
Helpful
20
Replies

NAT

emilio1973
Level 1
Level 1

Hi all,

I have a problem and i don't know how to solve it. I need all requests arriving on the WAN interface of R2  with 22,80.800 and 843 ports are redirected to the address 192.168.0.91. Here is my  configuration and topology:

access-list 110 permit tcp any host 213.190.2.182 eq 22
access-list 110 permit tcp any host 213.190.2.182 eq www
access-list 110 permit tcp any host 213.190.2.182 eq 800
access-list 110 permit tcp any host 213.190.2.182 eq 843

ip nat outside source static 213.190.2.182 192.168.0.91

interface FastEthernet0/0
ip address 192.168.0.2 255.255.255.128 secondary
ip address 192.168.1.30 255.255.255.0
ip nat inside
ip virtual-reassembly
duplex half
speed auto

!

!

interface GigabitEthernet1/0
ip address 213.190.2.182 255.255.255.0
ip nat outside
ip virtual-reassembly
negotiation auto

when I type the command "sh  ip nat translations", this is the result:

Pro Inside global      Inside local       Outside local      Outside global
--- ---                ---                192.168.0.91       213.190.2.182

Anyone  know what I'm doing wrong?

Thanks

1 Accepted Solution

Accepted Solutions

Jennifer Halim
Cisco Employee
Cisco Employee

Well, you don't SSH to the private ip address. That is the whole point of NATing it to a public ip address. If you are just going to SSH to the private ip address, then you don't need to configure NATing at all. If you try to SSH from the internet, then you need to NAT as only public ip address is accessible from the internet.

So from R3, you should be doing the following:

ssh -l abcd 213.190.2.182

Please also share the output of "show access-list"

View solution in original post

20 Replies 20

Jennifer Halim
Cisco Employee
Cisco Employee

You should remove this:

ip nat outside source static 213.190.2.182 192.168.0.91

It should be as follows:

ip nat inside source static tcp 192.168.0.91 22 interface GigabitEthernet1/0 22

ip nat inside source static tcp 192.168.0.91 80 interface GigabitEthernet1/0 80

ip nat inside source static tcp 192.168.0.91 800 interface GigabitEthernet1/0 800

ip nat inside source static tcp 192.168.0.91 843 interface GigabitEthernet1/0 843

Then issue clear ip nat trans *

Thank fo your reply,

I try it and this is the result:

sh ip nat translations
Pro Inside global      Inside local       Outside local      Outside global
tcp 213.190.2.182:22   192.168.0.91:22    ---                ---
tcp 213.190.2.182:80   192.168.0.91:80    ---                ---
tcp 213.190.2.182:800  192.168.0.91:800   ---                ---
tcp 213.190.2.182:843  192.168.0.91:843   ---                ---
GW1-IPSA#

I can't accest to address 192.168.0.91 by SSH. Can you help me?

Thanks

Are you seeing the connections coming in?

I assume that you are trying to SSH to the WAN IP address (213.190.2.182) from the Internet?

Do you have access-list configured on the WAN interface? and are you seeing a hit count?

Hi,

sh ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.30    YES manual up                    up 
FastEthernet0/1            unassigned      YES unset  administratively down down
GigabitEthernet1/0         213.190.2.182   YES manual up                    up 
GigabitEthernet2/0         unassigned      YES unset  administratively down down
NVI0                       unassigned      NO  unset  up                    up

I have an access-list configured and applicatted on interface WAN. I try to access to the address 192.168.0.91 by SSH from R3 (internet in this case) and this is the result:

R·#ssh -l abcd 192.168.0.91
% Destination unreachable; gateway or host down

R2#sh ip nat statistics
Total active translations: 4 (0 static, 4 dynamic; 4 extended)
Outside interfaces:
  GigabitEthernet1/0
Inside interfaces:
  FastEthernet0/0
Hits: 0  Misses: 0
CEF Translated packets: 0, CEF Punted packets: 0
Expired translations: 0
Dynamic mappings:
-- Inside Source
Queued Packets: 0
GW1-IPSA#

Jennifer Halim
Cisco Employee
Cisco Employee

Well, you don't SSH to the private ip address. That is the whole point of NATing it to a public ip address. If you are just going to SSH to the private ip address, then you don't need to configure NATing at all. If you try to SSH from the internet, then you need to NAT as only public ip address is accessible from the internet.

So from R3, you should be doing the following:

ssh -l abcd 213.190.2.182

Please also share the output of "show access-list"

This is the result:

R3#ssh -l abcd 213.190.2.182
% Destination unreachable; gateway or host down

R2#sh access-lists
Extended IP access list 110
    10 permit icmp any host 192.168.0.91 (for test)
    20 permit tcp any host 192.168.0.91 eq 22
    30 permit tcp any host 192.168.0.91 eq www
    40 permit tcp any host 192.168.0.91 eq 800
    50 permit tcp any host 192.168.0.91 eq 843

Thanks for your help

Access-list is incorrect. You should be matching on the public ip address as follows:

access-list 110 permit icmp any host 213.190.2.182

access-list 110 permit tcp any host 213.190.2.182 eq 22

access-list 110 permit tcp any host 213.190.2.182 eq 80

access-list 110 permit tcp any host 213.190.2.182 eq 800

access-list 110 permit tcp any host 213.190.2.182 eq 843

Ok, this is the output  of show "access-list" command on R2:

R2#sh access-lists
Extended IP access list 110
    10 permit icmp any host 213.190.2.182 (30 matches)
    20 permit tcp any host 213.190.2.182 eq 22 (16 matches)
    30 permit tcp any host 213.190.2.182 eq www
    40 permit tcp any host 213.190.2.182 eq 800
    50 permit tcp any host 213.190.2.182 eq 843

however, I still can not access the address  192.168.0.91

R3#ssh -l emilio 213.190.2.182

(takes a few seconds but this is the result)

R3#

or

R3#ssh -l abcd192.168.0.91
% Destination unreachable; gateway or host down

R3#

Thanks for your time

Is the host itself listening on port 22, 80, 800 and 843?

Are you able to access it from internally within the same subnet?

From R2, can you try to telnet on the port:

Test the following:

telnet 192.168.0.91 22

telnet 192.168.0.91 80

telnet 192.168.0.91 800

telnet 192.168.0.91 843

Ok, I' m not sure that. This is the result.

R2# telnet 192.168.0.91 22
Trying 192.168.0.91, 22 ...
% Connection timed out; remote host not responding

R2#telnet 192.168.0.91 80
Trying 192.168.0.91, 80 ...
% Connection timed out; remote host not responding

R2#

Add the configuration of R1:

version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
aaa new-model
!
!
!
aaa session-id common
!
!
ip cef
ip domain name cisco.rtp.com
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
username abcd privilege 15 password 0 abcd
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 192.168.0.91 255.255.255.0
duplex half
speed auto
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
gatekeeper
shutdown
!
!
line con 0
stopbits 1
line aux 0
stopbits 1
line vty 0 4
!
!
end

Well, first of all, HTTP server has not been enabled.

SSH on router, you would need to generate RSA keypair, and also configure "line vty 0 4" to allow SSH. I don't know how you are going to be able to connect on the remainder of the ports, 800 and 843 because you haven't configured anything on this router.

What are you actually trying to achieve here?

The only thing which will work is ping.

Well, I'm work in a lab test with GNS3. In the real case R1 will be a server. Now just generate RSA keypair, and also configure "line vty 0 4" to allow SSH.

I need to access R1 by SSH from anywhere (icmp is only for test)

This is the output of ping:

R3#ping 213.190.2.182

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 213.190.2.182, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/91/196 ms

but if i ping to the address to the 192.168.0.91 this is the result:

R3#ping 192.168.0.91

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.91, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R3#

if ping does work right,  the rest should work right but not happen so- Why?

It looks like your GNS3 is not working correctly.

It works fine in an IOS router.

Are you testing the secondary ip address theory?

Ok, tomorrow i'll try in a real router. I'll keep you updated

Thanks for your time

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: