PPPoE 设置 Cisco 881W

网络工程 思科 纳特 dhcp pppoe
2021-07-18 10:21:26

我一直试图自己解决这个问题,但恐怕我不能。

我已经尝试了基本上每个教程,但它仍然不起作用。

这里有人可以写一篇关于如何让 PPPoE 与 NAT 和内部 DHCP 一起工作的教程吗?

我得到的所有信息都是 IP、Netmask PPP 封装 (pap) 以及我的用户名和密码。

我有一条从墙壁直接连接到 Cisco 881W 中的 FastEthernet 4 端口 (WAN) 的电缆。我的电脑通过控制台电缆与串行连接。

IP 应该是 185.187.---.254,网络掩码应该是 255.255.255.255

Current configuration : 2440 bytes

version 12.4
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption

hostname Router

boot-start-marker
boot-end-marker

logging message-counter syslog

no aaa new-model
service-module wlan-ap 0 bootimage autonomous


ip source-route


ip cef
no ipv6 cef


multilink bundle-name authenticated
vpdn enable

vpdn-group 1
 request-dialin
  protocol pppoe

license boot module c880-data level advipservices




archive
 log config
  hidekeys





interface FastEthernet0
 pppoe enable group global
 pppoe-client dial-pool-number 1

interface FastEthernet1

interface FastEthernet2

interface FastEthernet3

interface FastEthernet4
 description Physical WAN Interface
 bandwidth inherit
 no ip address
 no ip redirects
 no ip unreachables
 no ip proxy-arp
 ip flow ingress
 ip nat outside
 ip virtual-reassembly
 duplex auto
 speed auto
 pppoe enable group global
 pppoe-client dial-pool-number 1
 hold-queue 224 in

interface wlan-ap0
 description Service module interface to manage the embedded AP
 no ip address
 shutdown
 arp timeout 0

interface Wlan-GigabitEthernet0
 description Internal switch interface connecting to the embedded AP

interface Vlan1
 no ip address
 ip nat inside
 ip virtual-reassembly

interface Dialer0
 ip address negotiated
 ip verify unicast reverse-path
 no ip redirects
 no ip unreachables
 ip directed-broadcast
 no ip proxy-arp
 ip mtu 1492
 ip nat outside
 ip virtual-reassembly
 encapsulation ppp
 ip tcp adjust-mss 1400
 load-interval 30
 dialer pool 1
 dialer-group 1
 ppp authentication pap callin
 ppp pap sent-username --- password 0 ---
 ppp ipcp dns request accept
 ppp ipcp route default
 ppp ipcp address accept

ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 Dialer0
no ip http server
no ip http secure-server


ip nat pool pool1 192.168.1.0 192.168.2.0 netmask 255.255.252.0
ip nat inside source list 1 interface Dialer0 overload
ip nat inside source list 100 interface Dialer0 overload
ip nat outside source list 1 interface FastEthernet0

access-list 1 permit 0.0.0.0 255.255.255.0
access-list 100 permit ip 192.168.0.0 0.0.0.255 any
dialer-list 1 protocol ip permit





control-plane


line con 0
 no modem enable
line aux 0
line 2
 no activation-character
 no exec
 transport preferred none
 transport input all
line vty 0 4
 login

scheduler max-task-time 5000
end

Router#
1个回答

谢谢,我想我明白了。

哦,当我们在做的时候,远离列表、组等中的“1”。这对新手来说是一个不必要的障碍,因为 - 虽然技术上正确且工作完美 - 它无助于了解什么属于什么。所以我将使用不同的数字(有些高达 128)

完整的 PPPoE、NAT、DHCP 设置需要以下内容:

1. 拨号列表和拨号组

dialer-list定义了什么样的流量可以触发拨号接口起作用(请记住,那些是在按需拨号路由和 ISDN 的鼎盛时期使用的,在那里您希望防止所有昂贵的通道一直运行)。

您可以定义明确定义哪些流量模式被视为“有趣”的标准 - 再次记住,历史路由器必须能够通过例如 ISDN 拨出一个给定的目标 IP 范围,而对于另一个 IP 范围,调制解调器连接是要使用的。为了设置这些标准,通常使用(编号的)访问列表。

看起来像这样:

router(config)#dialer-list 124 protocol ip list ?
  <1-199>      IP access list
  <1300-2699>  IP expanded access list

但是,在您的情况下,以下内容会很好,因为我们认为任何 IP 流量都很有趣。

dialer-list 124 protocol ip permit

在 Dialer Interface 下,我们引用了 dialer-list:

interface dialer 0
 [...]
 dialer-group 124
 [...]

2. PPPoE Con​​fig:拨号池和接口

当然,要谈PPPoE的接口需要配置。我认为你很好地得到了那个。然而,我再次建议远离“1”。

interface fastEthernet4
 no ip address
 pppoe enable group global
 pppoe-client dial-pool-number 122

881 上的 FastEthernet0 接口不是PPPoE 接口。请务必从那里删除所有与 PPPoE 相关的配置。

在拨号接口上,您需要将接口分配给拨号池(请记住,历史上的路由器有时有许多拨号接口和许多不同性质的具有拨号功能的接口可供选择,因此称为拨号池。)

interface dialer 0
 [...]
 dialer-pool 122
 [...]

3. PPPoE 认证/协商

那一个通常由服务提供商定义

interface Dialer 0
 ip address negotiated
 [...]
 ppp authentication pap callin 
 ppp pap sent-username <USERNAME> password 0 <PASSWORD> 
 ppp ipcp dns request accept 
 ppp ipcp route default 
 ppp ipcp address accept

