0

我想eth0用于本地网络,我的华为 4G U 盘用于互联网连接enx001e101f0000

我的设置:

  • 带有 Ubuntu Server 21.10 的树莓派 3
  • RPI 中的以太网电缆,连接到我的本地网络
  • 华为 E3372 4G U 盘,带工作卡

这是lsusb

Bus 001 Device 008: ID 12d1:14db Huawei Technologies Co., Ltd. E353/E3131
Bus 001 Device 004: ID 046d:c077 Logitech, Inc. M105 Optical Mouse
Bus 001 Device 005: ID 046d:c31c Logitech, Inc. Keyboard K120
Bus 001 Device 006: ID 0424:7800 Microchip Technology, Inc. (formerly SMSC) 
Bus 001 Device 003: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

这是我的ip a

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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b8:27:eb:59:f9:cc brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.52/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2a02:a03f:c711:bc00:ba27:ebff:fe59:f9cc/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 86375sec preferred_lft 71975sec
    inet6 fe80::ba27:ebff:fe59:f9cc/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether b8:27:eb:0c:ac:99 brd ff:ff:ff:ff:ff:ff
4: enx001e101f0000: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:1e:10:1f:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.8.115/24 brd 192.168.8.255 scope global dynamic enx001e101f0000
       valid_lft 85819sec preferred_lft 85819sec
    inet6 fe80::21e:10ff:fe1f:0/64 scope link 
       valid_lft forever preferred_lft forever

这是我的/etc/netplan/50-cloud-init.yaml

network:
    ethernets:
        eth0:
          dhcp4: no
          addresses:
            - 192.168.1.52/24
          gateway4: 192.168.1.1
          nameservers:
            addresses: [8.8.8.8, 1.1.1.1]
        enx001e101f0000:
            dhcp4: true
            #optional: true
    version: 2

如何将 Netplan 配置为

  • 用于eth0本地网络连接(例如 SSH)
  • 仅用于enx001e101f0000互联网连接?
4

0 回答 0