固定IP上网配置:
现有客户需要使用思科的2600路由器世如上网,用户为10M光纤,申请了16个固定IP,IP为61.161.xxx.2-61.161.xxx.14, 默认网关是61.161.xxx.1。内网IP段192.168.1.0,客户要实现192.168.1.50-192.168.1.60之间的IP可以上网,其余的不可以。
路由器e0/0接口为WAN外网接口,e0/1为LAN内网接口
interface e0/0
ip address 61.161.xxx.2 255.255.255.240 //这里可以使用61.161.xxx.2-14个地址中的任意一个,这里就用2
ip nat outside
full-duplex
no shutdown
interface e0/1
ip address 192.168.1.1 255.255.255.0
ip nat inside
full-duplex
no shutdown
//设置放行的IP地址列表
access-list 1 permit host 192.168.1.50
access-list 1 permit host 192.168.1.51
access-list 1 permit host 192.168.1.52
access-list 1 permit host 192.168.1.53
access-list 1 permit host 192.168.1.54
access-list 1 permit host 192.168.1.55
access-list 1 permit host 192.168.1.56
access-list 1 permit host 192.168.1.57
access-list 1 permit host 192.168.1.58
access-list 1 permit host 192.168.1.59
access-list 1 permit host 192.168.1.60
ip nat pool intoout 61.161.xxx.2 61.161.xxx.2 netmask 255.255.255.240 //这里复用61.161.xxx.2的地址,也可以这搜闭启样写:ip nat pool intoout 61.161.xxx.2 61.161.xxx.14 netmask 255.255.255.252 这样写之后,态简从地址池里选择任意可用的外网ip 转换。
ip nat inside source list 1 pool intoout Overload
ip route 0.0.0.0 0.0.0.0 61.161.xxx.1 //默认网关,即电信端的地址,下一跳地址。
配置后就可以上网了,但是客户端必须设置固定IP,配置DNS,不配置,因为没有开启DHCP服务,所以必须设置固定IP。
开启DHCP,则需要这样配置:
ip dhcp pool ABC
network 192.168.1.0
default router 192.168.1.1
dns-server 202.96.64.68
ip dhcp excluded-address 192.168.1.1 需要除去网关的地址,要不就冲突了。
没有ip的限制,就是单纯的上网,删除那个access-list 1 permit host 192.168.1.50 至access-list 1 permit host 192.168.1.60
增加 access-list 1 permit 192.168.1.0 255.255.255.0就可以了。
PPPOE拨号上网配置:
对以设置PPPOE上网,以太网接口LAN的配置不变,需要更改外网口WAN的配置和访问控制列表,增加VPDN的配置。用户名是admin,密码 123456,配置过程如下:
interface e0/1
ip address 192.168.1.1 255.255.255.0
ip nat inside
full-duplex
interface Dialer1 //建立一个拨号接口
ip address negotiated //拨号接口的地址是通过协商获得的
ip nat outside
encapsulation ppp //封装为ppp协议
dialer pool 1 //建立拨号池为 1
dialer-group 1 //建立拨号组1 有时候需要设置MTU值比如MTU=1492
mtu 1492
ppp authentication pap callin //加密的验证模式为pap,是chap,直接更改就可以了。
ppp pap sent-username admin password 0 123456 //用户名和密码
vpdn enable
vpdn-group office
request-dialin
protocol pppoe
pppoe enable
pppoe-client dial-pool-number 1
dialer-list 1 protocol ip permit
access-list 1 permit 192.168.1.0 255.255.255.0
ip route 0.0.0.0 0.0.0.0 Dialer1 permanent
ip nat inside source list 1 interface Dialer1 overload