我才开始用Vmware学习linux,用的是fedora,每次重启后网卡都需要手动激活,不知道怎么回事?
[root@localhost ~]# ifconfig
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:2564 errors:0 dropped:0 overruns:0 frame:0
TX packets:2564 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:128360 (125.3 KiB) TX bytes:128360 (125.3 KiB)
[root@localhost ~]# ifup eth0
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:15:32:81
inet addr:192.168.88.188 Bcast:192.168.88.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe15:3281/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:32 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3840 (3.7 KiB) TX bytes:2674 (2.6 KiB)
Interrupt:19 Base address:0x2000
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:2564 errors:0 dropped:0 overruns:0 frame:0
TX packets:2564 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:128360 (125.3 KiB) TX bytes:128360 (125.3 KiB)
上网搜了一下,用下面这个方法每次启动后自动使用ifup命令激活网卡。
疑问:难道是所有的linux都这样吗?还是我的问题?
[size=4][/size]
[root@localhost ~]# more /etc/rc.local //我在网上搜到的,把那个ifup命令加了进去
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
ifup eth0
重启后就网卡就自动激活了
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:15:32:81
inet addr:192.168.88.188 Bcast:192.168.88.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe15:3281/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:41 errors:0 dropped:0 overruns:0 frame:0
TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4341 (4.2 KiB) TX bytes:2976 (2.9 KiB)
Interrupt:19 Base address:0x2000
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:2420 errors:0 dropped:0 overruns:0 frame:0
TX packets:2420 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:121160 (118.3 KiB) TX bytes:121160 (118.3 KiB)
comes 于 2011-04-05 17:04:59发表:
你可以设置一个系统文件。就行了。这样开机自动激活的
相思爱文 于 2011-04-04 08:59:51发表:
/etc/rc.local 是启动时自动运行的,(位置不同发行版可能不同),所有的发行版都有rc.local文件,用于手动加载自动运行程序。
关于网卡设置,各发行版都有专用的配置文件,可查看官方文档。
修改rc.local是万能方法,但不是标准方法。简单说,rc.local就是把要手动运行的东东,让系统启动时自动运行。
孙晓 于 2011-03-31 16:17:00发表:
谢谢,你说了我现在知道了