{"id":7205,"date":"2013-02-09T17:13:26","date_gmt":"2013-02-09T22:13:26","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=7205"},"modified":"2016-12-16T08:42:17","modified_gmt":"2016-12-16T13:42:17","slug":"configure-rhel-5-networking","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=7205","title":{"rendered":"Configure RHEL 5 Networking"},"content":{"rendered":"<div class='toc wptoc'>\n<h2>Contents<\/h2>\n<ol class='toc-odd level-1'>\n\t<li>\n\t\t<a href=\"#Configure_RHEL_5_Networking\">Configure RHEL 5 Networking<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Change_Host_Name\">Change Host Name<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Setup_Network_Card:_eth0\">Setup Network Card: eth0<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Setup_Networking\">Setup Networking<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Setup_DNS\">Setup DNS<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Setup_etcnsswitch.conf\">Setup \/etc\/nsswitch.conf<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Setup_etchosts_File\">Setup <em>\/etc\/hosts<\/em> File<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Restart_Networking\">Restart Networking<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Issues\">Issues<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#network_restart:_device_eth0_seems_not_to_be_present\">network restart: device eth0 seems not to be present<\/a>\n\t\t\t<\/li>\n<\/ol>\n<\/ol>\n<\/ol>\n<\/div>\n<div class='wptoc-end'>&nbsp;<\/div>\n<span id=\"Configure_RHEL_5_Networking\"><h2>Configure RHEL 5 Networking<\/h2><\/span>\n<span id=\"Change_Host_Name\"><h3>Change Host Name<\/h3><\/span>\n<pre lang=\"bash\">\r\necho layer7 > \/proc\/sys\/kernel\/hostname\r\n<\/pre>\n<p>* See <a href=\"?p=6923\">Redhat Linux Change Host Name<\/a><\/p>\n<span id=\"Setup_Network_Card:_eth0\"><h3>Setup Network Card: eth0<\/h3><\/span>\n<pre lang=\"bash\">\r\nvi \/etc\/sysconfig\/network-scripts\/ifcfg-eth0\r\n<\/pre>\n<pre lang=\"bash\">\r\n# VMware VMXNET3 Ethernet Controller\r\nDEVICE=eth0\r\nBOOTPROTO=static # static IP address\r\nONBOOT=yes\r\nHWADDR=00:0a:20:56:14:0b\r\nIPADDR=192.168.1.61\r\nNETMASK=255.255.255.0\r\nPEERDNS=no  # This prevents \/etc\/resolv.conf from getting overwritten by \/sbin\/dhclient-script\r\n<\/pre>\n<span id=\"Setup_Networking\"><h3>Setup Networking<\/h3><\/span>\n<pre lang=\"bash\">\r\nvi \/etc\/sysconfig\/network\r\n<\/pre>\n<pre lang=\"bash\">\r\nNETWORKING=yes\r\nHOSTNAME=layer7.mytest.local\r\nGATEWAY=192.168.1.1\r\nNETWORKING_IPV6=no\r\n<\/pre>\n<span id=\"Setup_DNS\"><h3>Setup DNS<\/h3><\/span>\n<pre lang=\"bash\">\r\nvi \/etc\/resolv.conf\r\n<\/pre>\n<pre lang=\"bash\">\r\nsearch mytest.local\r\nnameserver 192.168.1.21\r\n<\/pre>\n<span id=\"Setup_etcnsswitch.conf\"><h3>Setup \/etc\/nsswitch.conf<\/h3><\/span>\n<pre lang=\"bash\">\r\nvi \/etc\/nsswitch.conf\r\n<\/pre>\n<pre lang=\"bash\">\r\nhosts: files dns\r\n<\/pre>\n<span id=\"Setup_etchosts_File\"><h3>Setup <em>\/etc\/hosts<\/em> File<\/h3><\/span>\n<p>* If nameserver is not setup, then we need to setup hosts file.<br \/>\n* If you have in <em>\/etc\/nsswitch.conf<\/em> file &#8220;hosts: <strong>files<\/strong> dns&#8221;, then <em>\/etc\/hosts<\/em> configuration overrides dns configuration.<\/p>\n<pre lang=\"bash\">\r\nvi \/etc\/hosts\r\n<\/pre>\n<pre lang=\"bash\">\r\n192.168.1.61    layer7\r\n<\/pre>\n<span id=\"Restart_Networking\"><h3>Restart Networking<\/h3><\/span>\n<pre lang=\"bash\">\r\n\/etc\/init.d\/network restart\r\n<\/pre>\n<span id=\"Issues\"><h2>Issues<\/h2><\/span>\n<span id=\"network_restart:_device_eth0_seems_not_to_be_present\"><h3>network restart: device eth0 seems not to be present<\/h3><\/span>\n<p>* Issue: When you clone or import a CentOS 6 virtual machine, for example by importing OVF template, you&#8217;ll notice that:<br \/>\n&#8211; eth0 is missing when you issue <em>ifconfig <\/em>command<br \/>\n&#8211; When you try to restart networking with <em>network restart<\/em> command, you get &#8220;<em>device eth0 seems not to be present<\/em>&#8221; error message<br \/>\n* Reason:<br \/>\n&#8211; CentOS 6 caches the original network card address in <em>\/etc\/udev\/rules.d\/70-persistent-net.rules<\/em> file<br \/>\n&#8211; When Centos first starts, it sees the conflicts and renames eth0 to eth1<br \/>\n* To fix, remove the cache file and reboot<\/p>\n<pre lang=\"bash\">\r\nrm \/etc\/udev\/rules.d\/70-persistent-net.rules\r\nreboot\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Configure RHEL 5 Networking Change Host Name echo layer7 > \/proc\/sys\/kernel\/hostname * See Redhat Linux Change Host Name Setup Network Card: eth0 vi \/etc\/sysconfig\/network-scripts\/ifcfg-eth0 # VMware VMXNET3 Ethernet Controller DEVICE=eth0 BOOTPROTO=static # static IP address ONBOOT=yes HWADDR=00:0a:20:56:14:0b IPADDR=192.168.1.61 NETMASK=255.255.255.0 PEERDNS=no &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=7205\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[301],"tags":[344,343],"class_list":["post-7205","post","type-post","status-publish","format-standard","hentry","category-redhat","tag-networking","tag-rhel"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-1Sd","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/7205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7205"}],"version-history":[{"count":15,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/7205\/revisions"}],"predecessor-version":[{"id":11835,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/7205\/revisions\/11835"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}