Fedora 38 linux 如何设置网络热点供手机使用

使用ifconfig找到 wifi 所使用的网卡

[user@fedora ~]$ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 23  bytes 2470 (2.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 23  bytes 2470 (2.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp0s2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.37.12  netmask 255.255.255.0  broadcast 192.168.50.255
        inet6 fe80::6ff7:906d:fda0:4927  prefixlen 64  scopeid 0x20<link>
        ether 9d:f8:c5:9b:7g:93  txqueuelen 1000  (Ethernet)
        RX packets 8017  bytes 6551364 (6.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4765  bytes 1154563 (1.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wwp0s20f0u4i1: flags=4291<UP,BROADCAST,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 10.29.2.38  netmask 255.255.255.248  broadcast 10.28.2.39
        ether 90:8f:95:9b:ef:c1  txqueuelen 1000  (Ethernet)
        RX packets 521  bytes 380836 (371.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 592  bytes 56511 (55.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

使用 nmcli 对 wifi 网卡设置热点

[user@fedora ~]$  nmcli device wifi hotspot ifname wlp0s2 ssid myfedora-hotspot password abc123456

Device 'wlp0s2' successfully activated with '40f1fd66-b866-45a5-8c7d-65a49f8386df'.
Hint: "nmcli dev wifi show-password" shows the Wi-Fi name and password.

使用nmcli查看热点密码

[user@fedora ~]$ nmcli device wifi show-password
SSID: myfedora-hotspot
Security: WPA
Password: abc123456

  █████████████████████████████████
  ██ ▄▄▄▄▄ █▀ █▀▀█▄▀▀▄ ▄ █ ▄▄▄▄▄ ██
  ██ █   █ █▀ ▄ █▀▄▀█▀▄▀▄█ █   █ ██
  ██ █▄▄▄█ █▀█ █▄▀▄▀▄ ▄▄▀█ █▄▄▄█ ██
  ██▄▄▄▄▄▄▄█▄█▄█ █▄█▄█▄█▄█▄▄▄▄▄▄▄██
  ██    ▄█▄ ▄ ▄█▄▄▀▄▀▄█▀▀▄▀▄▀▄▀ ███
  ██▀ ▀▄ ▀▄▄█ ▀ ▄▄▀ ▄█▀▀█  ▄▀▄█▀▀██
  ██ ▀▀▄▀ ▄▄▄ ▀▄▀▄▀▄▀▄█▀ ▀▀  ▄ ▀███
  ██▀▀▀██▀▄▀▄▀▄█▀█▄▄█▄▄▀ █▄▄█▀▄████
  ██▀██▄█▄▄▄▀  █▄▄▀▄█▄█ ▀█▀▄▀ █ ▄██
  ██ ██ ▀▄▄▀██▀ ▄█ ▄██ █▀▄▄▄ ███▀██
  ██▄█▄█▄▄▄▄ ▀ ▄ ▄▀█▄ ▀█ ▄▄▄ ▄ ████
  ██ ▄▄▄▄▄ █▄▀█▀▀▄▄ █▄█  █▄█ ▀▄████
  ██ █   █ █ ▄█ ▀▄█  ▄█▀▄▄▄▄  █▀ ██
  ██ █▄▄▄█ █ ▀█▀▀▄█▄▄█▀▄▀▄▄▄  ▄ ███
  ██▄▄▄▄▄▄▄█▄▄█▄█▄██▄▄▄▄█▄▄█▄▄█████
  █████████████████████████████████


[user@fedora ~]$ 

关闭热点

[user@fedora ~]$ nmcli device disconnect wlp0s2
Device 'wlp0s2' successfully disconnected.

参考 internet-connection-sharing-networkmanager

你可能感兴趣的:(Fedora专栏,网络,linux)