a YAML<\/strong> file with the following command:<\/p>\n\n\n\ntouch \/etc\/netplan\/01-network-configuration.yaml<\/pre>\n\n\n\nOnce created, open it with your favorite editor and paste the following lines of code:<\/p>\n\n\n\n
network:\n version: 2\n renderer: NetworkManager\n ethernets:\n eth0:\n addresses:\n - 192.168.1.21\/24\n nameservers:\n addresses: [8.8.8.8, 8.8.4.4]\n routes:\n - to: default\n via: 192.168.1.1\n<\/pre>\n\n\n\nNow, we will explain all lines in this configuration file:<\/p>\n\n\n\n
eth0<\/strong> is the network interface name.<\/p>\n\n\n\naddresses<\/strong> The static IPv4 address, in this case, the static IP address, is set to 192.168.1.21<\/strong><\/p>\n\n\n\nnameservers:<\/strong> We need to set the nameservers; in this case, these nameservers belong to Google.<\/p>\n\n\n\nroutes:<\/strong> The routes are used for the gateway of the system.<\/p>\n\n\n\nNow, to apply the changes in the configuration file, execute the following command:<\/p>\n\n\n\n
netplan apply<\/pre>\n\n\n\nTo confirm if your static IP address has been added successfully, execute the following command:<\/p>\n\n\n\n
ip a<\/pre>\n\n\n\nThe output should look like this:<\/p>\n\n\n\n
root@host:~# ip a\n1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000\n link\/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n inet 127.0.0.1\/8 scope host lo\n valid_lft forever preferred_lft forever\n inet6 ::1\/128 scope host\n valid_lft forever preferred_lft forever\n2: eth0: mtu 1500 qdisc fq_codel state UP group default qlen 1000\n link\/ether 00:16:3e:79:35:ec brd ff:ff:ff:ff:ff:ff\n altname enp0s3\n altname ens3\n inet 192.168.1.21<\/strong>\/21 brd 162.246.255.255 scope global eth0\n valid_lft forever preferred_lft forever\n inet6 fe80::216:3eff:fe79:35ec\/64 scope link\n valid_lft forever preferred_lft forever\n<\/pre>\n\n\n\nThat’s it. You successfully installed Netplan and configured a static IP address on Ubuntu 22.04.<\/p>\n\n\n\n
Of course, if this setup is difficult for you, please contact our technical support. We are available 24\/7 and will help you with any aspect of IP address configurations. All you need to do is to sign up for one of our managed hosting plans<\/a> and submit a support ticket.<\/p>\n\n\n\nIf you liked this post on how to configure a static IP address on Ubuntu 22.04, please share it with your friends on social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"
An IP address identifies every device on the internet, and the purpose of the IP address is to handle connections … <\/p>\n
Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":46221,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,1698],"tags":[2093,59],"yoast_head":"\nHow to Configure Static IP Address on Ubuntu 22.04 - RoseHosting<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n\t \n\t \n\t \n