Ubuntu Server 22.04 set a static ip address
HTML-код
- Опубликовано: 2 окт 2024
- Knowing how to set a static IP address on an Ubuntu Server is an important piece of knowledge. We are looking at one way to do that in this video.
Until I get a repository setup for the channel, you can find a very similar file to the one shown in this video here:
gist.githubuse...
Join this channel to get access to perks:
/ @practical-it
Channel Logo by: capturetheconc...
Join the discussion on Matrix
matrix.to/#/!h...
Check out my blog: jeremyleik.com...
Support the Channel
Buy Me a Coffee: www.buymeacoff...
Become a Patron: / practicalitjleik
The affiliate links below don't change your price, but they do kick a little bit back to help support the channel.
Vultr: www.vultr.com/...
Digital Ocean: m.do.co/c/f0d1...
Clear, concise, and to the point. Well done!
Thanks! That's what I was going for. Hopefully this one performs well.
Good to see you again buddy
The video I’ve looking for. I’m sure there is a reason why it is this difficult to do something so simple. But it I do wonder why. Thanks for the video.
I like that you are creating a backup file. I always forget to backup my config files.
When I don't create a backup, it always ends up biting me in the hind end!
If you don't want to reboot, run "sudo netplan apply". Nice that your example uses the routes block instead of a gateway4 key/value that the installer uses and netplan reports as deprecated. I don't think it matters, but might have mentioned any changes in 22.04 LTS vs. 24.04 LTS, and maybe when netplan became standard.
I've done the same process in 22.04 and 24.04 with this config file. Works in both.
In a future video I will run through the same process in 24.04 and give a little more info on netplan. Seems it's here to stay.
I’ve never had a reason to mess with net plan since it seems too complicated lol. Sort of went the easier way by using dhcp reservations or cloud init. But I am going to try this out for the sake of knowing. Thanks for this tutorial.
I'm mostly doing DHCP reservations these days. It's just hard to demonstrate that with all the different routers and firewalls on the market.
Cool, Do we also need to change gateway4? all the config got overwritten with new ip but some reason i cannot ssh into the server
I'm afraid gateway4 is deprecated and has been replaced by the routes section of the netplan file shown in the video.
You can check to see if you have references to gateway4 by running the following command:
grep -r gateway4 /etc
Stack Exchange Article: unix.stackexchange.com/questions/731534/netplan-apply-warns-gateway4-has-been-deprecated-but-yaml-has-no-gateway4-line
AskUbuntu Article: askubuntu.com/questions/1410750/netplan-gateway-has-been-deprecated
At 2:13 in the video, I show the full file and gateway4 does not exist. I was able to ssh into the server after changing this. If you have made changes to your ssh configuration files before running the netplan file shown in the video, you may need to revisit that config to get everything back up and running.
I hope this helps.
Great video!
Thanks