{"id":838,"date":"2014-10-27T18:42:19","date_gmt":"2014-10-27T21:42:19","guid":{"rendered":"http:\/\/blog.abratel.com.br\/?p=838"},"modified":"2014-10-30T12:31:41","modified_gmt":"2014-10-30T15:31:41","slug":"centos-7-e-placas-de-redes","status":"publish","type":"post","link":"https:\/\/blog.abratel.com.br\/?p=838","title":{"rendered":"CentOS 7 e placas de redes"},"content":{"rendered":"<p>Depois de muito quebrar a cabe\u00e7a com a nova forma de nomear placas de redes no CentOS7 consegui uma solu\u00e7\u00e3o.<br \/>\nPara trocar o nome para eth0, eth2, etc:<\/p>\n<p>[root@eSuareznotes01 ~]# ip addr show<br \/>\n1: lo: mtu 65536 qdisc noqueue state UNKNOWN<br \/>\nlink\/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00<br \/>\ninet 127.0.0.1\/8 scope host lo<br \/>\nvalid_lft forever preferred_lft forever<br \/>\ninet6 ::1\/128 scope host<br \/>\nvalid_lft forever preferred_lft forever<br \/>\n2: eno16777736: mtu 1500 qdisc pfifo_fast state UP qlen 1000<br \/>\nlink\/ether 00:0c:29:92:78:40 brd ff:ff:ff:ff:ff:ff<br \/>\ninet XX.X.XX.XX\/24 brd 10.0.10.255 scope global dynamic eno16777736<br \/>\nvalid_lft 85931sec preferred_lft 85931sec<br \/>\ninet6 fe80::20c:29ff:fe92:7840\/64 scope link<br \/>\nvalid_lft forever preferred_lft forever<\/p>\n<p>[root@eSuareznotes01 ~]# vi \/etc\/default\/grub<\/p>\n<p>GRUB_TIMEOUT=5<br \/>\nGRUB_DISTRIBUTOR=\u201d$(sed \u2018s, release .*$,,g\u2019 \/etc\/system-release)\u201d<br \/>\nGRUB_DEFAULT=saved<br \/>\nGRUB_DISABLE_SUBMENU=true<br \/>\nGRUB_TERMINAL_OUTPUT=\u201dconsole\u201d<br \/>\nGRUB_CMDLINE_LINUX=\u201drd.lvm.lv=rootvg\/usrlv rd.lvm.lv=rootvg\/swaplv crashkernel=auto vconsole.keymap=us rd.lvm.lv=rootvg\/rootlv vconsole.font=latarcyrheb-sun16 rhgb quiet\u201d<br \/>\nGRUB_DISABLE_RECOVERY=\u201dtrue\u201d<\/p>\n<p>Look for this line \u201cGRUB_CMDLINE_LINUX\u201d and add the following: \u201cnet.ifnames=0 biosdevname=0\u2033<\/p>\n<p>Should look like this:<br \/>\nGRUB_CMDLINE_LINUX=\u201drd.lvm.lv=rootvg\/usrlv rd.lvm.lv=rootvg\/swaplv crashkernel=auto vconsole.keymap=us rd.lvm.lv=rootvg\/rootlv vconsole.font=latarcyrheb-sun16 rhgb quiet net.ifnames=0 biosdevname=0\u201c<\/p>\n<p>[root@eSuareznotes01 ~]# grub2-mkconfig -o \/boot\/grub2\/grub.cfg<br \/>\nGenerating grub configuration file \u2026<br \/>\nFound linux image: \/boot\/vmlinuz-3.10.0-121.el7.x86_64<br \/>\nFound initrd image: \/boot\/initramfs-3.10.0-121.el7.x86_64.img<br \/>\nFound linux image: \/boot\/vmlinuz-0-rescue-df30d92ad3eb414583d85bb471003eb4<br \/>\nFound initrd image: \/boot\/initramfs-0-rescue-df30d92ad3eb414583d85bb471003eb4.img<br \/>\ndone<\/p>\n<p>If you didn\u2019t put any names during the installation, you will need to rename the interface files by renaming the file \/etc\/sysconfig\/network-scripts\/ifcfg-*.<\/p>\n<p>[root@eSuareznotes01 ~]# mv \/etc\/sysconfig\/network-scripts\/ifcfg-eno16777736 \/etc\/sysconfig\/network-scripts\/ifcfg-eth0<br \/>\n[root@eSuareznotes01 ~]# shutdown -r now<\/p>\n<p>After system reboot<\/p>\n<p>[root@eSuareznotes01 ~]# ip addr show<br \/>\n1: lo: mtu 65536 qdisc noqueue state UNKNOWN<br \/>\nlink\/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00<br \/>\ninet 127.0.0.1\/8 scope host lo<br \/>\nvalid_lft forever preferred_lft forever<br \/>\ninet6 ::1\/128 scope host<br \/>\nvalid_lft forever preferred_lft forever<br \/>\n2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000<br \/>\nlink\/ether 00:0c:29:92:78:40 brd ff:ff:ff:ff:ff:ff<br \/>\ninet 10.0.10.77\/24 brd 10.0.10.255 scope global dynamic eth0<br \/>\nvalid_lft 86141sec preferred_lft 86141sec<br \/>\ninet6 fe80::20c:29ff:fe92:7840\/64 scope link<br \/>\nvalid_lft forever preferred_lft forever<\/p>\n<p>Agora para o kernel n\u00e3o confundir as placas e ficar trocando os nomes:<\/p>\n<p>systemctl disable NetworkManager<br \/>\nsystemctl stop NetworkManager<\/p>\n<p><strong>And what if I want the old naming back?<\/strong><\/p>\n<p>These are the necessary steps:<\/p>\n<p>Add &#8220;net.ifnames=0&#8221; and &#8220;biosdevname=0&#8221; as kernel arguments to grub<br \/>\nIn &#8216;\/etc\/sysconfig\/network-scripts\/&#8217; Change your configured NIC config file to &#8216;ifcfg-ethX&#8217;<br \/>\nIf you have multiple interfaces and want to control naming of each device rather than letting the kernel do in its own way, \/etc\/udev\/rules.d\/60-net.rules seems necessary to override \/usr\/lib\/udev\/rules.d\/60-net.rules.<\/p>\n<p>Eh interessante nesta parte dizer que eu tive que comentar tudo o que estava escrito dentro do arquivo \/usr\/lib\/udev\/rules.d\/60-net.rules pois l\u00e1 h\u00e1 o script que gera o nome pelo kernel \u00e0 interface de rede.<\/p>\n<p>Crie um arquivo <strong>\/etc\/udev\/rules.d\/60-net.rules<\/strong> respeitando o MAC observador com o comando ifconfig:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nSUBSYSTEM==&quot;net&quot;, ACTION==&quot;add&quot;, DRIVERS==&quot;?*&quot;, ATTR{address}==&quot;90:f6:52:e0:32:75&quot;, ATTR{type}==&quot;1&quot;, KERNEL==&quot;eth*&quot;, NAME=&quot;eth0&quot;\r\nSUBSYSTEM==&quot;net&quot;, ACTION==&quot;add&quot;, DRIVERS==&quot;?*&quot;, ATTR{address}==&quot;6c:f0:49:a5:bc:38&quot;, ATTR{type}==&quot;1&quot;, KERNEL==&quot;eth*&quot;, NAME=&quot;eth1&quot;\r\n<\/pre>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p><strong>How do I disable IPv6?<\/strong><\/p>\n<p>Upstream employee Daniel Walsh recommends not disabling the ipv6 module, as that can cause issues with SELinux and other components, but adding the following to \/etc\/sysctl.conf:<\/p>\n<p>net.ipv6.conf.all.disable_ipv6 = 1<br \/>\nnet.ipv6.conf.default.disable_ipv6 = 1<br \/>\nTo disable in the running system:<\/p>\n<p>echo 1 > \/proc\/sys\/net\/ipv6\/conf\/all\/disable_ipv6<br \/>\necho 1 > \/proc\/sys\/net\/ipv6\/conf\/default\/disable_ipv6<br \/>\nor<\/p>\n<p>sysctl -w net.ipv6.conf.all.disable_ipv6=1<br \/>\nsysctl -w net.ipv6.conf.default.disable_ipv6=1<br \/>\nAdditional note #1: If problems with X forwarding are encountered on systems with IPv6 disabled, edit \/etc\/ssh\/sshd_config and make either of the following changes:<\/p>\n<p>(1) Change the line<\/p>\n<p>#AddressFamily any<br \/>\nto<\/p>\n<p>AddressFamily inet<br \/>\n(inet is ipv4 only; inet6 is ipv6 only)<\/p>\n<p>or<\/p>\n<p>(2) Remove the hash mark (#) in front of the line<\/p>\n<p>#ListenAddress 0.0.0.0<br \/>\nThen restart ssh.<\/p>\n<p>Additional note #2: If problems with starting postfix are encountered on systems with IPv6 disabled, either<\/p>\n<p>(1) edit \/etc\/postfix\/main.cf and comment out the localhost part of the config and use ipv4 loopback.<\/p>\n<p>#inet_interfaces = localhost<br \/>\ninet_interfaces = 127.0.0.1<br \/>\nor<\/p>\n<p>(2) take out the ipv6 localhost from \/etc\/hosts .<\/p>\n<p>Additional Note #3 : To disable RPCBIND ipv6 (rpcbind, rpc.mountd, prc.statd) remark out the udp6 and tcp6 lines in \/etc\/netconfig:<\/p>\n<p>udp        tpi_clts      v     inet     udp     &#8211;       &#8211;<br \/>\ntcp        tpi_cots_ord  v     inet     tcp     &#8211;       &#8211;<br \/>\n#udp6       tpi_clts      v     inet6    udp     &#8211;       &#8211;<br \/>\n#tcp6       tpi_cots_ord  v     inet6    tcp     &#8211;       &#8211;<br \/>\nrawip      tpi_raw       &#8211;     inet      &#8211;      &#8211;       &#8211;<br \/>\nlocal      tpi_cots_ord  &#8211;     loopback  &#8211;      &#8211;       &#8211;<br \/>\nunix       tpi_cots_ord  &#8211;     loopback  &#8211;      &#8211;       &#8211;<br \/>\n6. From where can I download the 32-bit version?<\/p>\n<p>There are plans to build a full 32-bit release of CentOS-7 as a secondary arch via community involvement. More information will be forthcoming on this as things progress but there is no ETA yet.<\/p>\n<p><strong>4. But I just want it to work and to hand-edit the configuration files.<\/strong><\/p>\n<p>Many installations do not require the complexity of the NetworkManager tool, and use hand-edited configuration files instead. Here is a sample non NetworkManager DHCP interface configuration:<\/p>\n<p>[root@example ~]# cat \/etc\/sysconfig\/network-scripts\/ifcfg-eth0<br \/>\nDEVICE=&#8221;eth0&#8243;<br \/>\nBOOTPROTO=dhcp<br \/>\nNM_CONTROLLED=&#8221;no&#8221;<br \/>\nPERSISTENT_DHCLIENT=1<br \/>\nONBOOT=&#8221;yes&#8221;<br \/>\nTYPE=Ethernet<br \/>\nDEFROUTE=yes<br \/>\nPEERDNS=yes<br \/>\nPEERROUTES=yes<br \/>\nIPV4_FAILURE_FATAL=yes<br \/>\nIPV6INIT=yes<br \/>\nIPV6_AUTOCONF=yes<br \/>\nIPV6_DEFROUTE=yes<br \/>\nIPV6_PEERDNS=yes<br \/>\nIPV6_PEERROUTES=yes<br \/>\nIPV6_FAILURE_FATAL=no<br \/>\nNAME=&#8221;eth0&#8243;<br \/>\n[root@none ~]#<br \/>\nand a sample &#8216;static assignment&#8217; configuration file:<\/p>\n<p>[username@hostname]$ cat \/etc\/sysconfig\/network-scripts\/ifcfg-eth0<br \/>\nDEVICE=&#8221;eth0&#8243;<br \/>\nHWADDR=&#8221;00:21:70:10:7E:CD&#8221;<br \/>\nNM_CONTROLLED=&#8221;no&#8221;<br \/>\nONBOOT=&#8221;yes&#8221;<br \/>\nBOOTPROTO=static<br \/>\n# BOOTPROTO=dhcp<br \/>\nIPADDR=10.16.1.106<br \/>\nNETMASK=255.255.255.0<br \/>\n#<br \/>\n#   the GATEWAY is sometimes in: \/etc\/sysconfig\/network<br \/>\nGATEWAY=10.16.1.1<br \/>\nand then common items such as hostname and DNS servers may optionally be placed in:<\/p>\n<p>[username@hostname]$ cat \/etc\/sysconfig\/network<br \/>\nHOSTNAME=acme.example.com<br \/>\nDNS1=10.16.1.112<br \/>\nDNS2=8.8.8.8<br \/>\n## DNS2=76.242.0.28<br \/>\nSEARCH=example.com<br \/>\nThe information there is &#8216;optional&#8217; because a DHCP server can hand out these values. The initscripts are able to figure out hostname and so forth when a well-populated DNS environment exists, from PTR records and such, but some users need to manage such details manually. For more information, the full initscripts documentation files may be listed thus:<\/p>\n<p>rpm -qd initscripts<br \/>\neven in a environment lacking the man manual reading package and its dependencies.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Depois de muito quebrar a cabe\u00e7a com a nova forma de nomear placas de redes no CentOS7 consegui uma solu\u00e7\u00e3o. Para trocar o nome para eth0, eth2, etc: [root@eSuareznotes01 ~]# ip addr show 1: lo: mtu 65536 qdisc noqueue state UNKNOWN link\/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts\/838"}],"collection":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=838"}],"version-history":[{"count":2,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts\/838\/revisions"}],"predecessor-version":[{"id":842,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts\/838\/revisions\/842"}],"wp:attachment":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=838"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}