如何在 18.04 上为 WWAN 建立 IP 连接

如何在 18.04 上为 WWAN 建立 IP 连接

如何建立与 Sierra Wireless MC7354 的 WWAN 的 IP 连接?

我有一个系统Sierra Wireless MC7354 调制解调器运行 Ubuntu 18.04。

ModemManager 可以查看和控制调制解调器。

$ mmcli --modem 0

返回大量有用信息。(这就是我知道调制解调器是 MC7354 的原因。)

/org/freedesktop/ModemManager1/Modem/0 (device id '232972a04adf83122a392fd83b274431de596ebd')
  -------------------------
  Hardware |   manufacturer: 'Sierra Wireless, Incorporated'
           |          model: 'MC7354'
           |       

端口列表显示了几个端口:

ports: 'ttyUSB0 (qcdm), wwp0s20u5i8 (net), wwp0s20u5i10 (net), cdc-wdm0 (qmi), cdc-wdm1 (qmi), ttyUSB2 (at)'

$ mmcli --modem 0 --simple-connect="apn=internet"

成功

$ mmcli --bearer 0
Bearer '/org/freedesktop/ModemManager1/Bearer/0'
  -------------------------
  Status             |   connected: 'yes'
                     |   suspended: 'no'
                     |   interface: 'wwp0s20u5i8'
                     |  IP timeout: '20'
  -------------------------
  Properties         |         apn: 'internet'
                     |     roaming: 'allowed'
                     |     IP type: 'none'
                     |        user: 'none'
                     |    password: 'none'
                     |      number: 'none'
                     | Rm protocol: 'unknown'
  -------------------------
  IPv4 configuration |   method: 'static'
                     |  address: '100.232.81.142'
                     |   prefix: '30'
                     |  gateway: '100.232.81.141'
                     |      DNS: '10.177.0.34', '10.177.0.210'
                     |      MTU: '1430'
  -------------------------
  IPv6 configuration |   method: 'unknown'
  -------------------------
  Stats              |          Duration: '839'
                     |    Bytes received: 'N/A'
                     | Bytes transmitted: 'N/A'

显示调制解调器已连接到互联网(?)。

如何在 Ubuntu 上建立连接以使用该界面?

$ ifconfig -a 

wwp0s20u5i8: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 0e:ff:cc:40:45:be  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wwp0s20u5i10: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 12:4e:ee:54:3e:3e  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

如何与该设备建立 IP 连接?

谢谢您的帮助!

答案1

我想你还是想知道。

如何建立与 Sierra Wireless MC7354 的 WWAN 的 IP 连接?

你已经这样做了:

$ mmcli --bearer 0

Bearer '/org/freedesktop/ModemManager1/Bearer/0'
  -------------------------
  Status             |   connected: 'yes'

因此基本上剩下的就是使用给定的 IP 和网络掩码设置来设置适当的 WWAN 接口。但是,您还必须将要通过接口传输的流量路由到定义的网关。

你也许应该读一下第 43 页左右的整个部分服务器指南 请注意,如果您使用 netplan,它会产生影响,例如,它将忽略您为网络管理器手动添加的连接。

  IPv4 configuration 
                 |   method: 'static'
                 |  address: '100.232.81.142'
                 |   prefix: '30'
                 |  gateway: '100.232.81.141'
                 |      DNS: '10.177.0.34', '10.177.0.210'
                 |      MTU: '1430'

说是静态的并不重要,只意味着只要承载者保持连接,您就会拥有该 IP。除非您为静态 IP 付费,否则当您重新连接承载者时,ISP 很可能会为您提供一个新的 IP。

您收到的设置很可能基于您连接的 APN。

依赖于 ISP,他们也可以强制使用他们的 DNS。

因此,我的问题是,当您至少有一个易于使用的网络管理器可以处理这个问题时,为什么还要手动执行此操作呢?

    $ apt show network-manager
