Setting a static IP address on Ubuntu 20.10 is not working.
Hi,
I'm trying to set a static IP address on my wifi adapter using netplan on Ubuntu 20.10.
I set up the YAML file correctly in /etc/netplan and apply it but it's not working.
My 01-network-manager-all.yaml file:
network:
version: 2
renderer: NetworkManager
wifis:
wlp1s0:
dhcp4: no
addresses: [192.168.1.25/24]
gateway4: 192.168.1.1
nameservers:
addresses: [192.168.1.1]
access-points:
"My_Access_Point":
password: "my_password"
I apply "sudo netplan apply" and it applies with no formatting errors highlighted. But I my ip address does not change.
Any ideas?
Comments
-
Hello Warren,
Could you provide more details ? Are you trying to do this on a VM or a physical machine ?
I'm far from being an expert but YAML is very sensible to indentation and we can't see from your code if your .yaml file is properly indented (maybe use a 'format' button to format the part of your post as a code?)
Here's a working piece of code that sets static IP address on my raspberry PI
network: version: 2 ethernets: eth0: dhcp4: true optional: true wifis: wlan0: access-points: APName: password: Password addresses: - 192.168.1.40/24 dhcp4: false gateway4: 192.168.1.254 nameservers: addresses: [8.8.8.8,1.1.1.1] optional: trueTBH I don't know if there is any difference between two address declaration syntaxes (in your .yaml and mine)
Also, instead of
netplan applyyou can usenetplan trycommand which will revert to original settings after 120 seconds and prevent you from locking yourself out (in case something is miss-configured) if you're working on a remote host...0 -
Hey thanks for your reply.
It's a physical laptop running Ubuntu. The formatting is correct because when I formatted it wrongly it brought up errors when I tried to run 'netplan apply'. I corrected them all and it ran.
What Raspberry pi software are you using because I am using the latest Raspbian and I cannot find netplan?
Also, what is the difference between 'networkd' and 'NetworkManager' when it comes to the renderer?
Regards.
0 -
I have another system with Lubuntu 20.04 running. I am going to give it another go on that and report back.
0 -
Hello,
I'm running Ubuntu server 20.04 on rpi
netplan is Ubuntu frontend for creating network configuration files at boot time (either for systemd-networkd or NetworkManager, depending on which one you're using) so I guess it's normal that you can't find it on Raspbian...
You can check if interfaces are managed with systemd-networkd with
networkctlcommand and for NetworkManager you can usenmclicommandI'm not sure but think that networkd is ubuntu default, so maybe changing renderer to networkd will solve your issue...
0 -
OK I got something working.
On this page:
It mentions using networkd for renderer when using wifi. This guy could not get static ip to stick to his wifi interface using NetworkManager. So I inserted networkd as renderer for my wifi card and it works. I have a static ip address. Unfortunately when I click my GUI it shows I am disconnected from the network, even though the internet is working. That is obviously due to networkd as renderer.
It's a bit of a messy workaround but it works.
0 -
Hm, in my opinion the renderer option depends on what is managing your interface (NetworkManager or systemd-networkd)
For the sake of experiment maybe you can install NetworkManager and disable systemd-networkd temporarily, switch back to renderer: NetworkManager and see what happens.
Yes, systemd-networkd doesn't have GUI, so switching back to NetworkManager is more 'practical' for desktop/laptop use maybe
0 -
Hi, perhaps you can take a look to the official documentation:
Regards,
Luis.0 -
Using NetworkManager is preferred, since all major distros support NetworkManager. You can use netplan to generate the configuration for NetworkManager if you wish. Building a yaml file vs using one of 3 user interfaces that NetworkManager provides is personal choice. Have fun experimenting.
1
Categories
- All Categories
- 175 LFX Mentorship
- 175 LFX Mentorship: Linux Kernel
- 744 Linux Foundation IT Professional Programs
- 372 Cloud Engineer IT Professional Program
- 168 Advanced Cloud Engineer IT Professional Program
- 72 DevOps IT Professional Program - Discontinued
- 3 DevOps & GitOps IT Professional Program
- 98 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- AI & ML Training
- Blockchain & Decentralized Identity Training
- Cloud & Containers Training
- Cybersecurity Training
- DevOps & Site-Reliability Training
- Linux Kernel Development Training
- Networking Training
- Open Source Best Practice Training
- System Administration Training
- System Engineering Training
- Web & Application Development Training
- 55 LFD102 Class Forum
- 261 LFD103 Class Forum
- 2 LFD103-JP クラス フォーラム
- 2 LFD114 Class Forum
- 56 LFD121 Class Forum
- 4 LFD123 Class Forum
- 3 LFD125 Class Forum
- 5 LFD137 Class Forum
- 2 LFD140 Class Forum
- 4 LFD210-CN Class Forum
- 2 LFD221 Class Forum
- 26 LFD254 Class Forum
- 764 LFD259 Class Forum
- 679 LFS101 Class Forum
- 3 LFS114 Class Forum
- 6 LFS118 Class Forum
- 3 LFS120 Class Forum
- 2 LFS140 Class Forum
- 30 LFS148 Class Forum
- 2 LFS158-JP クラス フォーラム
- 4 LFS180 Class Forum
- 3 LFS184 Class Forum
- 162 LFS207 Class Forum
- 3 LFS207-DE-Klassenforum
- 4 LFS207-JP クラス フォーラム
- 61 LFS241 Class Forum
- 52 LFS242 Class Forum
- 42 LFS243 Class Forum
- 19 LFS244 Class Forum
- 9 LFS245 Class Forum
- 3 LFS246 Class Forum
- 2 LFS248 Class Forum
- 179 LFS250 Class Forum
- 4 LFS250-JP クラス フォーラム
- 166 LFS253 Class Forum
- 5 LFS255 Class Forum
- 19 LFS256 Class Forum
- 3 LFS257 Class Forum
- 1.4K LFS258 Class Forum
- 13 LFS258-JP クラス フォーラム
- 165 LFS261 Class Forum
- 26 LFS267 Class Forum
- 28 LFS268 Class Forum
- 792 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 87 Storage
- 768 Linux Distributions
- 81 Debian
- 67 Fedora
- 22 Linux Mint
- 13 Mageia
- 24 openSUSE
- 150 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 465 Linux System Administration
- 31 Cloud Computing
- 73 Command Line/Scripting
- Github systems admin projects
- 98 Linux Security
- 78 Network Management
- 101 System Management
- 46 Web Management
- 105 Mobile Computing
- 18 Android
- 72 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 392 Off Topic
- 121 Introductions
- 181 Small Talk
- 29 Study Material
- 931 Programming and Development
- 310 Kernel Development
- 603 Software Development
- 970 Software
- 362 Applications
- 182 Command Line
- 5 Compiling/Installing
- 68 Games
- 317 Installation
- Archived
- 75 All In Program
- 75 All In Forum
- 25 LFC110 Class Forum - Discontinued
- 2 LFS112 Class Forum - Discontinued
- 22 LFS151 Class Forum - Discontinued
- 1 LFS166 Class Forum - Discontinued
- 9 LFS167 Class Forum - Discontinued
- 4 LFS170 Class Forum - Discontinued
- 1 LFS171 Class Forum - Discontinued
- 3 LFS178 Class Forum - Discontinued
- 736 LFS201 Class Forum - Discontinued
- 2 LFS201-JP クラス フォーラム - Discontinued
- 301 LFS211 Class Forum - Discontinued
- 55 LFS216 Class Forum - Discontinued
- 2 LFS251 Class Forum - Discontinued
- 1 LFS254 Class Forum - Discontinued
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 2 LFS272-JP クラス フォーラム - Discontinued
- 202 LFS272 Class Forum - Discontinued
- 1 LFS274 Class Forum - Discontinued
- 4 LFS281 Class Forum - Discontinued
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)

