路由器命名为AllenRouter

Router>en

Router#configure terminal

Router(config)#hostname AllenRouter

设置内网端口FE0/0的IP:192.168.0.1/24,外网端口FE0/1的IP:58.216.224.165/29,默认电信网关:58.216.224.161

AllenRouter(config)#interface fastEthernet 0/0

AllenRouter(config-if)#ip address 192.168.0.1 255.255.255.0

AllenRouter(config-if)#no shutdown

AllenRouter(config-if)#ip nat inside

AllenRouter(config)#interface fastEthernet 0/1

AllenRouter(config-if)#ip address 58.216.224.165 255.255.255.248

AllenRouter(config-if)#no shutdown

AllenRouter(config-if)#ip nat outside

AllenRouter(config)#ip route 0.0.0.0 0.0.0.0 58.216.224.161

做NAT访问

AllenRouter(config)#access-list 1 permit 192.168.0.0 0.0.0.255(其中0.0.0.255为反码=255.255.255.255-子网掩码255.255.255.0,容许NAT的内部网段为192.168.0.0/24)

AllenRouter(config)#ip nat inside source list 1 interface fastEthernet 0/1 overload(启用NAT,容许NAT的地址为ACL 1中定义的,overload表示所有内网计算机都使用同一个外网IP地址,多台机器复用一个IP)

在电脑上手动配置IP:192.168.0.5/24,GW:192.168.0.1,DNS:192.168.0.1/221.228.255.1即可上网