我可以在 Windows 上拨号连接互联网,但不能在 Ubuntu 上拨号连接互联网

我可以在 Windows 上拨号连接互联网,但不能在 Ubuntu 上拨号连接互联网

我有一个带 PON 端口(光纤)和 RJ45 端口的调制解调器。在 Windows 上,我能够拨号连接到互联网,而无需更改调制解调器上的任何默认设置。

在 Ubuntu 22.04 上,我尝试运行 pppoeconf。执行后,普罗格显示以下输出:

    plog
    Jul 26 22:13:27 ram-S1200RP-SE pppd[103311]: local  LL address fe80::80c3:5152:b2ce:92b6
    Jul 26 22:13:27 ram-S1200RP-SE pppd[103311]: remote LL address fe80::f263:f9ff:fe16:d620
    Jul 26 22:13:27 ram-S1200RP-SE pppd[103311]: replacing old default route to eno1 [192.168.1.91]
    Jul 26 22:13:27 ram-S1200RP-SE pppd[103311]: local  IP address 20.0.1.172
    Jul 26 22:13:27 ram-S1200RP-SE pppd[103311]: remote IP address 20.0.0.1
    Jul 26 22:13:27 ram-S1200RP-SE pppd[103311]: primary   DNS address 45.116.2.238
    Jul 26 22:13:27 ram-S1200RP-SE pppd[103311]: secondary DNS address 8.8.8.8

sudo ip -d 地址 ls显示以下内容:

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
        link/ether 00:1e:67:d7:f6:0c brd ff:ff:ff:ff:ff:ff
        altname enp3s0
        inet 192.168.1.68/24 brd 192.168.1.255 scope global eno1
           valid_lft forever preferred_lft forever
        inet6 fe80::21e:67ff:fed7:f60c/64 scope link 
           valid_lft forever preferred_lft forever
    3: enp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
        link/ether 00:1e:67:d7:f6:0d brd ff:ff:ff:ff:ff:ff
        inet6 fe80::21e:67ff:fed7:f60d/64 scope link 
           valid_lft forever preferred_lft forever
    29: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc fq_codel state UNKNOWN group default qlen 3
        link/ppp 
        inet 20.0.1.172 peer 20.0.0.1/32 scope global ppp0
           valid_lft forever preferred_lft forever
        inet6 fe80::80c3:5152:b2ce:92b6 peer fe80::f263:f9ff:fe16:d620/128 scope link 
           valid_lft forever preferred_lft forever

/etc/网络/接口文件被 pppoeconf 修改为:

    # interfaces(5) file used by ifup(8) and ifdown(8)
    # Include files from /etc/network/interfaces.d:
    source /etc/network/interfaces.d/*

    iface dsl-provider inet ppp
    pre-up /bin/ip link set eno1 up # line maintained by pppoeconf
    provider dsl-provider

    auto eno1
    iface eno1 inet manual

我使用 /etc/systemd/network 文件夹来配置我的网络。我在其中创建的 20-static.network 文件是:

       [Match]
       MACAddress=00:1e:67:d7:f6:0c

       [Network]
       Address=192.168.1.68/24
       DNS=8.8.8.8
       DNS=8.8.4.4

我无法 ping 到 8.8.8.8 或任何其他外部 IP。如果我将网关地址条目替换为 ISP 为我提供的一些静态 IP 地址的另一个 IP 地址,那么我可以 ping 到任何地址。是的,调制解调器的 IP 地址(默认)设置为 192.168.1.1。

让它工作起来真是令人沮丧。任何帮助都将不胜感激。

根据答案和评论进行编辑:

根据评论,我删除了 en01 的网关条目。

路线命令现在显示:

 Destination  Gateway  Genmask         Flags Metric Ref Use Iface
 default      0.0.0.0  0.0.0.0         U     0      0     0 ppp0
 20.0.0.1     0.0.0.0  255.255.255.255 UH    0      0     0 ppp0
 192.168.1.0  0.0.0.0  255.255.255.0   U     0      0     0 eno1

我尝试通过首先设置 eno1 以通过交换机连接到正确路由的路由器来 ping 并检查 tcpdump。

  ping 8.8.8.8 -i 5 -c 2
  sudo tcpdump -ni eno1 #In another window
  12:18:16.008892 IP 192.168.1.68 > 8.8.8.8: ICMP echo request, id 6, seq 1, length 64
  12:18:16.024989 IP 8.8.8.8 > 192.168.1.68: ICMP echo reply, id 6, seq 1, length 64
  12:18:21.014143 IP 192.168.1.68 > 8.8.8.8: ICMP echo request, id 6, seq 2, length 64
  12:18:21.030392 IP 8.8.8.8 > 192.168.1.68: ICMP echo reply, id 6, seq 2, length 64
 

然后我将电缆从 eno1 切换回调制解调器,这是我 ping 8.8.8.8 时 tcpdump 的输出

  ping 8.8.8.8 -i 5 -c 2
  sudo tcpdump -ni ppp0 #In another window
  12:30:51.504465 IP 20.0.2.75 > 8.8.8.8: ICMP echo request, id 9, seq 1, length 64
  12:30:56.757509 IP 20.0.2.75 > 8.8.8.8: ICMP echo request, id 9, seq 2, length 64

我没有收到 ICMP 回复。

根据以下情况,调制解调器连接似乎正常:

   tail -200 /var/log/syslog|grep pppd
   Jul 27 12:28:03 ram-S1200RP-SE pppd[5452]: Connect: ppp0 <--> eno1
   Jul 27 12:28:06 ram-S1200RP-SE pppd[5452]: Remote message: Authentication success,Welcome!
   Jul 27 12:28:06 ram-S1200RP-SE pppd[5452]: PAP authentication succeeded
   Jul 27 12:28:06 ram-S1200RP-SE pppd[5452]: peer from calling number F0:63:F9:16:D6:20 authorized
   Jul 27 12:28:06 ram-S1200RP-SE pppd[5452]: local  LL address fe80::1c37:674c:4463:8995
   Jul 27 12:28:06 ram-S1200RP-SE pppd[5452]: remote LL address fe80::f263:f9ff:fe16:d620
   Jul 27 12:28:06 ram-S1200RP-SE pppd[5452]: local  IP address 20.0.2.75
   Jul 27 12:28:06 ram-S1200RP-SE pppd[5452]: remote IP address 20.0.0.1
   Jul 27 12:28:06 ram-S1200RP-SE pppd[5452]: primary   DNS address 45.116.2.238
   Jul 27 12:28:06 ram-S1200RP-SE pppd[5452]: secondary DNS address 8.8.8.8

有什么指点吗?

答案1

使用 PPPoE 时,调制解调器不是您的网关,您不应将其配置为网关。调制解调器,即使是路由器,本身也没有任何互联网连接,因此它无法对您的数据包进行任何处理。

换句话说,您应该拥有的唯一默认路由是通过 ppp0 隧道接口的路由 - 而不是直接通过以太网的路由。

相关内容