AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-18571

parsley72's questions

Martin Hope
parsley72
Asked: 2024-07-22 12:18:55 +0800 CST

如何通过 Wifi 共享 LTE 调制解调器互联网?

  • 6

我已经使用 NetworkManager/ModemManager 设置了我的 LTE 调制解调器,并且运行正常。我还使用 DHCP 在 NetworkManager 中将 Wifi 设置为接入点。

但是我如何通过 Wifi 共享 LTE 调制解调器互联网访问?我已启用 IP 转发 ( echo 1 > /proc/sys/net/ipv4/ip_forward),还有什么?

# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:12946 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12946 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1297231 (1.2 MiB)  TX bytes:1297231 (1.2 MiB)

wlan0     Link encap:Ethernet  HWaddr E8:4F:25:DD:BD:51
          inet addr:10.42.0.1  Bcast:10.42.0.255  Mask:255.255.255.0
          inet6 addr: fe80::ea4f:25ff:fedd:bd51/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:77 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:12101 (11.8 KiB)

wwan0     Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:100.72.254.176  P-t-P:100.72.254.176  Mask:255.255.255.224
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:1808 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2176 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:356293 (347.9 KiB)  TX bytes:261384 (255.2 KiB)

# ip route
default via 100.72.254.177 dev wwan0  metric 700
10.42.0.0/24 dev wlan0 scope link  src 10.42.0.1  metric 600
100.72.254.160/27 dev wwan0 scope link  src 100.72.254.176  metric 700

Wifi 的 DHCP 由 NetworkManager 启动 dnsmasq 使用默认参数完成:

# ps -eF | grep dnsmasq
nobody      1104     606  0  1285  2444   0 09:05 ?        00:00:00 /usr/bin/dnsmasq --conf-file=/dev/null --no-hosts --keep-in-foreground --bind-interfaces --except-interface=lo --clear-on-reload --strict-order --listen-address=10.42.0.1 --dhcp-range=10.42.0.10,10.42.0.254,60m --dhcp-lease-max=50 --dhcp-leasefile=/var/lib/NetworkManager/dnsmasq-wlan0.leases --pid-file=/var/run/nm-dnsmasq-wlan0.pid --conf-dir=/etc/NetworkManager/dnsmasq-shared.d

参考NetworkManager 和 dnsmasq dhcp 地址范围)。

# cat /etc/NetworkManager/system-connections/ap.nmconnection
[connection]
id=ap
uuid=3205b229-8c4d-4766-8d63-bcd949d03321
type=wifi
autoconnect=false
interface-name=wlan0

[wifi]
band=bg
channel=1
mode=ap
ssid=MySSID

[wifi-security]
group=ccmp;
key-mgmt=wpa-psk
pairwise=ccmp;
proto=rsn;
psk=MyPSK

[ipv4]
method=shared

[ipv6]
addr-gen-mode=stable-privacy
method=ignore

[proxy]

一位同事建议使用https://github.com/oblique/create_ap。我尝试了 NAT 和桥接选项,但都失败了。

网络地址转换(NAT):

# create_ap -w 2 wlan0 wwan0 APTest 12345678
WARN: brmfmac driver doesn't work properly with virtual interfaces and
      it can cause kernel panic. For this reason we disallow virtual
      interfaces for your adapter.
      For more info: https://github.com/oblique/create_ap/issues/203
WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt
Config dir: /tmp/create_ap.wlan0.conf.XX59Vdf8
PID: 537195
Network Manager found, set wlan0 as unmanaged device... [46988.754925] ieee80211 phy1: brcmf_set_pmk: failed to change PSK in firmware (len=0)
[46988.784848] ieee80211 phy1: brcmf_vif_set_mgmt_ie: vndr ie set error : -52
[46988.792027] ieee80211 phy1: brcmf_vif_set_mgmt_ie: vndr ie set error : -52
DONE
Sharing Internet using method: nat
iptables v1.8.7 (legacy): unknown option "--to-ports"
Try `iptables -h' or 'iptables --help' for more information.

Doing cleanup.. done

桥:

# create_ap -w 2 -m bridge wlan0 wwan0 APTest 12345678
WARN: brmfmac driver doesn't work properly with virtual interfaces and
      it can cause kernel panic. For this reason we disallow virtual
      interfaces for your adapter.
      For more info: https://github.com/oblique/create_ap/issues/203
WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt
Config dir: /tmp/create_ap.wlan0.conf.XXgGPNON
PID: 540585
Network Manager found, set wlan0 as unmanaged device... DONE
Sharing Internet using method: bridge
Create a bridge interface... ip: RTNETLINK answers: Operation not supported
networkmanager
  • 2 个回答
  • 59 Views
Martin Hope
parsley72
Asked: 2023-06-13 07:29:39 +0800 CST

将 cp 移动到 if 语句时出现语法错误

  • 8

在 bash 中复制时遇到一些问题。这很好用:

# Enable extended globbing and include filenames beginning with a '.'
shopt -s extglob dotglob
# Copy git repo to expected place
cp -r !($YOCTO_DIR) $POKY_DIR/$GIT_REPO_NAME/

但是当我if围绕它发表声明时:

if [ -z "$FROM_JENKINS" ]; then
    # FROM_JENKINS is blank, this is a local build

    # Enable extended globbing and include filenames beginning with a '.'
    shopt -s extglob dotglob
    # Copy git repo to expected place
    cp -r !($YOCTO_DIR) $POKY_DIR/$GIT_REPO_NAME/
fi

我得到:

./build.sh:第 80 行:意外标记 `(' 附近的语法错误

第 80 行是cp. 如果我删除它工作的括号:

cp -r . $POKY_DIR/$GIT_REPO_NAME/

为什么if语句不喜欢中的括号cp?

bash
  • 1 个回答
  • 14 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve