{"id":900,"date":"2022-07-22T12:53:05","date_gmt":"2022-07-22T06:53:05","guid":{"rendered":"https:\/\/mellowhost.com\/blog\/?p=900"},"modified":"2022-07-22T12:53:05","modified_gmt":"2022-07-22T06:53:05","slug":"how-to-set-default-route-interface-when-there-are-multiple-interfaces-in-centos","status":"publish","type":"post","link":"https:\/\/mellowhost.com\/blog\/how-to-set-default-route-interface-when-there-are-multiple-interfaces-in-centos.html","title":{"rendered":"How to Set Default Route Interface when there are multiple Interfaces in CentOS"},"content":{"rendered":"\n<p>Consider the following situation, you have two interfaces in your system, eth0, and eth1 (or more). Both the interfaces have a default gateway. But how can you choose which interface to follow as the default outbound requests by the server?  This could be a situation like adding secondary alias IP addresses to an interface (Like eth0, eth0:0, eth0:1, eth0:2, etc). <\/p>\n\n\n\n<p>In these cases, Linux can decide based on its own algorithm. The problem with this is in the case of Licensing. In most licensing systems these days, you need to provide an outbound IP address to your server.  If this IP changes over time, you would have trouble managing the license. For these cases, you need to define your default interface to Linux. <\/p>\n\n\n\n<p>You may set this configuration under \/etc\/sysconfig\/network file. The &#8216;key&#8217; for the settings is &#8216;GATEWAYDEV&#8217;.<\/p>\n\n\n\n<p>So for example if your gatewaydev would be eth0:1, the file would look like something following:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">NETWORKING=yes\nHOSTNAME=hemonto.ethii.com\nDOMAINNAME=ethii.com\nGATEWAYDEV=eth0:1<\/pre>\n\n\n\n<p>or if it is eth1, the following:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">NETWORKING=yes\nHOSTNAME=hemonto.ethii.com\nDOMAINNAME=ethii.com\nGATEWAYDEV=eth1<\/pre>\n\n\n\n<p>I Hope, this helps somebody. Good luck<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Consider the following situation, you have two interfaces in your system, eth0, and eth1 (or more). Both the interfaces have a default gateway. But how can you choose which interface to follow as the default outbound requests by the server? This could be a situation like adding secondary alias IP addresses to an interface (Like &hellip; <a href=\"https:\/\/mellowhost.com\/blog\/how-to-set-default-route-interface-when-there-are-multiple-interfaces-in-centos.html\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Set Default Route Interface when there are multiple Interfaces in CentOS&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,237],"tags":[156,691,70,690],"_links":{"self":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/900"}],"collection":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/comments?post=900"}],"version-history":[{"count":1,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/900\/revisions"}],"predecessor-version":[{"id":901,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/900\/revisions\/901"}],"wp:attachment":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/media?parent=900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/categories?post=900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/tags?post=900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}