Package: network-manager
Version: 1.10.6-2ubuntu1.1
Priority: optional
Section: net
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Utopia Maintenance Team <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 5 927 kB
Depends: libaudit1 (>= 1:2.2.1), libbluetooth3 (>= 4.91), libc6 (>= 2.25), libcurl3-gnutls (>= 7.16.3), libglib2.0-0 (>= 2.43.2), libgnutls30 (>= 3.5.0), libjansson4 (>= 2.0.1), libmm-glib0 (>= 1.0.0), libndp0 (>= 1.2), libnewt0.52, libnl-3-200 (>= 3.2.21), libnm0 (>= 1.10.2), libpolkit-agent-1-0 (>= 0.99), libpolkit-gobject-1-0 (>= 0.104), libpsl5 (>= 0.13.0), libreadline7 (>= 6.0), libselinux1 (>= 1.32), libsystemd0 (>= 221), libteamdctl0 (>= 1.9), libudev1 (>= 183), libuuid1 (>= 2.16), lsb-base (>= 3.2-14), wpasupplicant (>= 0.7.3-1), dbus (>= 1.1.2), udev, adduser, isc-dhcp-client (>= 4.1.1-P1-4), libpam-systemd, policykit-1
Recommends: ppp, dnsmasq-base, iptables, modemmanager, network-manager-pptp, crda, iputils-arping
Suggests: avahi-autoipd, libteam-utils
Breaks: ppp (>= 2.4.7-3~), ppp (<< 2.4.7-2+~)
Homepage: https://wiki.gnome.org/Projects/NetworkManager
Task: ubuntu-desktop, kubuntu-desktop, kubuntu-full, xubuntu-core, xubuntu-desktop, lubuntu-gtk-desktop, lubuntu-desktop, lubuntu-qt-desktop, ubuntustudio-desktop-core, ubuntustudio-desktop, ubuntukylin-desktop, ubuntu-mate-core, ubuntu-mate-desktop, ubuntu-budgie-desktop
Supported: 5y
Download-Size: 1 500 kB
APT-Manual-Installed: yes
APT-Sources: http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
Description: network management framework (daemon and userspace tools)
 NetworkManager is a system network service that manages your network devices
 and connections, attempting to keep active network connectivity when
 available. It manages ethernet, WiFi, mobile broadband (WWAN), and PPPoE
 devices, and provides VPN integration with a variety of different VPN
 services.
 .
 This package provides the userspace daemons and a command line interface to
 interact with NetworkManager.
 .
 Optional dependencies:
  * avahi-autoipd: Used for IPv4LL, a protocol for automatic Link-Local IP
    address configuration.
  * ppp: Required for establishing dial-up connections (e.g. via GSM).
  * dnsmasq-base/iptables: Required for creating Ad-hoc connections and
    connection sharing.
  * libteam-utils: Network Team driver allows multiple network interfaces to be
    teamed together and act like a single one. This process is called "ethernet
    bonding", "channel teaming" or "link aggregation".

如果您阅读上面的内容,您会发现没有任何地方需要桌面,实际上情况恰恰相反,桌面会将其拉进来以执行网络部分。

所以我的建议仍然是相同的,安装网络管理器。

如果您已经使用任何其他网络管理器(如 networkd),则只需将网络管理器配置为仅配置 wwan。

可以通过编辑来完成/etc/NetworkManager/conf.d/10-globally-managed-devices.conf

unmanaged-devices=*,except:type:wwan,except:type:gsm

要建立连接,您可以使用nmcli或手动创建配置:

sudo vim /etc/NetworkManager/system-connections/myisp

[connection]
id=myisp
uuid=755d5082-e2e3-4691-873a-0669b27aaaa2
type=gsm
interface-name=cdc-wdm0
permissions=
timestamp=1547308598

[gsm]
apn=internet.public
number=*99#

[ipv4]
dns=8.8.8.8;8.8.4.4;1.1.1.1;
dns-search=
ignore-auto-dns=true
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto

希望这将引导您走向正确的方向,祝一切顺利:)

相关内容