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
具体怎么做呢
追答这个很简单的,你去网上找下了。百度百科都可有