Gentoo64在net文件中配置好eth0的静态IP
代码 1.2: /etc/conf.d/net文件的一个示例 |
# DHCP config_eth0=( "dhcp" ) # 使用CIDR形式表示的静态IP config_eth0=( "192.168.0.7/24" ) routes_eth0=( "default via 192.168.0.1" ) # 使用netmask形式表示的静态IP config_eth0=( "192.168.0.7 netmask 255.255.255.0" ) routes_eth0=( "default via 192.168.0.1" ) |
配置之后,ifconfig eth0 up选项失败,无法启动eth0,出现找不到eth0设备。
在/sys/class/net找不到eth0设备。
原因:
虚拟机在之前有一个MAC地址,拷贝之后又有了一个MAC地址,造成MAC地址冲突,eth0所对应的MAC地址是无效地址。
解决办法:
[root@localhost ~]# vi /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x1022:0x2000 (pcnet32) (custom name provided by external tool)
# SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:50:52:46", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:46:6f:cd", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
将后边有正确MAC地址的eth1改为eth0就行了。
上述是个人在配置Gentoo64时候遇到的问题,Gentoo64的详细配置见:http://www.gentoo.org/doc/zh_cn/handbook/2008.0/handbook-x86.xml?style=printable&full=1#book_part4