基本实验场景描述:使用路由器ISP_BBAGS、R6和桥接网络Internet模拟运营商为客户提供上网和PPPoE拨号服务,用户使用PPPoE客户端连接ISP;以及PPPoE客户端继续为自己内部用户提供PPPoE Server,使企业内部客户端向下继续使用PPPoE client共享上网拨号连接。
如果一个企业向ISP申请的PPPoE拨号接入互联网,内部主机数量有限,又不对外提供服务且企业内部使用的是一个傻瓜交换机,不提供基本二层安全功能,在路由器上绑定IP地址+MAC地址的方法又太繁琐的情况下,可以仅参考R2的部分配置——即向ISP发送PPPoE Client请求又向下提供PPPoE Server连接。
如果一个企业向ISP申请的PPPoE拨号接入互联网,并且有可管理的交换机划分VLAN,然后使用单臂路由的方式实现VLAN间路由并使用NAT共享上网的情况,仅参考R1的配置即可。(SW上仅做了基本的VLAN划分,具体的二层特性并没有实施,交换部分在以后的笔记专门记录)
实验拓扑图如下:
首先把模拟SP部分的路由器配置做好,(示例的DNS地址即ip name-server的221.6.4.66是我所在城市江苏省连云港市联通提供的DNS。)
【Internet是连接的虚拟机(PNetLab_LRv6)的NAT网络】,然后通过虚拟机的NAT网络出口去往真正的Internet。
路由器ISP_BBAGS的基础配置如下:
hostname ISP_BBAGS
!
ip name-server 221.6.4.66
!
username cisco password 0 cisco123
username ruijie password 0 cisco123
username admin password 0 cisco123
username root password 0 cisco123
!
bba-group pppoe B1
virtual-template 1
!
bba-group pppoe B2
virtual-template 2
!
interface Loopback1
ip address 5.5.5.5 255.255.255.255
!
interface Ethernet0/0
no ip address
no sh
pppoe enable group B1
!
interface Ethernet0/1
no ip address
no sh
pppoe enable group B2
!
interface Ethernet0/2
ip address 10.0.36.3 255.255.255.0
ip ospf network point-to-point
ip ospf 1 area 0
no sh
!
interface Virtual-Template1
mtu 1492
encapsulation ppp
ip address 203.0.113.255 255.255.255.254
peer default ip address pool BBAGS-1
ppp authentication pap chap
!
interface Virtual-Template2
encapsulation ppp
ip address 10.1.1.1 255.255.255.0
peer default ip address pool BBAGS-2
ppp authentication pap chap
!
router ospf 1
redistribute connected subnets
!
ip local pool BBAGS-1 203.0.113.1 203.0.113.10
ip local pool BBAGS-2 10.0.0.0
!
end
PPPoE为用户提供的地址都是掩码地址,所以0和255都是可用的,即一个C类地址段的256个IP地址都是可用的;虚拟模板接口(Virtual-Template)下的地址可以随意配置,不论你如何配置,这个地址只要是IPv4以内A、B、C类的并且掩码小于等于31位的地址都是可以配置并且和ip local pool定义的地址互通。
R6的基础配置如下:
hostname R6
!
interface Loopback0
ip address 6.6.6.6 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/0
ip address 10.0.36.6 255.255.255.0
ip ospf network point-to-point
ip ospf 1 area 0
no sh
!
interface Ethernet0/2
ip address dhcp
no sh
!
router ospf 1
default-information originate
!
ip route 0.0.0.0 0.0.0.0 192.168.234.137
!
end
模拟简易ISP网络部分的基础检测:
以上模拟ISP部分的网络基本可达互通。
首先使用User1(Microsoft Windows10)直接拨号测试:【开始-设置-网络和Internet-拨号:如下所示】
以上测试可以实现普通Windwos终端作为PPPoE Client直接拨入PPPoE Server端。
以下是多数中小企业使用的绝大数的网络架构设计和部署,即以R1为接入的网络基础设置。
R1的基础配置如下:
hostname R1
!
ip dhcp pool LAN100
network 192.168.100.0 255.255.255.0
default-router 192.168.100.254
dns-server 221.6.4.66
!
ip dhcp pool LAN200
network 192.168.200.0 255.255.255.0
default-router 192.168.200.254
dns-server 221.6.4.66
!
interface Ethernet0/0
no ip address
no sh
pppoe enable
pppoe-client dial-pool-number 1
!
interface Ethernet0/1
no ip address
no sh
!
interface Ethernet0/1.100
encapsulation dot1Q 100
ip address 192.168.100.254 255.255.255.0
ip nat inside
!
interface Ethernet0/1.200
encapsulation dot1Q 200
ip address 192.168.200.254 255.255.255.0
ip nat inside
!
interface Dialer0
ip address negotiated
ip nat outside
encapsulation ppp
ip tcp adjust-mss 1452
dialer pool 1
ppp authentication pap callin
ppp pap sent-username admin password 0 cisco123
!
ip nat inside source list 1 interface Dialer0 overload
ip route 0.0.0.0 0.0.0.0 Dialer0
!
access-list 1 permit 192.168.0.0 0.0.255.255
!
end
为了查看更简洁在设备上会默认自动生成的部分在配置文件手动删除,不影响实际配置,因为你使用这些配置会生成略微与以上配置不同的参数,例如ppp enable输入之后,系统会自动补上后面的group global;dialer接口上的mtu会自动填写参数为mut 1492的选项,等等。所以以上配置就是最简配置了,不能再省了。
SW的基础配置如下:
hostname SW
!
spanning-tree loopguard default
spanning-tree portfast edge default
!
interface Ethernet0/0
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface Ethernet0/1
switchport access vlan 100
switchport mode access
!
interface Ethernet0/2
switchport access vlan 200
switchport mode access
!
end
使用User2中的VPC用户测试基本连通性,如下:
使用User2中的Win10测试连接Internet的连通测试如下:
至此,User2部分的以R1为核心接入互联网的测试以完成。
接下来是同时使用PPPoE Client和PPPoE Server的实验演示;R2的基础配置为:
hostname R2
!
ip name-server 221.6.4.66
!
username 18951810000 password 0 123123
username cisco1024 password 0 123123
username cisco1025 password 0 123123
!
bba-group pppoe DL
virtual-template 200
!
!
interface Ethernet0/0
no ip address
no sh
pppoe enable group global
pppoe-client dial-pool-number 1
!
interface Ethernet0/1
no ip address
no sh
pppoe enable group DL
!
interface Virtual-Template200
encapsulation ppp
mtu 1492
ip address 172.16.1.255 255.255.255.254
ip nat inside
ip virtual-reassembly in
peer default ip address pool LAN
ppp authentication pap chap
!
interface Dialer0
mtu 1492
ip address negotiated
ip nat outside
ip virtual-reassembly in
encapsulation ppp
dialer pool 1
ppp authentication chap callin
ppp chap hostname root
ppp chap password 0 cisco123
!
ip local pool LAN 172.16.1.0 172.16.1.254
!
ip nat inside source list 1 interface Dialer0 overload
ip route 0.0.0.0 0.0.0.0 Dialer0
!
access-list 1 permit 172.16.1.0 0.0.0.255
!
end
以上R2默认自动生成的参数配置并没有手动删除,如果兴趣可以和R1的配置仔细对比查看。
(直连路由每次拨入的IP地址不同会有所改变,以拨入的IP地址作为C直连路由)
R2向上ISP拨号分配下来的IP地址是10.0.0.0,向下提供服务的本地IP地址为172.16.1.255,上配置上手动指定的,即使改成1.1.1.1也是同样可以为client提供服务并且连通性可达。
三个客户端拨号示例如下:
因为以下都是使用window10的客户端演示,设置接入与User1的方式相同,顾略掉细节。
Win1的拨号与访问互联网展示:
Win2的拨号与访问互联网展示:
Win3的拨号与访问互联网展示:
由于只是测试使用故只建立的3个账号测试,并且可以同时各自登录,如果需要更多,可以在路由器的本地用户数据录入即可。由以下可见,三个用户同时全部登录的查看。
在R2的“向上”拨入和接收R2提供的PPPoE Client的拨入均可同时连通并可达互联网。