Normally when a Linux distribution is installed, a dynamic IP is assigned to IPv4, for security reasons. The detail is when that OS is used with App Server, BD, etc. Here enters the issue of Assigning a static IP and with internet access for issues of ambientation of applications.
Now we have to configure our Ubuntu Server Version 18 | 20 | 22, to assign it a static IP with Internet access:
1.- In the Terminal, wroted:
- ip a
2.- enter in the folde /netplan:
- cd /etc/netplan/
- ls -l
- cp xxx-init.yaml xxx-init.yaml.bck
- ls -l
3.- remove xxx-init.yaml; and create file static.yaml.
- copy config of https://github.com/firecode16/ubuntu_server_staticIP/blob/master/static.yaml and paste in the file static.yaml
4.- apply changes:
5.- restart now OS:
- reboot now
6.- check new IP static:
- ip a:
7.- ping internet access:
- ready, :)