{"id":2383,"date":"2015-12-04T13:40:24","date_gmt":"2015-12-04T11:40:24","guid":{"rendered":"https:\/\/upcloud.com\/global\/us\/resources\/tutorials\/configure-floating-ip-debian\/"},"modified":"2015-12-04T13:40:24","modified_gmt":"2015-12-04T11:40:24","slug":"configure-floating-ip-debian","status":"publish","type":"tutorial","link":"https:\/\/upcloud.com\/global\/resources\/tutorials\/configure-floating-ip-debian\/","title":{"rendered":"How to configure Floating IP on Debian"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When you attach a new floating IP, you can find it listed to one of the servers at your UpCloud control panel that the floating IP currently points to. However, using the new floating IP will require some manual setup. Follow the steps below&nbsp;on how to get this done on Ubuntu&nbsp;servers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As an example, we have a cloud server with the public IP address 185.20.139.167, a floating IP 185.20.139.29, with a netmask 255.255.255.255. These are highlighted below in <span style=\"color: #ff0000;\">red<\/span>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before making changes to your network configuration, it\u2019s always a good idea to <a href=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/taking-backups\">take a backup<\/a>. Also, note that if your network configuration becomes inoperable, remember that you can always log in to your cloud server using <a href=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/connecting-to-your-server\">the console connection<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/signup.upcloud.com\/\">Try UpCloud for free!<\/a><\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Configuring floating IP<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Firstly, you\u2019ll need to configure the servers at the OS level, so start up your cloud server at your\u00a0<a rel=\"noopener\" href=\"https:\/\/hub.upcloud.com\/\" target=\"_blank\">UpCloud Control Panel<\/a>\u00a0and\u00a0<a href=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/connecting-to-your-server\">log in<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check your current network settings with the following command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ip addr<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Commonly the second network interface card (NIC) named <tt>eth0<\/tt> has your public IPv4 address assigned to it, see the example below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">2: <span style=\"color: #ff0000;\">eth0<\/span>: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n&nbsp;&nbsp;&nbsp; link\/ether 6e:d7:1b:bf:5a:b0 brd ff:ff:ff:ff:ff:ff\n&nbsp;&nbsp;&nbsp; inet <span style=\"color: #ff0000;\">185.20.139.167<\/span>\/22 brd 80.69.175.255 scope global eth0\n&nbsp;&nbsp;&nbsp;&nbsp;valid_lft forever preferred_lft forever<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, to enable the floating IP, add it as an alias to the network interface <tt>eth0<\/tt>&nbsp;that has your public IP address. On Ubuntu servers, this can be done by adding <tt>eth0:1<\/tt> to the <tt>interfaces<\/tt>&nbsp;file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nano \/etc\/network\/interfaces<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enter the example configuration shown below with your floating IP and netmask.&nbsp;The address highlighted in red below is an example, replace it with your floating IP.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">auto eth0:1\niface eth0:1 inet static\naddress <span style=\"color: #ff0000;\">185.20.139.29\n<\/span>netmask <span style=\"color: #ff0000;\">255.255.255.255<\/span><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save the file and exit after these changes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, restart the network manager to enable the new configuration.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl restart networking<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you were connected with SSH, the networking restart should not cause you to disconnect. In case you do lose connection and are unable to reconnect, you can always use the web&nbsp;<em>Console<\/em> at the <a rel=\"noopener\" href=\"https:\/\/hub.upcloud.com\/\" target=\"_blank\">UpCloud Control Panel<\/a> under your <em>Server settings<\/em> to go through the setup again to make sure everything is entered correctly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Repeat the process to add the alias on&nbsp;any other&nbsp;servers you wish to use the floating IP on.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Testing the configuration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Your configuration is now complete. You can test that it works by transferring the floating IP from one server to another.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, ping the cloud server or attempt to connect to your server through the floating IP via SSH. Alternatively, if you have a web server configured, open the floating IP on your web browser.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then transfer the floating IP to another cloud server you\u2019ve configured. This can be done either at your <a rel=\"noopener\" href=\"https:\/\/hub.upcloud.com\/networks\/floating-ips\" target=\"_blank\">UpCloud Control Panel<\/a> or by using the <a href=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/managing-floating-ips-upcloud-api\">UpCloud API<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Test the floating IP again with any method you prefer.&nbsp;When you get a connection you have successfully transferred&nbsp;your&nbsp;floating IP.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When you get a reply, the floating IP works on that server and you can continue forward. If it didn\u2019t work, make sure you entered the IP address and netmask correctly, and that your firewall isn\u2019t blocking your connections, or try another method&nbsp;to connect.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using your new floating IP<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can now&nbsp;transfer the floating IP between your cloud&nbsp;servers at your <a rel=\"noopener\" href=\"https:\/\/hub.upcloud.com\/networks\/floating-ips\" target=\"_blank\">UpCloud Control Panel<\/a> or by using the <a href=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/managing-floating-ips-upcloud-api\">UpCloud API<\/a>!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Depending on your intended use case for the floating IP you may wish to continue by setting up automated load balancing, but it\u2019s always possible to manually transfer the traffic between your servers.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","community-category":[259,247],"class_list":["post-2383","tutorial","type-tutorial","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial\/2383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial"}],"about":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/types\/tutorial"}],"author":[{"embeddable":true,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/comments?post=2383"}],"version-history":[{"count":0,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial\/2383\/revisions"}],"wp:attachment":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/media?parent=2383"}],"wp:term":[{"taxonomy":"community-category","embeddable":true,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/community-category?post=2383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}