树莓派ubuntu18.04配置wifi

用的是server版本,所以要用过ssh来配置。

从此认识了yaml这个语言,有史以来用过最烂的语言,没有之一。

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            dhcp4: true
            optional: true
    wifis:
        wlan0:
         dhcp4: false
         addresses: [192.168.1.101/24]
         gateway4: 192.168.1.1
         nameservers:
           addresses: [192.168.1.1]
         optional: true
         access-points:
             "xxxxx":
                 password: "xxxxx"
    version: 2

wifi的配置文件为/etc/netplan/50-cloud-init.yaml

这种语言严格缩进,而且是空格缩进,而且这个配置里面需要有上下父子关系,更奇葩的是,冒号后代表列表内容,必须有个空格!!!

改这个脚本用了快半个小时!!!

网上的资料看着多,欣喜若狂的用,个个有坑,个个格式一动就洗白,所以最后用的官方参考。

https://netplan.io/reference

可以搜到wifi段落,参考着来。


本来想偷懒写个转载,结果非得逼得写个原创。。

再更:

以上还是不好使,这个比上个强点:

https://blog.csdn.net/jorondo/article/details/104534781?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2

按步来就行。

你可能感兴趣的:(树莓派)