1、配置ISP:
ISP#conf t
ISP(config)#int f0/0
ISP(config-if)#ip add 10.1.1.1 255.255.255.0
ISP(config-if)#no shut
ISP(config-if)#exir
ISP(config)#int l 0
ISP(config-if)#ip add 1
ISP(config-if)#ip add 1.1.1.1 255.255.255.0
ISP(config-if)#no shut
ISP(config-if)#do show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 10.1.1.1 YES manual up up
FastEthernet1/0 unassigned YES unset administratively down down
Loopback0 1.1.1.1 YES manual up up
2、GW配置:
GW#
GW#conf t
GW(config)#int f0/0
GW(config-if)#ip add 10.1.1.2 255.255.255.0
GW(config-if)#no shut
GW(config-if)#exit
GW(config)#int f1/0
GW(config-if)#ip add 192.168.1.1 255.255.255.0
GW(config-if)#no shut
GW(config-if)#exit
GW(config)#do ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 32/47/60 ms
GW(config)#do ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
..!!!
Success rate is 60 percent (3/5), round-trip min/avg/max = 28/33/40 ms
GW(config)#
GW(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1
GW(config)#do ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/48/64 ms
GW(config)#int f0/0
GW(config-if)#ip nat outside
GW(config-if)#exit
GW(config)#int f1/0
GW(config-if)#ip nat inside
GW(config-if)#exit
GW(config)#access-list 1 permit any
GW(config)#ip nat inside source static 192.168.1.2 10.1.1.2
GW(config)#exit
3、PC配置:
PC#conf t
PC(config)#int f0/0
PC(config-if)#ip add 192.168.1.2 255.255.255.0
PC(config-if)#no shut
PC(config-if)#exi
PC(config)#no ip routing
PC(config)#ip default-gateway 192.168.1.1
Default gateway is 192.168.1.1
Host Gateway Last Use Total Uses Interface
ICMP redirect cache is empty
PC(config)#exit
PC#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 72/85/108 ms
PC#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 80/96/112 ms