Networking
CentOS:eth0 未在啟動時啟動
每當我重新啟動 CentOS Hyper-V 虛擬機時,
eth0
它都不會自動啟動。我需要做的就是執行ifup eth0
並且一切都已修復,但這在 ssh 中是不可行的!我從執行級別 3 開始。[root@localhost ~]# cat /etc/*release* CentOS release 6.2 (Final)
在我
ifup eth0
在控制台上執行之後:[root@localhost ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:15:5D:2B:2B:07 inet addr:10.10.0.3 Bcast:10.10.0.255 Mask:255.255.255.0 inet6 addr: fe80::215:5dff:fe2b:2b07/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:34 errors:0 dropped:0 overruns:0 frame:0 TX packets:49 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:4656 (4.5 KiB) TX bytes:6399 (6.2 KiB) Interrupt:9 Base address:0xa000
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none IPADDR=10.10.0.3 NETMASK=255.255.255.0 GATEWAY=10.10.0.1 USERCTL=no ONBOOT=yes
[root@localhost ~]# chkconfig --list | grep network network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
嘗試關閉網路管理器後
[root@localhost ~]# chkconfig NetworkManager off error reading information on service NetworkManager: No such file or directory [root@localhost ~]# service NetworkManager status NetworkManager: unrecognized service
最近的干淨啟動
[root@localhost ~]# grep eth0 /var/log/messages Jul 7 02:12:44 localhost kernel: eth0: Digital DS21140 Tulip rev 32 at MMIO 0xfebff000, 00:15:5d:2b:2b:07, IRQ 9. Jul 7 02:13:15 localhost kernel: eth0: Using EEPROM-set media 100baseTx-FDX. [root@localhost ~]# dmesg | grep eth0 eth0: Digital DS21140 Tulip rev 32 at MMIO 0xfebff000, 00:15:5d:2b:2b:07, IRQ 9. eth0: Using EEPROM-set media 100baseTx-FDX. eth0: no IPv6 routers present
我見過的唯一問題是,當我執行命令時
ifup eth0
出現以下錯誤,但eth0
仍然開始:[root@localhost ~]# ifup eth0 /etc/sysconfig/network-scripts/ifup-ipv6: line 56: /etc/sysconfig/network: No such file or directory /etc/sysconfig/network-scripts/ifup-aliases: line 125: /etc/sysconfig/network: No such file or directory
唔。從您的最後一條消息中,查找該
/etc/sysconfig/network
文件。我有:
$ cat /etc/sysconfig/network NETWORKING=yes
你也可以擁有(在我的 CentOS 5 機器上):
NETWORKING=yes HOSTNAME=foo.example.org GATEWAY=192.168.1.1
文件在這裡(至少 5 個,應該非常相似)
我不確定“網路”設置的預設值是什麼。可能它是“否”,這就是為什麼它沒有在啟動時啟動。
打開
/etc/sysconfig/network-scripts/ifcfg-eth0
文件並替換行ONBOOT=no
和
ONBOOT=yes
保存退出文件,重啟linux系統。