这些位配置拨号器接口,以...

  • 没有预定义的 IP 地址,而是协商它(使用 IPCP)。
  • 使用 PAP 作为身份验证机制(替代:CHAP)
  • 发送和(请记住,使用 PAP,这些是以明文形式发送的!)
  • 通过 PPP-IPCP 请求 DNS 服务器信息
  • 请求通过 PPP-IPCP 学习默认路由
  • 请求获取IP地址

4. 默认路由

需要有一个(默认)路由指向拨号接口;我想你说得对:

ip route 0.0.0.0 0.0.0.0 Dialer0

然而,我建议这样做(添加管理距离为 10 的浮动默认值)

ip route 0.0.0.0 0.0.0.0 Dialer0 10

来自 dialer0 接口ppp ipcp 路由默认值将安装管理距离为 1 的路由,在 PPPoE 会话启动时覆盖上述路由。

6. LAN 接口、DNS 和 DHCP

881 有一个集成的 4 端口交换机,您需要将其视为此类交换机。您不能为它的各个接口分配 IP 地址,但您需要一个 VLAN 和一个 SVI(“接口 vlan”)来配合它。

在这种情况下,我们将使用 192.168.10.0 和 VLAN10 作为内部网络。相应地进行调整以适合您的网络情况。

vlan 10
 name INSIDE_VLAN

interface FastEthernet0
 description LAN PORT
 switchport mode access
 switchport access vlan 10
 spanning-tree portfast

interface FastEthernet1
 description LAN PORT
 switchport mode access
 switchport access vlan 10
 spanning-tree portfast

interface FastEthernet2
 description LAN PORT
 switchport mode access
 switchport access vlan 10
 spanning-tree portfast

interface FastEthernet3
 description LAN PORT
 switchport mode access
 switchport access vlan 10
 spanning-tree portfast

interface vlan 10
 ip address 192.168.10.1 255.255.255.0

然后你需要一些 DHCP 和 DNS 位来配置。我们希望我们的路由器充当客户端的 DNS 代理(将所有 DNS 请求转发到我们手动配置的 DNS 服务器,或者通过 PPP-IPCP 学习的那些,见上文)

我们希望我们的 DHCP 池从 192.168.10.64 到 192.168.10.127,并向我们的客户端分发一些适当的信息,并将 DHCP 租用时间设置为 1 天 0 小时 0 分钟。

ip dns server
ip dhcp excluded-address 192.168.10.1 192.168.10.63
ip dhcp excluded-address 192.168.10.128 192.168.10.255

ip dhcp pool MYVLAN10-POOL
 network 192.168.10.0 255.255.255.0
 default-router 192.168.10.1
 dns-server 192.168.10.1
 lease 1 0 0

当然,如果您希望您的 LAN 客户端查询其他一些 DNS 服务器(例如内部 DNS 服务器,或 Google 的 8.8.8.8 和 8.8.4.4,您可以将这些添加到 DHCP 池配置中)。在这种情况下,我建议删除ip dns 服务器ppp ipcp dns配置位。

7. 脏东西

要使 NAT 工作,您需要:

  • 一个访问列表,用于定义允许哪些流量进入​​ NAT(通常是您的整个内部子网)
  • “内部”界面
  • “外部”接口
  • 定义事物如何进行 NAT 的 NAT 规则。

该示例将假设您希望将 NAT 重载(也称为“隐藏 NAT”或“IP 伪装”)到 Dialer 接口的当前(公共)IP 地址。

它将使用命名访问列表 - 请注意,ACL 使用通配符掩码,而不是子网掩码(二进制反转)。我认为这是您示例中主要配置错误。

ip access list standard ACLv4_NATOVERLOAD
 permit ip 192.168.10.0 0.0.0.255

interface dialer0
 ip nat outside

interface vlan 10
 ip nat inside

ip nat inside source list ACLv4_NATOVERLOAD interface Dialer0 overload 

8. 其他聪明点

这里和那里有一些聪明的配置位,我会在这里评论它们

interface dialer 0 
 ip mtu 1492

这是运行 PPPoE 时必须具备的,接口 FastEthernet4 上的每个 IP 数据包都会获得一个额外的 8 字节的 PPPoE 标头,因此您要减少接口拨号程序 0 的 MTU。

interface dialer 0
 ip tcp adjust-mss 1452

这也是一个好主意,尽管您拥有的 1400 可能有点过头了。MSS 通常是MTU-40,所以 1452 可能就足够了。

interface FastEthernet4
 no ip proxy-arp

interface dialer 0 
 no ip redirects 
 ip unreachables 
 no ip proxy-arp

interface vlan 10
 ip verify unicast reverse-path 
 ip unreachables 
 no ip proxy-arp

proxy-arp是一个网络黑巫婆,每当我遇到她时,我都会亲自将其烧死。她的魔法只有在黑暗的角落情况下才需要——让它禁用,除非你真的,真的,需要它。

但是,在您的情况下,当涉及到减少的 MTU 链接时ip unreachables是一件幸事。它们确保路由器可以通知主机发送较小的数据包——尤其是对于 UDP 应用程序;TCP 由ip tcp adjust-mss 处理不幸的是,并非所有主机都会尊重或理解这些“数据包太大”消息,但这就是他们的问题。

ip verify unicast reverse-path是一个很好的最佳实践,它通过只允许一个接口上的那些源地址范围(传入)来防止 ip 源地址欺骗,该接口的路由通过同一接口以相反方向退出。这使得您的内部系统更难成为使用欺骗性源地址的机器人大军的一部分。