{"id":334,"date":"2016-10-07T08:49:22","date_gmt":"2016-10-07T08:49:22","guid":{"rendered":"http:\/\/shijuvarghese.com\/?p=334"},"modified":"2016-10-07T09:15:56","modified_gmt":"2016-10-07T09:15:56","slug":"adding-a-route-in-linux","status":"publish","type":"post","link":"http:\/\/shijuvarghese.com\/?p=334","title":{"rendered":"Adding a route in Linux"},"content":{"rendered":"<p>If you can to access a network outside your local host&#8217;s network, and the same is not know to your default gateway, you will require to add static routes in your systems. Same will be required in scenarios when your host is connected to two networks and would like to reach a third network via a specific network.<\/p>\n<p>&nbsp;<\/p>\n<p>The command to add a route in a Linux host to reach\u00a0192.168.100.x network via the NIC eth0 that has IP\u00a092.168.10.1 is as follows:<\/p>\n<p># route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.10.1 dev eth0<\/p>\n<p>The above is a temporary setting that will stop working\u00a0after the network restarts. To permanently add it you will have to create a file &#8220;\/etc\/sysconfig\/network-scripts\/route-eth0&#8221; and will need to add the following lines in the file.<\/p>\n<div id=\"crayon-57f75c2de315f889980742-1\" class=\"crayon-line\"><span class=\"crayon-v\">ADDRESS0<span class=\"crayon-o\">=<\/span><span class=\"crayon-cn\">192.168.100.0<\/span><\/span><\/div>\n<div class=\"crayon-line\"><span class=\"crayon-v\">NETMASK0<\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-cn\">255.255.255.0<\/span><\/div>\n<div class=\"crayon-line\"><span class=\"crayon-v\">GATEWAY0<\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-cn\">192.168.10.1<\/span><\/div>\n<div id=\"crayon-57f75c2de315f889980742-3\" class=\"crayon-line\"><\/div>\n<div class=\"crayon-line\"><\/div>\n<div class=\"crayon-line\">Once saved, restart the network service.<\/div>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>If you can to access a network outside your local host&#8217;s network, and the same is not know to your default gateway, you will require <a class=\"mh-excerpt-more\" href=\"http:\/\/shijuvarghese.com\/?p=334\" title=\"Adding a route in Linux\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":264,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-334","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/334","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=334"}],"version-history":[{"count":2,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions"}],"predecessor-version":[{"id":336,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions\/336"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/media\/264"}],"wp:attachment":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}