{"id":182,"date":"2012-01-09T13:25:20","date_gmt":"2012-01-09T12:25:20","guid":{"rendered":"http:\/\/elkano.org\/blog\/?p=182"},"modified":"2012-01-10T15:44:29","modified_gmt":"2012-01-10T14:44:29","slug":"rename-linux-network-interfaces","status":"publish","type":"post","link":"https:\/\/elkano.org\/blog\/rename-linux-network-interfaces\/","title":{"rendered":"Rename linux network interfaces"},"content":{"rendered":"<p>Sometimes it can be useful to have network interfaces with an recognizable name, rather than eth0, eth1,&#8230; with which you can easily identify to which networks they are connected. For example, if you have a server connected to many networks and vlans you can identify the network\/vlan based on interface name, eth50 for vlan50, eth100 for vlan100,&#8230; or you can simply rename interface to vlan50, vlan100 directly.<\/p>\n<p>In <strong>Debian<\/strong> you should install <strong>ifrename<\/strong> package and create the file <strong>\/etc\/iftab<\/strong> with this format:<\/p>\n<pre class=\"brush: text; gutter: false; first-line: 1; highlight: []; html-script: false\">\r\n$ cat \/etc\/iftab \r\neth50  mac F2:A8:C0:77:82:94\r\neth55  mac 4E:DF:22:FD:71:EA\r\n<\/pre>\n<p>In <strong>Redhat\/CentOS<\/strong> you can rename \/etc\/sysconfig\/network-scripts\/ifcfg-eth0 to \/etc\/sysconfig\/network-scripts\/ifcfg-XXXX and edit file specifying this name. For example, I have my ifcfg-eth50 script like this:<\/p>\n<p><code>DEVICE=eth50<br \/>\nNM_CONTROLLED=yes<br \/>\nONBOOT=yes<br \/>\nHWADDR=9c:83:4f:af:a1:ec<br \/>\nTYPE=Ethernet<br \/>\nBOOTPROTO=none<br \/>\nIPADDR=172.16.0.19<br \/>\nPREFIX=23<br \/>\nDEFROUTE=yes<br \/>\nIPV4_FAILURE_FATAL=yes<br \/>\nIPV6INIT=no<br \/>\nNAME=eth50<br \/>\nUUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03<br \/>\nNETMASK=255.255.254.0<br \/>\nUSERCTL=no<\/code><\/p>\n<p>In <strong>Ubuntu<\/strong>, I did not try it but I think you can edit the file \/<strong>etc\/udev\/rules.d\/70-persistent-net.rules<\/strong> and change the name of interface according to its mac address.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes it can be useful to have network interfaces with an recognizable name, rather than eth0, eth1,&#8230; with which you can easily identify to which networks they are connected. For example, if you have a server connected to many networks and vlans you can identify the network\/vlan based on interface name, eth50 for vlan50, eth100 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,27],"tags":[30,148],"_links":{"self":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/182"}],"collection":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/comments?post=182"}],"version-history":[{"count":15,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/182\/revisions"}],"predecessor-version":[{"id":222,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/182\/revisions\/222"}],"wp:attachment":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/media?parent=182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/categories?post=182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/tags?post=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}