<\/figure>\r\n\r\n\r\n\r\nTo proceed with configuring a static IP address on Ubuntu server 20.04, we have to make sure that cloud-init does not manage the network interface. To do it, let’s open cloud-init file at \/etc\/cloud\/cloud.cfg.d\/subiquity-disable-cloudinit-networking.cfg and make sure that \u201cnetwork: {config: disabled}\u201d entry is there. If the entry is missing, we have to create it.<\/p>\r\n\r\n\r\n\r\n
master@ubuntu20:~$ sudo cat \/etc\/cloud\/cloud.cfg.d\/subiquity-disable-cloudinit-networking.cfg\r\nnetwork: {config: disabled}<\/pre>\r\n\r\n\r\n\r\nNow, to configure a static IP address, we need to modify the YAML configuration file at \/etc\/netplan\/00-installer-config.yaml. Please note, when editing a YAML file, make sure you follow the YAML code indentation standards. The suggested syntax for YAML files is to use 2 spaces for indentation, do not use TABS. If the indentation and syntax are incorrect, the changes will not work.<\/p>\r\n\r\n\r\n\r\n <\/figure>\r\n\r\n\r\n\r\n$ sudo cat \/etc\/netplan\/00-installer-config.yaml<\/pre>\r\n\r\n\r\n\r\n# This is the network config written by 'subiquity'\r\nnetwork:\r\n ethernets:\r\n ens33:\r\n dhcp4: true\r\n version: 2<\/pre>\r\n\r\n\r\n\r\nAs seen in the file, DHCP is available and the server is getting the IP address from the DHCP server. To change your server IP address, for example to 192.168.1.100, let’s back up the file \/etc\/netplan\/00-installer-config.yaml<\/p>\r\n\r\n\r\n\r\n
$ sudo cp -a \/etc\/netplan\/00-installer-config.yaml{,.orig}<\/pre>\r\n\r\n\r\n\r\nand open the file<\/p>\r\n\r\n\r\n\r\n
$ sudo nano \/etc\/netplan\/00-installer-config.yaml<\/pre>\r\n\r\n\r\n\r\nto replace the content of \/etc\/netplan\/00-installer-config.yaml above with these lines.<\/p>\r\n\r\n\r\n\r\n
network:\r\n ethernets:\r\n ens33:\r\n addresses: [192.168.1.100\/24]\r\n gateway4: 192.168.1.1\r\n nameservers:\r\n addresses: [192.168.1.1, 8.8.8.8]\r\n version: 2<\/pre>\r\n\r\n\r\n\r\nWhen editing the file, make sure the ethernet interface match with the one we see when invoking the ‘ip a’<\/strong> or ‘ip link’<\/strong> command.<\/p>\r\n\r\n\r\n\r\nTo check the new configuration file without applying the changes, we can run this command:<\/p>\r\n\r\n\r\n\r\n
$ sudo netplan try<\/pre>\r\n\r\n\r\n\r\nIf everything is okay, you will see a message as seen in the picture below. You can hit ENTER to accept the changes or leave it to revert the changes back to the previous configuration.<\/p>\r\n\r\n\r\n\r\n <\/figure>\r\n\r\n\r\n\r\nMost modern home routers have configuration options to allow you to reserve an IP address for a specific device connected to the same network. With this option in your home router, your devices on the network will get static\/fixed IP addresses. This is the easiest and most recommended way to assign an IP address to your device, and this is called static DHCP or DHCP reservation.<\/p>\r\n\r\n\r\n\r\n
If you do not want to configure it on the router, you can do it on the device itself. At this moment, we will show you how to configure a static IP address on Ubuntu desktop 20.04. Let’s click on the network icon on the top right of your screen.<\/p>\r\n\r\n\r\n\r\n <\/figure>\r\n\r\n\r\n\r\nClicking the icon will bring you to the new window, as seen in the picture below<\/p>\r\n\r\n\r\n\r\n <\/figure>\r\n\r\n\r\n\r\nIn this example, we will configure the static IP address for the wired connection. So, we need to click on the cog icon next to the on-off slider in the wired connection section. To configure your WiFi connection, then you need to click on the cog icon in the WiFi connection section.<\/p>\r\n\r\n\r\n\r\n
This will open a new window, click on the IPv4 as shown in the picture below<\/p>\r\n\r\n\r\n\r\n <\/figure>\r\n\r\n\r\n\r\nIn the next window, choose “Manual” in IPv4 Method and fill the following information in the forms<\/p>\r\n\r\n\r\n\r\n
Address: 192.168.1.100 Netmask: 255.255.255.0 Gateway: 192.168.1.1<\/pre>\r\n\r\n\r\n\r\n <\/figure>\r\n\r\n\r\n\r\nYou can leave the DNS part blank if you want to set it to automatic or use your own DNS<\/a> address, separate the IP addresses with commas, for example, 1.1.1.1, 8.8.8.8<\/strong>, then click on the APPLY button above.<\/p>\r\n\r\n\r\n\r\nCongratulations! you have successfully configured a static IP address on Ubuntu 20.04.<\/p>\r\n\r\n\r\n\r\n
Of course, you don\u2019t need to configure a static IP address on Ubuntu 20.04 yourself if you use one of our Linux VPS Hosting<\/a><\/strong> services and have additional IP addresses. In which case you can simply ask our expert Linux admins to configure and set this up for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\r\n\r\n\r\n\r\nPS. If you liked this post on How To Configure a Static IP Address on Ubuntu 20.04, please share it with your friends on social networks, or simply leave a reply below. Thanks.<\/p>\r\n","protected":false},"excerpt":{"rendered":"
A static or fixed IP address is an IP address that does not change. Whether you reboot your device or … <\/p>\n
Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":38953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1701,21,13,1698],"tags":[1948,1949,1839],"yoast_head":"\nHow to Configure Static IP Address on Ubuntu 20.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 \n \n\t \n\t \n\t \n