{"id":6333,"date":"2016-10-12T13:20:48","date_gmt":"2016-10-12T05:20:48","guid":{"rendered":"http:\/\/rmohan.com\/?p=6333"},"modified":"2016-10-12T13:20:48","modified_gmt":"2016-10-12T05:20:48","slug":"centos-7-0-configure-networking","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6333","title":{"rendered":"[CentOS 7.0] Configure Networking"},"content":{"rendered":"<h3 class=\"post-title entry-title\">[CentOS 7.0] Configure Networking<\/h3>\n<div class=\"post-header\"><\/div>\n<div id=\"post-body-3118582867929440338\" class=\"post-body entry-content\">[1] Set static IP address to the server. ( Replace the section &#8216;ifcfg-***&#8217; to your own interface name )<\/p>\n<p># install the package below which includes ifconfig, netstat and so on first<\/p>\n<p>[root@dlp ~]#yum -y install net-tools<\/p>\n<p>[root@dlp ~]#vi \/etc\/sysconfig\/network-scripts\/ifcfg-eno16777736<\/p>\n<p>HWADDR=&#8221;00:0C:29:CD:9C:2D&#8221;<br \/>\nTYPE=&#8221;Ethernet&#8221;<\/p>\n<p># change<br \/>\nBOOTPROTO=&#8221;none&#8221;<br \/>\nDEFROUTE=&#8221;yes&#8221;<br \/>\nPEERDNS=&#8221;yes&#8221;<br \/>\nPEERROUTES=&#8221;yes&#8221;<br \/>\nIPV4_FAILURE_FATAL=&#8221;no&#8221;<br \/>\nIPV6INIT=&#8221;yes&#8221;<br \/>\nIPV6_AUTOCONF=&#8221;yes&#8221;<br \/>\nIPV6_DEFROUTE=&#8221;yes&#8221;<br \/>\nIPV6_PEERDNS=&#8221;yes&#8221;<br \/>\nIPV6_PEERROUTES=&#8221;yes&#8221;<br \/>\nIPV6_FAILURE_FATAL=&#8221;no&#8221;<br \/>\nNAME=&#8221;eno16777736&#8243;<br \/>\nUUID=&#8221;3eb052b5-f8f2-4609-b70b-e44a050f6524&#8243;<br \/>\nONBOOT=&#8221;yes&#8221;<br \/>\n# add like follows<br \/>\n# this server&#8217;s IP address<br \/>\nIPADDR=&#8221;10.0.0.30&#8243;<\/p>\n<p># subnet mask<br \/>\nNETMASK=&#8221;255.255.255.0&#8243;<\/p>\n<p># default gateway<br \/>\nGATEWAY=&#8221;10.0.0.1&#8243;<\/p>\n<p># DNS server&#8217;s IP address<br \/>\nDNS1=&#8221;10.0.0.1&#8243;<\/p>\n<p>[root@dlp ~]#systemctl stop NetworkManager<\/p>\n<p>[root@dlp ~]#systemctl disable NetworkManager<\/p>\n<p>rm &#8216;\/etc\/systemd\/system\/multi-user.target.wants\/NetworkManager.service&#8217;<br \/>\nrm &#8216;\/etc\/systemd\/system\/dbus-org.freedesktop.NetworkManager.service&#8217;<br \/>\nrm &#8216;\/etc\/systemd\/system\/dbus-org.freedesktop.nm-dispatcher.service&#8217;<\/p>\n<p>[root@dlp ~]#systemctl restart network<\/p>\n<p>[root@dlp ~]#chkconfig network on<\/p>\n<p>[root@dlp ~]#ifconfig<\/p>\n<p>eno16777736: flags=4163\u00a0 mtu 1500<br \/>\ninet 10.0.0.30\u00a0 netmask 255.255.255.0\u00a0 broadcast 10.0.0.255<br \/>\ninet6 fe80::20c:29ff:fecd:9c2d\u00a0 prefixlen 64\u00a0 scopeid 0x20<br \/>\nether 00:0c:29:cd:9c:2d\u00a0 txqueuelen 1000\u00a0 (Ethernet)<br \/>\nRX packets 5978\u00a0 bytes 7634267 (7.2 MiB)<br \/>\nRX errors 0\u00a0 dropped 0\u00a0 overruns 0\u00a0 frame 0<br \/>\nTX packets 3256\u00a0 bytes 287222 (280.4 KiB)<br \/>\nTX errors 0\u00a0 dropped 0 overruns 0\u00a0 carrier 0\u00a0 collisions 0<\/p>\n<p>lo: flags=73\u00a0 mtu 65536<br \/>\ninet 127.0.0.1\u00a0 netmask 255.0.0.0<br \/>\ninet6 ::1\u00a0 prefixlen 128\u00a0 scopeid 0x10<br \/>\nloop\u00a0 txqueuelen 0\u00a0 (Local Loopback)<br \/>\nRX packets 0\u00a0 bytes 0 (0.0 B)<br \/>\nRX errors 0\u00a0 dropped 0\u00a0 overruns 0\u00a0 frame 0<br \/>\nTX packets 0\u00a0 bytes 0 (0.0 B)<br \/>\nTX errors 0\u00a0 dropped 0 overruns 0\u00a0 carrier 0\u00a0 collisions 0<\/p>\n<p>[2] Disable IPv6 if you do not need it.<\/p>\n<p>[root@dlp ~]#vi \/etc\/default\/grub<\/p>\n<p># line 6: add<br \/>\nGRUB_CMDLINE_LINUX=&#8221;ipv6.disable=1 rd.lvm.lv=fedora\/swap rd.md=0&#8230;..<\/p>\n<p># reload<br \/>\n[root@dlp ~]#grub2-mkconfig -o \/boot\/grub2\/grub.cfg<\/p>\n<p>[root@dlp ~]#reboot<\/p>\n<p>[3] if you&#8217;d like to use the network interface name as ethX, configure like follows.<\/p>\n<p>[root@dlp ~]#vi \/etc\/default\/grub<\/p>\n<p># line 6: add<br \/>\nGRUB_CMDLINE_LINUX=&#8221;net.ifnames=0 rd.lvm.lv=fedora\/swap rd.md=0&#8230;..<\/p>\n<p># reload<br \/>\n[root@dlp ~]#grub2-mkconfig -o \/boot\/grub2\/grub.cfg<\/p>\n<p>[root@dlp ~]#reboot<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>[CentOS 7.0] Configure Networking [1] Set static IP address to the server. ( Replace the section &#8216;ifcfg-***&#8217; to your own interface name )<\/p>\n<p># install the package below which includes ifconfig, netstat and so on first<\/p>\n<p>[root@dlp ~]#yum -y install net-tools<\/p>\n<p>[root@dlp ~]#vi \/etc\/sysconfig\/network-scripts\/ifcfg-eno16777736<\/p>\n<p>HWADDR=&#8221;00:0C:29:CD:9C:2D&#8221; TYPE=&#8221;Ethernet&#8221;<\/p>\n<p># change BOOTPROTO=&#8221;none&#8221; DEFROUTE=&#8221;yes&#8221; PEERDNS=&#8221;yes&#8221; PEERROUTES=&#8221;yes&#8221; IPV4_FAILURE_FATAL=&#8221;no&#8221; IPV6INIT=&#8221;yes&#8221; IPV6_AUTOCONF=&#8221;yes&#8221; [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6333"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6333"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6333\/revisions"}],"predecessor-version":[{"id":6334,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6333\/revisions\/6334"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}