Ubuntu

Linux pppd 失敗但 NetworkManager 工作

  • June 22, 2018

所以我試圖讓我的 PtP 調製解調器“Telit ME910”通過 pppd 使用 Ubuntu 16.04 連接到 Verizon LTE 網路。

如果我連接它並通過“啟用移動寬頻”的標準網路管理器步驟,它會找到預設的 APN 並列出它,所以我可以選擇“Verizon 4G LTE 契約 1”,它連接得很漂亮。它使用 IP 創建了 ppp0 介面,然後我可以成功 PING 8.8.8.8。

如果我連接它並發出“pppd call verizon”,它將創建帶有IP的ppp0介面,但PING失敗?我知道 ModemManager 和 NetworkManager 比 pppd 做得更多,但我無法找出我缺少的東西。任何幫助都將是驚人的。

/etc/ppp/peers/verizon:

/dev/ttyUSB1
115200
connect "/usr/sbin/chat -v -f /etc/ppp/peers/verizon-chat"
noauth
#nodefaultroute

defaultroute
replacedefaultroute
usepeerdns

local
debug
persist

#updetach
nodetach

工作連接的詳細資訊:

# ip route show table all
default dev ppp0  proto static  scope link  metric 700 
169.254.0.0/16 dev ppp0  scope link  metric 1000 
local 100.124.161.186 dev ppp0  table local  proto kernel  scope host  src 100.124.161.186 
broadcast 100.124.161.186 dev ppp0  table local  proto kernel  scope link  src 100.124.161.186 
broadcast 127.0.0.0 dev lo  table local  proto kernel  scope link  src 127.0.0.1 
local 127.0.0.0/8 dev lo  table local  proto kernel  scope host  src 127.0.0.1 
local 127.0.0.1 dev lo  table local  proto kernel  scope host  src 127.0.0.1 
broadcast 127.255.255.255 dev lo  table local  proto kernel  scope link  src 127.0.0.1 
unreachable default dev lo  table unspec  proto kernel  metric 4294967295  error -101 pref medium
local ::1 dev lo  table local  proto none  metric 0  pref medium
ff00::/8 dev eno1  table local  metric 256 linkdown  pref medium
unreachable default dev lo  table unspec  proto kernel  metric 4294967295  error -101 pref medium

ppp0      Link encap:Point-to-Point Protocol  
         inet addr:100.113.251.242  P-t-P:0.0.0.0  Mask:255.255.255.255
         UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
         RX packets:260 errors:0 dropped:0 overruns:0 frame:0
         TX packets:301 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:3 
         RX bytes:82504 (82.5 KB)  TX bytes:62112 (62.1 KB)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     700    0        0 ppp0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 ppp0

此處的系統日誌:workingSyslog

連接失敗的詳細資訊:

# ip route show table all
default dev ppp0  scope link 
10.64.64.64 dev ppp0  proto kernel  scope link  src 100.122.108.86 
local 100.122.108.86 dev ppp0  table local  proto kernel  scope host  src 100.122.108.86 
broadcast 127.0.0.0 dev lo  table local  proto kernel  scope link  src 127.0.0.1 
local 127.0.0.0/8 dev lo  table local  proto kernel  scope host  src 127.0.0.1 
local 127.0.0.1 dev lo  table local  proto kernel  scope host  src 127.0.0.1 
broadcast 127.255.255.255 dev lo  table local  proto kernel  scope link  src 127.0.0.1 
unreachable default dev lo  table unspec  proto kernel  metric 4294967295  error -101 pref medium
local ::1 dev lo  table local  proto none  metric 0  pref medium
ff00::/8 dev eno1  table local  metric 256 linkdown  pref medium
unreachable default dev lo  table unspec  proto kernel  metric 4294967295  error -101 pref medium

ppp0      Link encap:Point-to-Point Protocol  
         inet addr:100.122.108.86  P-t-P:10.64.64.64  Mask:255.255.255.255
         UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
         RX packets:5 errors:0 dropped:0 overruns:0 frame:0
         TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:3 
         RX bytes:38 (38.0 B)  TX bytes:2065 (2.0 KB)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp0
10.64.64.64     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0  

此處的系統日誌:失敗的系統日誌

非常感謝任何提示或建議。我已經手動更改了 ppp0 的路由表和介面設置,因此它們與我在使用 GUI(NetworkManager) 時看到的完全匹配,但它仍然拒絕允許即使是簡單的 PING 8.8.8.8 在 ppp0 上通過。很明顯,標準“ifconfig/route -env/ip route show table all”類型的命令沒有反映導致斷開連接的一些網路細節。

所以經過漫長而艱苦的搜尋,我終於在我的 ppp 選項文件中添加了“+ipv6”,一切都開始工作了。現在弄清楚並理解為什麼需要該選項!

使用 NetworkManager,ppp連接配置不會與常見的網路配置腳本一起儲存。

為了調試ppp連接,我使用nmcli了系統控制台中的命令。

為此,我將從

$ nmcli con show
$ mmcli dev status
$ ip route

在正常工作的網關伺服器上,ppp它看起來像這樣:

$ nmcli con show
NOMBRE  UUID                                  TIPO            DISPOSITIVO 
ppp0    ec723ebc-3675-4d8a-81e8-8989bb275307  pppoe           enp1s0      
enp1s0  c0ab6b8c-0eac-a1b4-1c47-efe4b2d1191f  802-3-ethernet  --          
$ nmcli dev status
DISPOSITIVO  TIPO      ESTADO         CONEXIÓN 
enp1s0       ethernet  conectado      ppp0     
lo           loopback  sin gestión    --       
$ ip route
default via 80.58.67.182 dev ppp0 proto static metric 100 
80.58.67.182 dev ppp0 proto kernel scope link src <net.wor.k.ip> metric 100 

然後執行$ nmcli con show ppp0

它可能會給你這樣的東西:

$ nmcli con show ppp0
connection.id:                          ppp0
connection.uuid:                        ec723ebc-3675-4d8a-81e8-8989bb275307
connection.stable-id:                   --
connection.interface-name:              enp1s0
connection.type:                        pppoe
connection.autoconnect:                 yes
connection.autoconnect-priority:        100
connection.autoconnect-retries:         -1 (predeterminado)
connection.timestamp:                   1529677563
connection.read-only:                   no
connection.permissions:                 --
connection.zone:                        --
connection.master:                      --
connection.slave-type:                  --
connection.autoconnect-slaves:          -1 (predeterminado)
connection.secondaries:                 --
connection.gateway-ping-timeout:        0
connection.metered:                     desconocido
connection.lldp:                        -1 (default)
802-3-ethernet.port:                    --
802-3-ethernet.speed:                   0
802-3-ethernet.duplex:                  --
802-3-ethernet.auto-negotiate:          no
802-3-ethernet.mac-address:             --
802-3-ethernet.cloned-mac-address:      --
802-3-ethernet.generate-mac-address-mask:--
802-3-ethernet.mac-address-blacklist:   --
802-3-ethernet.mtu:                     auto
802-3-ethernet.s390-subchannels:        --
802-3-ethernet.s390-nettype:            --
802-3-ethernet.s390-options:            --
802-3-ethernet.wake-on-lan:             1 (default)
802-3-ethernet.wake-on-lan-password:    --
ipv4.method:                            auto
ipv4.dns:                               --
ipv4.dns-search:                        --
ipv4.dns-options:                       (predeterminado)
ipv4.dns-priority:                      0
ipv4.addresses:                         --
ipv4.gateway:                           --
ipv4.routes:                            --
ipv4.route-metric:                      -1
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-timeout:                      0
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.dhcp-fqdn:                         --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv4.dad-timeout:                       -1 (predeterminado)
ipv6.method:                            auto
ipv6.dns:                               --
ipv6.dns-search:                        --
ipv6.dns-options:                       (predeterminado)
ipv6.dns-priority:                      0
ipv6.addresses:                         --
ipv6.gateway:                           --
ipv6.routes:                            --
ipv6.route-metric:                      -1
ipv6.ignore-auto-routes:                no
ipv6.ignore-auto-dns:                   no
ipv6.never-default:                     no
ipv6.may-fail:                          yes
ipv6.ip6-privacy:                       -1 (desconocido)
ipv6.addr-gen-mode:                     eui64
ipv6.dhcp-send-hostname:                yes
ipv6.dhcp-hostname:                     --
ipv6.token:                             --
ppp.noauth:                             yes
ppp.refuse-eap:                         no
ppp.refuse-pap:                         no
ppp.refuse-chap:                        no
ppp.refuse-mschap:                      no
ppp.refuse-mschapv2:                    no
ppp.nobsdcomp:                          no
ppp.nodeflate:                          yes
ppp.no-vj-comp:                         no
ppp.require-mppe:                       no
ppp.require-mppe-128:                   no
ppp.mppe-stateful:                      no
ppp.crtscts:                            no
ppp.baud:                               0
ppp.mru:                                1492
ppp.mtu:                                1492
ppp.lcp-echo-failure:                   0
ppp.lcp-echo-interval:                  0
pppoe.service:                          --
pppoe.username:                         <provider_login>
pppoe.password:                         <hidden>
pppoe.password-flags:                   0 (none)
proxy.method:                           none
proxy.browser-only:                     no
proxy.pac-url:                          --
proxy.pac-script:                       --
GENERAL.NOMBRE:                         ppp0
GENERAL.UUID:                           ec723ebc-3675-4d8a-81e8-8989bb275307
GENERAL.DISPOSITIVOS:                   enp1s0
GENERAL.ESTADO:                         activada
GENERAL.PREDETERMINADO:                 sí
GENERAL.PREDETERMINADO6:                no
GENERAL.VPN:                            no
GENERAL.ZONA:                           --
GENERAL.RUTA-DBUS:                      /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.CON-RUTA:                       /org/freedesktop/NetworkManager/Settings/5
GENERAL.OBJETO SPEC:                    --
GENERAL.MASTER-RUTA:                    --
IP4.DIRECCIÓN[1]:                       <net.wor.k.ip>/32
IP4.PUERTA DE ENLACE:                   80.58.67.182
IP4.DNS[1]:                             80.58.61.250
IP4.DNS[2]:                             80.58.61.254
IP6.DIRECCIÓN[1]:                       fe80::beae:c5ff:fe34:f062/64
IP6.PUERTA DE ENLACE:                   --

您可能會在以下位置找到配置文件:

# pwd
/etc/NetworkManager/system-connections
# ls -lah
total 8,0K
drwxr-xr-x. 2 root root   17 mar 22 14:26 .
drwxr-xr-x. 7 root root 4,0K feb  7 14:26 ..
-rw-------  1 root root  366 mar 22 14:26 ppp0

# cat ppp0
[connection]
id=ppp0
uuid=ec723ebc-3675-4d8a-81e8-8989bb275307
interface-name=enp1s0
type=pppoe
permissions=
timestamp=1437654424
secondaries=
autoconnect-priority=100
[pppoe]
username=<provider_login>
password=<login_password>    
[ipv6]
method=auto
dns-search=    
[ipv4]
method=auto
dns-search=    
[ethernet]
mac-address-blacklist=    
[ppp]
nodeflate=true
mru=1492
mtu=1492

引用自:https://serverfault.com/questions/916862