{"id":5490,"date":"2023-11-20T08:15:32","date_gmt":"2023-11-20T08:15:32","guid":{"rendered":"https:\/\/natsav.com\/blog\/?p=5490"},"modified":"2024-02-03T12:53:02","modified_gmt":"2024-02-03T12:53:02","slug":"add-additional-ip-in-ubuntu","status":"publish","type":"post","link":"https:\/\/natsav.com\/blog\/add-additional-ip-in-ubuntu\/","title":{"rendered":"A Step-by-Step Guide: Adding Additional IP Addresses in Ubuntu  for Hosting Multiple Websites"},"content":{"rendered":"<p><span style=\"color: #000000;\"><strong>Step 1: Accessing Your Ubuntu 20.04 Server<\/strong><\/span><br \/>\nBegin by logging into your Ubuntu 20.04 server using SSH. Once connected, you&#8217;ll have access to the command line interface, where you&#8217;ll perform all the necessary configurations<br \/>\n<span style=\"color: #000000;\">ssh your_username@your_server_ip<\/span><\/p>\n<p><strong>Step 2: Check Current Network Configuration<\/strong><br \/>\nBefore adding additional IP addresses, it&#8217;s essential to know your server&#8217;s current network configuration. Use the following command to display network information:<br \/>\n<span style=\"color: #000000;\">#ip addr show<\/span><br \/>\nThis will list your current network interfaces and their assigned IP addresses.<\/p>\n<p><strong>Step 3: Configure Additional IP Addresses<\/strong><br \/>\nTo add an additional IP address, you need to modify the netplan configuration files. Open the appropriate file in a text editor, such as nano or vim:<\/p>\n<p><span style=\"color: #000000;\">#sudo nano \/etc\/netplan\/00-installer-config.yaml<\/span><br \/>\nAdd the following lines under the network section, ensuring proper indentation:<\/p>\n<p><span style=\"color: #000000;\">yaml<\/span><br \/>\n<span style=\"color: #000000;\">Copy code<\/span><br \/>\n<span style=\"color: #000000;\">network:<\/span><br \/>\n<span style=\"color: #000000;\">version: 2<\/span><br \/>\n<span style=\"color: #000000;\">ethernets:<\/span><br \/>\n<span style=\"color: #000000;\">ensXX:<\/span><br \/>\n<span style=\"color: #000000;\">addresses:<\/span><br \/>\n<span style=\"color: #000000;\">&#8211; your_additional_ip\/24<\/span><br \/>\nReplace ensXX with your actual network interface name and your_additional_ip with the IP address you want to add.<\/p>\n<p>Save the file and apply the changes:<br \/>\n<span style=\"color: #000000;\">#sudo netplan apply<\/span><\/p>\n<p><strong>Step 4: Verify the New IP Address<\/strong><br \/>\nConfirm that the additional IP address has been successfully added by running:<br \/>\n<span style=\"color: #000000;\">#ip addr show<\/span><br \/>\nYou should now see the newly added IP address listed under your network interface.<\/p>\n<p><strong>Step 5: Configure Web Server for the New IP<\/strong><br \/>\nAdjust your web server configuration to recognize the new IP address. This process varies depending on your web server of choice (e.g., Apache or Nginx). Update the server block or virtual host configuration with the new IP address.<\/p>\n<p><strong>Step 6: Test Your Configuration<\/strong><br \/>\nRestart your web server to apply the changes and ensure that your websites are accessible via the newly added IP address. Test by accessing your websites in a web browser using both the old and new IP addresses.<\/p>\n<p><strong>Conclusion:<\/strong><br \/>\nBy following these steps, you&#8217;ve successfully added an additional IP address to your Ubuntu 20.04 server, paving the way for hosting multiple websites with enhanced security and resource management<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Step 1: Accessing Your Ubuntu 20.04 Server Begin by logging into your Ubuntu 20.04 server using SSH. Once connected, you&#8217;ll have access to the command line interface, where you&#8217;ll perform all the necessary configurations ssh your_username@your_server_ip Step 2: Check Current Network Configuration Before adding additional IP addresses, it&#8217;s essential to know your server&#8217;s current network [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5509,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[255],"tags":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/natsav.com\/blog\/wp-content\/uploads\/2023\/11\/Marketing-Blog-YouTube-Thumbnail-12-1.png?fit=500%2C281&ssl=1","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts\/5490"}],"collection":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/comments?post=5490"}],"version-history":[{"count":7,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts\/5490\/revisions"}],"predecessor-version":[{"id":5859,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts\/5490\/revisions\/5859"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/media\/5509"}],"wp:attachment":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/media?parent=5490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/categories?post=5490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/tags?post=5490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}