PPPOE 实验

实验拓扑


图 1-1

注:如无特别说明,描述中的 R1 或 SW1 对应拓扑中设备名称末尾数字为 1 的设备,R2 或 SW2 对应拓扑中设备名称末尾数字为 2 的设备,以此类推;另外,同一网段中,IP 地址的主机位为其设备编号,如 R3 的 g0/0 接口若在 192.168.1.0/24 网段,则其 IP 地址为 192.168.1.3/24,以此类推


实验需求

  1. 如图,私网内部配置为 192.168.1.0/24 网段,R2 上配置 Loopback0 口模拟互联网地址
  2. 配置 R2 为 PPPoE Server,为 R1 提供 PPPoE 拨号服务,并为 R1 自动分配公网 IP 地址
  3. 配置 R1 为 PPPoE Client,自动进行拨号,永久在线,并能够自动获得公网 IP 地址
  4. 在 R1 上配置默认路由,并配置 EASY IP,使 PC3 可以访问互联网

实验解法

  1. 配置 IP 地址部分略

  2. 配置 R2 为 PPPoE Server,为 R1 提供 PPPoE 拨号服务,并为 R1 自动分配公网 IP 地址

    步骤 1:创建用户拨号验证的用户,服务类型为 PPP

    [R2]local-user wangdaye class network 
     New local user added.
    [R2-luser-network-wangdaye]password simple 123456
    [R2-luser-network-wangdaye]service-type ppp
    

    步骤 2:创建域 h3c,配置 PPP 验证模式为本地验证

    [R2]domain name h3c
    [R2-isp-h3c]authentication ppp local 
    

    步骤 3:创建用于动态分配给客户端的 IP 地址池

    [R2]ip pool 1 200.1.1.1 200.1.1.10
    

    步骤 4:创建 PPP 模板,配置服务端公网 IP 地址,并配置验证模式(调用域配置),绑定地址池

    [R2]interface Virtual-Template 1
    [R2-Virtual-Template1]ppp authentication-mode chap domain h3c
    [R2-Virtual-Template1]remote address pool 1
    [R2-Virtual-Template1]ip address 200.1.1.254 24
    

    步骤 4:在连接客户端的接口上绑定 PPP 模板

    [R2-GigabitEthernet0/0]pppoe-server bind virtual-template 1
    
  3. 配置 R1 为 PPPoE Client,并能够自动获得公网 IP 地址

    步骤 1:创建虚拟拨号接口,并配置验证,地址协商等相关参数

    [R1]dialer-group 1 rule ip permit 
    [R1]interface Dialer 1
    [R1-Dialer1]ip address ppp-negotiate 
    [R1-Dialer1]dialer bundle enable 
    [R1-Dialer1]dialer-group 1
    [R1-Dialer1]ppp chap user wangdaye
    [R1-Dialer1]ppp chap password simple 123456
    [R1-Dialer1]dialer timer idle 0
    

    步骤 2:进入连接公网的接口,绑定虚拟拨号接口

    [R1-GigabitEthernet0/1]pppoe-client dial-bundle-number 1
    
  4. 在 R1 上配置默认路由,并配置 EASY IP,使 PC3 可以访问互联网

    步骤 1:在 R1 上配置默认路由,出接口指向 Dialer1

    [R1]ip route-static 0.0.0.0 0 dialer 1
    

    步骤 2:配置 EASY IP,并在 Dialer1 口下发

    [R1]acl basic 2000
    [R1-acl-ipv4-basic-2000]rule permit source 192.168.1.0 0.0.0.255
    [R1]interface dialer 1
    [R1-Dialer1]nat outbound 2000
    

    效果测试:在 R1 上检查,发现已经拨号成功,并获得了公网 IP 地址,PC3 也可以访问互联网

    [R1]display ip interface brief 
    
    Interface                Physical Protocol IP Address      Description 
    Dia1                     up       up       200.1.1.1       --
    GE0/0                    down     down     192.168.1.1     --
    
    <PC3>ping 202.1.1.1
    Ping 202.1.1.1 (202.1.1.1): 56 data bytes, press CTRL_C to break
    56 bytes from 202.1.1.1: icmp_seq=0 ttl=254 time=26.000 ms
    56 bytes from 202.1.1.1: icmp_seq=1 ttl=254 time=50.000 ms
    56 bytes from 202.1.1.1: icmp_seq=2 ttl=254 time=50.000 ms
    56 bytes from 202.1.1.1: icmp_seq=3 ttl=254 time=27.000 ms
    56 bytes from 202.1.1.1: icmp_seq=4 ttl=254 time=49.000 ms