在 CentOS 上禁用 NIC

在 CentOS 上禁用 NIC

我有一台运行 CentOS 6.5 的服务器,该服务器有 2 个 NIC,有时当我重新启动以拾取不同的 NIC 时会发生这种情况,我试图完全禁用 eth0 和链接到它的 NIC。

eth0      Link encap:Ethernet  HWaddr 00:07:**:**:**:**  
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
              Interrupt:16 Memory:fd5e0000-fd600000 

eth1      Link encap:Ethernet  HWaddr 00:07:**:**:**:**  
          inet addr:192.168.**.**  Bcast:192.168.**.**  Mask:255.255.***.**
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:35577 errors:20 dropped:0 overruns:0 frame:17
          TX packets:18100 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:41853209 (39.9 MiB)  TX bytes:1568947 (1.4 MiB)
          Interrupt:17 Memory:fdee0000-fdf00000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:240 (240.0 b)  TX bytes:240 (240.0 b)

答案1

编辑 /etc/sysconfig/network-scripts/ifcfg-eth0。更改:

ONBOOT=no

“否”的意思是“该设备不应该在启动时激活。”

供你参考: https://www.centos.org/docs/2/rhl-rg-en-7.2/ch-networkscripts.html

相关内容