Environment
- Raspberry Pi 4B (8G RAM + 32G SD card)
- Ubuntu Server 22.04 LTS
Steps
Check IP (net-tools need to be installed first)
1 | # If you do not have net-tools installed, use command below to install |
Check Gateway (查看网关)
1 | route -n |
Check DNS
1 | nslookup hcos |
Modify netplan YAML file to set static IP address
1 | sudo vim /etc/netplan/50-cloud.init.yaml |
YAML file under netplan will vary based on your situation which means on my machine it is called 50-cloud.init.yaml does not mean it will have the same name on your machine.
Original netplan yaml file
1 | # This file is generated from information provided by the datasource. Changes |
Updated netplan yaml file
1 | # This file is generated from information provided by the datasource. Changes |
Nameservers addresses
You can use the following 2 free DNS server IP addresses or whatever you like.
8.8.8.8:Google free DNS server IP address
144.144.144.144: China Telecom free DNS server IP address
192.168.31.1: My router IP address
Apply Changes for the new net plan
1 | sudo netplan apply |
Check the updated interface IP address
1 | ip addr show wlan0 |
Check default route
1 | ip route show |
If everything works fine, reboot the system.
1 | sudo reboot |
Error Solution
** (generate:155256): WARNING **: 00:51:57.891: Permissions for /etc/netplan/00-installer-config.yaml are too open. Netplan configuration should NOT be accessible by others.
Change the netplan yaml file privilege.
1 | sudo chmod 600 /etc/netplan/your_config_file.yaml |
WARNING:root: Cannot call Open vSwitch: ovsdb-server.service is not running.
Since netplan apply
says ovsdb-server.service
is not running, then I installed this openvswitch
Also, I am running a Ubuntu server in Raspberry Pi, so I need to install extra libs.
1 | # run this first |
After the installation is complete, no annoying WARNING shows again:
1 | $ sudo netplan try |
Till now it works fine for me.
Reference
- 树莓派如何固定 IP 地址
- 树莓派4B如何手动固定IP地址
- 树莓派安装ubuntu 20.04后配置wifi固定ip地址
- Ubuntu设置静态IP地址的几种方法
- 如何在 Ubuntu 服务器 22.04 上设置静态 IP 地址
- [AX3600] AX3600后台管理登录地址是多少啊???
- Linux系统之ubuntu查看本机dns的两种方法
- Ubuntu 查看IP、网关及DNS
- 常用dns114.114.114.114与8.8.8.8的区别
- netplan generate:
gateway4
has been deprecated, use default routes instead - Need help with a Netplan configuration issue
- ovsdb-server.service from no where
About this Post
This post is written by Andy, licensed under CC BY-NC 4.0.
Next
Bypass Telstra "This Website has been blocked"
Previous