如何用树莓派做WIFI热点发射端/usb共享网络从而做到主动连接树莓派

参考资料:

1.设置固定IP

2.vnc提示cannot currently show the desktop的解决办法

3.从零开始:树莓派共享 WiFi 秒变无线热点(树莓派路由器

4.树莓派安装 OpenWrt 打造超级路由器

我的usb网段

手机 192.618.186.255
树莓派 192.165.186.30

usb0: flags=4163  mtu 1500
inet 192.168.186.30  netmask 255.255.255.0  broadcast 192.168.186.255
inet6 2408:8466:aa30:213:28ed:8639:45a7:c3d0  prefixlen 64  scopeid 0x0
inet6 fe80::e72c:920a:3992:f2fc  prefixlen 64  scopeid 0x20
ether 42:7d:fe:0f:9f:b0  txqueuelen 1000  (Ethernet)
RX packets 74  bytes 7292 (7.1 KiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 82  bytes 14847 (14.4 KiB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

范例(软件):

interface eth0

static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

interface wlan0

static ip_address=192.168.0.200/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

范例(树莓派文件):

#interface eth0

#static ip_address=192.168.0.10/24

#static ip6_address=fd51:42f8:caae:d92e::ff/64

仿写:

先输入


sudo nano /etc/dhcpcd.conf

interface usb0
static ip_address=192.168.186.30/24          
static ip6_address=2408:8466:aa30:213:28ed:8639:45a7:c3d0/64

成功!!

#[6]