实验拓扑图
![](http://xwnet.blog.51cto.com/attachment/200903/200903281238219042687.jpg?x-oss-process=image/resize,w_1400/format,webp)
IP地址规划
客户机:192.168.1.1 255.255.255.0
R1:
f0/0 192.168.1.254 255.255.255.0
R2:
f1/0 1.1.1.1 255.255.255.0
基本配置步骤:
R1
Router>en
Router#conf t
Router(config)#hostname R1
R1(config)#int f1/0
R1(config-if)#pppoe enable
R1(config-if)#pppoe-client dial-pool-number 1
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int dialer 1
R1(config-if)#ip address negotiated
R1(config-if)#encapsulation ppp
R1(config-if)#ppp pap sent-username xiaowu password xiaowu
R1(config-if)#ppp authentication pap callin
R1(config-if)#mtu 1492
R1(config-if)#dialer pool 1
R1(config-if)#end
R1#conf t
R1(config)#int f0/0
R1(config-if)#ip address 192.168.1.254 255.255.255.0
R1(config-if)#no sh
R1(config-if)#end
R1#
Router#conf t
Router(config)#hostname R1
R1(config)#int f1/0
R1(config-if)#pppoe enable
R1(config-if)#pppoe-client dial-pool-number 1
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int dialer 1
R1(config-if)#ip address negotiated
R1(config-if)#encapsulation ppp
R1(config-if)#ppp pap sent-username xiaowu password xiaowu
R1(config-if)#ppp authentication pap callin
R1(config-if)#mtu 1492
R1(config-if)#dialer pool 1
R1(config-if)#end
R1#conf t
R1(config)#int f0/0
R1(config-if)#ip address 192.168.1.254 255.255.255.0
R1(config-if)#no sh
R1(config-if)#end
R1#
==========================================================
R2
Router>en
Router#conf t
Router(config)#hostname R2
R2(config)#vpdn enable
R2(config)#vpdn-group 1
R2(config-vpdn)#accept-dialin
R2(config-vpdn-acc-in)#protocol pppoe
R2(config-vpdn-acc-in)#virtual-template 1
R2(config-vpdn-acc-in)#end
R2#conf t
R2(config)#int virtual-template 1
R2(config-if)#ip address 1.1.1.1 255.255.255.0
R2(config-if)#encapsulation ppp
R2(config-if)#peer default ip address pool xiaowu
R2(config-if)#ppp authentication pap
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#ip local pool xiaowu 100.1.1.1 100.1.1.100
R2(config)#username xiaowu password xiaowu
R2(config)#int f1/0
R2(config-if)#pppoe enable
R2(config-if)#no sh
R2(config-if)#end
R2#
Router#conf t
Router(config)#hostname R2
R2(config)#vpdn enable
R2(config)#vpdn-group 1
R2(config-vpdn)#accept-dialin
R2(config-vpdn-acc-in)#protocol pppoe
R2(config-vpdn-acc-in)#virtual-template 1
R2(config-vpdn-acc-in)#end
R2#conf t
R2(config)#int virtual-template 1
R2(config-if)#ip address 1.1.1.1 255.255.255.0
R2(config-if)#encapsulation ppp
R2(config-if)#peer default ip address pool xiaowu
R2(config-if)#ppp authentication pap
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#ip local pool xiaowu 100.1.1.1 100.1.1.100
R2(config)#username xiaowu password xiaowu
R2(config)#int f1/0
R2(config-if)#pppoe enable
R2(config-if)#no sh
R2(config-if)#end
R2#
观察路由表
R1
R1#show ip route
*Mar 28 13:36:57.495: %SYS-5-CONFIG_I: Configured from console by console
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
*Mar 28 13:36:57.495: %SYS-5-CONFIG_I: Configured from console by console
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Dialer1
100.0.0.0/32 is subnetted, 1 subnets
C 100.1.1.1 is directly connected, Dialer1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
R1#
C 1.1.1.1 is directly connected, Dialer1
100.0.0.0/32 is subnetted, 1 subnets
C 100.1.1.1 is directly connected, Dialer1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
R1#
===========================================================
R2
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Virtual-Access1.1
100.0.0.0/32 is subnetted, 1 subnets
C 100.1.1.1 is directly connected, Virtual-Access1.1
R2#
C 1.1.1.0 is directly connected, Virtual-Access1.1
100.0.0.0/32 is subnetted, 1 subnets
C 100.1.1.1 is directly connected, Virtual-Access1.1
R2#
我们所配置100.0.0.0网段已经被注入到对方,这就是PPP的一个特点,连接PPP的一条线路的两端无需是同一个网段,NCP会自动将对端注入到路由之中。当然,这样配置完成仅仅是拨号成功,客户端依然不能上网,需要做NAT,准确的说是PAT,这里面就不做演示了。
本文转自 Jhuster 51CTO博客,原文链接:http://blog.51cto.com/xwnet/143153,如需转载请自行联系原作者