A-A+

【思科珍藏】PPPoE实验(模拟小区用户拨号上网)

2015年12月25日 站长资讯 暂无评论

实验拓扑:

像以前做的大部分实验,都是以大客户或者数据中心的形式,直接拉一根网线,配好网线就能上网。但是在现实生活中,大部分用户(比如小区)都是采用拨号上网的形式,通过验证用户账号及密码的方式上网,这样也方便运营商区分不同用户的业务类型以及计费方式。

如图,将在C1与R1之间通过拨号的方式上网(而非通过配置网关的方式)。

首先进行基本配置

  1. R1#conf t  
  2. R1(config-if)#int f0/0  
  3. R1(config-if)#ip add 12.0.0.1 255.255.255.252  
  4. R1(config-if)#no sh  
  5. R1(config-if)#ex  
  6. R1(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2  
  7.   
  8. R2#conf t  
  9. R2(config)#int f0/0  
  10. R2(config-if)#ip add 12.0.0.2 255.255.255.252  
  11. R2(config-if)#no sh  
  12. R2(config-if)#int f0/1  
  13. R2(config-if)#ip add 192.168.90.1 255.255.255.0  
  14. R2(config-if)#no sh  
  15. R2(config-if)#ex  
  16. R2(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.1  
  17.   
  18. R3#conf t  
  19. R3(config)#no ip routing  

2.进行PPPoE配置

PPPoE有2种身份验证方式,一种是本地验证(在R1上验证),第二种是运用专门的验证服务器验证(在C2上验证)

C1我绑定的网卡的是V1网卡,用真机来模拟,而C2我用一台模拟机来模拟。

(1)首先进行本地验证的演示

在R1上配置

  1. R1(config)#vpdn enable    //开启虚拟拨号功能  
  2. R1(config)#bba-group pppoe global  
  3. R1(config-bba-group)#virtual-template 1         //绑定虚模板  
  4. R1(config-bba-group)#sessions max limit 200      //最大允许的会话数  
  5. R1(config-bba-group)#ex  
  6.   
  7. R1(config)#ip dhcp pool pppoe                    //建立地址池  
  8. R1(dhcp-config)#network 112.1.1.0 255.255.255.0  
  9. R1(dhcp-config)#dns-server 1.1.1.1  
  10.   
  11. R1(dhcp-config)#int f0/1  
  12. R1(config-if)#pppoe enable group global            //开启接口下pppoe  
  13. R1(config-if)#no sh  
  14.   
  15. R1(config-if)#interface Virtual-Template1  
  16. R1(config-if)# ip address 112.1.1.1 255.255.255.0            //设置BARS下行口IP地址  
  17. R1(config-if)# peer default ip address dhcp-pool pppoe  
  18. R1(config-if)#ppp authentication pap                 //使用PAP方式验证  
  19. R1(config-if)#username test pass abc123              //用户名、密码  
  20. R1(config)#end  

这样就配置完成了,这里我配置的用户名为test ,密码为abc123

直接用宽带连接就可以拨号登录了。

  1. R1上show ip route  
  2. R1#show ip route  
  3. .....  
  4.   
  5.      112.0.0.0/8 is variably subnetted, 2 subnets, 2 masks  
  6. C       112.1.1.0/24 is directly connected, Virtual-Access1.1  
  7. C       112.1.1.2/32 is directly connected, Virtual-Access1.1  
  8.      12.0.0.0/30 is subnetted, 1 subnets  
  9. C       12.0.0.0 is directly connected, FastEthernet0/0  
  10. S*   0.0.0.0/0 [1/0] via 12.0.0.2  

可以发现有一个32位的IP地址已经分配出去了,即V1网卡的地址。

(2)服务器身份验证

由于路由器的资源有限,现网中很少用本地验证的方式,去承载大量的拨号用户名及密码的匹配条目,而是采用专门的服务器去做身份验证。

这里我用C2作为服务器,首先对C2的网卡参数进行配置。

网关设为R2的f0/1口,首先在R1上测试一下连通性

  1. R1(config)#do ping 192.168.90.1  
  2.   
  3. Type escape sequence to abort.  
  4. Sending 5, 100-byte ICMP Echos to 192.168.90.1, timeout is 2 seconds:  
  5. .!!!!  
  6. Success rate is 80 percent (4/5), round-trip min/avg/max = 36/52/60 ms  

没问题。

下面需要应用一款很实用的小软件WinRadius

将WinRadius共享进虚拟机C2,进行一些配置

设置——数据库,设为自动配置。

操作——添加账号,新建jack用户,密码abc123,还可以修改预付金额、形式等。

设置——多重秘钥,设置IP为R1的f0/0口地址、密码。

还可以对设置里的认证方式、计费方式进行设置。

下面,对R1进行配置,在本地验证的基础上

  1. R1(config)#vpdn enable         //开启虚拟拨号功能  
  2. R1(config)#bba-group pppoe global  
  3. R1(config-bba-group)#virtual-template 1         //绑定虚模板  
  4. R1(config-bba-group)#sessions max limit 200      //最大允许的会话数  
  5. R1(config-bba-group)#ex  
  6.   
  7. R1(config)#aaa new-model              //3a认证  
  8. R1(config)#!  
  9. R1(config)#!  
  10. R1(config)#aaa group server radius radius-groups  //设置使用服务器验证  
  11. R1(config-sg-radius)# server 192.168.90.11 auth-port 1812 acct-port 1813  
  12.   
  13. R1(config-sg-radius)#aaa authentication ppp test group radius group radius-groups       
  14. R1(config)#aaa accounting network test start-stop group radius group radius-groups   
  15.   
  16. R1(config)#radius-server host 192.168.90.11 auth-port 1812 acct-port 1813 key abc123   
  17. //绑定服务器的IP地址、端口和密码  
  18.     
  19. R1(config)#interface Virtual-Template1  
  20. R1(config-if)# ip address 112.1.1.1 255.255.255.0   
  21. R1(config-if)# peer default ip address dhcp-pool pppoe  
  22. R1(config-if)#no ppp authentication pap     //去掉刚才配置的PAP  
  23.   
  24. R1(config-if)#ppp authentication pap chap test   //使用PAP、CHAP方式验证  
  25. R1(config-if)#ppp accounting test  
  26.   
  27. R1(config-if)#int f0/1  
  28. R1(config-if)#pppoe enable group global  
  29. R1(config-if)# no shut  
  30. R1(config-if)#end  

这样,就设置好了。

可以进行拨号登录了,用户名jack,密码abc123

  1. R1#show ip route  
  2. .....  
  3.      112.0.0.0/8 is variably subnetted, 2 subnets, 2 masks  
  4. C       112.1.1.0/24 is directly connected, Virtual-Access1.1  
  5. C       112.1.1.3/32 is directly connected, Virtual-Access1.1  
  6.      12.0.0.0/30 is subnetted, 1 subnets  
  7. C       12.0.0.0 is directly connected, FastEthernet0/0  
  8. S*   0.0.0.0/0 [1/0] via 12.0.0.2  

又分配出去一个32位的IP地址 112.1.1.3

同时WinRadius上也有相应的登录成功日志了

实验完毕。

标签:

给我留言