企业路由器R1配置:
1.开启DHCP
# 配置DHCP地址池
[R1]ip pool 1
[R1-ip-pool-1]network 192.168.1.0 mask 24
[R1-ip-pool-1]gateway-list 192.168.1.1
[R1-ip-pool-1]dns-list 8.8.8.8
# 开启DHCP
[R1]dhcp enable
# 配置内网接口地址及DHCP
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/0]dhcp select global
[R1-GigabitEthernet0/0/0]qu
[R1]
配置完成后,此时内网主机,就可以通过DHCP获取IP地址,并且能够ping通网关
2.配置PPPoE拨号
用户名:020 密码:123456
[R1]int Dialer 1
[R1-Dialer1]link-protocol ppp
[R1-Dialer1]ip add ppp-negotiate
[R1-Dialer1]ppp pap local-user 020 password simple 123456
[R1-Dialer1]dialer user 020
[R1-Dialer1]dialer bundle 2
[R1-Dialer1]qu
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]pppoe-client dial-bundle-number 2
[R1-GigabitEthernet0/0/1]
3.配置NAT和缺省路由
[R1]acl 2001
[R1-acl-basic-2001]rule permit source 192.168.1.0 0.0.0.255
[R1-acl-basic-2001]qu
[R1]int Dialer 1
[R1-Dialer1]nat outbound 2001
Info: The NAT address pool is empty
[R1-Dialer1]qu
[R1]ip route-s 0.0.0.0 0 Dialer 1
[R1]
进入到外网接口g0/0/1重启一下端口,此时可以发现dialer1已经通过pppoe拨号成功,并且获取到IP地址
此时内网主机ping服务器9.9.9.9已经可以ping通了
PC>ping 9.9.9.9
Ping 9.9.9.9: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 9.9.9.9: bytes=32 seq=2 ttl=253 time=31 ms
From 9.9.9.9: bytes=32 seq=3 ttl=253 time=47 ms
From 9.9.9.9: bytes=32 seq=4 ttl=253 time=47 ms
From 9.9.9.9: bytes=32 seq=5 ttl=253 time=15 ms
--- 9.9.9.9 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/35/47 ms
PC>
优化配置
由于原始以太网报文在传输过程中增加了PPPoE(6字节)和PPP(2字节)的包头,为了使得传输的数据在传输过程中不分片(提高传输效率),建议在dialer1口更改数据封装的MTU值。
[R1]int Dialer 1
[R1-Dialer1]MTU 1492
[R1-Dialer1]
以太网接口默认1500字节,现在修改为1492字节。
*服务端配置,一般不需要我们配置,由运营商提供PPPoE账号密码即可
[R2]ip pool 1
[R2-ip-pool-1]network 202.1.1.0 mask 24
[R2-ip-pool-1]gateway-list 202.1.1.2
[R2-ip-pool-1]dns-list 9.9.9.9
[R2-ip-pool-1]qu
[R2]aaa
[R2-aaa]local-user 020 password cipher 123456
[R2-aaa]local-user 020 service-type ppp
[R2]int Virtual-Template 1
[R2-Virtual-Template1]ppp authentication-mode pap
[R2-Virtual-Template1]remote add pool 1
[R2-Virtual-Template1]ip add 202.1.1.2 24
[R2-GigabitEthernet0/0/0]pppoe-server bind virtual-template 1
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 9.9.9.1 24 #服务器9.9.9.9网关
配置示例工程文件下载地址:
https://download.csdn.net/download/i12344/85290377
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)