cisco 2811 怎么做公网IP映射到内网IP呢?

外部访问公网IP,直接转到内网服务器上面,这是怎么做呢?命令是什么?

R1:FastEthernet0/0            222.1.1.1           
        FastEthernet0/1            192.168.2.254

C1 IP:192.168.2.200

R2:FastEthernet0/0            222.1.1.2

        Loopback0                  8.1.1.1

 

R1 上的配置:

interface FastEthernet0/0
 ip address 222.1.1.1 255.255.255.0
 ip nat outside           注意接外网的接口用outside
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 192.168.2.254 255.255.255.0
 ip nat inside                接内网的接口用Inside
 duplex auto
 speed auto
!
ip nat pool servers 222.1.1.10 222.1.1.10 netmask 255.255.255.0    建立地址池
ip nat inside source list 101 pool servers overload                     做映射
ip classless
ip route 0.0.0.0 0.0.0.0 FastEthernet0/0
no ip http server
!
access-list 101 permit ip host 192.168.2.200 any                    建立acl,你需要映射出去的IP

 

以下是测试结果:R2为外网ping 192.168.2.200

 

R2#ping 192.168.2.200

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

 

以下是在R1上debug ip nat

00:31:46: NAT: s=192.168.2.200->222.1.1.10, d=222.1.1.2 [1794]
00:31:46: NAT: s=192.168.2.200->222.1.1.10, d=222.1.1.2 [1795]
00:31:46: NAT: s=192.168.2.200->222.1.1.10, d=222.1.1.2 [1796]
00:31:46: NAT: s=192.168.2.200->222.1.1.10, d=222.1.1.2 [1797]
00:31:46: NAT: s=192.168.2.200->222.1.1.10, d=222.1.1.2 [1798]

 

 

所用的外网IP就是建立地址池的222.1.1.10

温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-10-24
conf t
int 0/0(是具体拓扑自己定义那一个口是inside 或是outside)
ip nat inside

int 0/1
ip nat outside

route(config)#ip nat inside source static tcp x.x.x.x 端口号 x.x.x.x 端口号 entendable
欢迎追问
第2个回答  2013-10-23
用NAT技术啊追问

具体怎么做呢

追答

这个很简单的,你去网上找下了。百度百科都可有

相似回答