星期五, 2013-09-06 | Author:
LeeAuthor: Lee
Name: lee
Email: service@i5a6.com
Site: https://www.pomelolee.com/About: webgame网页,手机游戏服务端架构和开发者
| linux |
5,483 views
centos6.4的版本安装好,发现系统内只有eth1,而且/etc/sysconfig/network-scripts/下只有ifcfg-eth0文件,虽然可以上网,但无法设置静态IP.
解决方法: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 0x8086:0x100e (e1000)
#SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”08:00:27:f2:31:9b”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″
# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”08:00:27:9d:08:ba“, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1”
上面一个eth0直接注释掉,下面一个eth1改为eth0,记录对应的网卡地址 再编辑ifcfg-eth0 如下
DEVICE=eth0
HWADDR=08:00:27:9D:08:BA
#UUID=accb31df-ac8b-474c-aad8-b1ecd68ad346
NM_CONTROLLED=yes
#BOOTPROTO=dhcp
BOOTPROTO=static
IPADDR=192.168.0.188
GATEWAY=192.168.0.1
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
DNS1=192.168.0.1
~
网关设置 (上面配置了这里路不用)
在文件vi /etc/sysconfig/network最后一行加入:
GATEWAY=192.168.0.1
/etc/init.d/network restart 重启网络
注:后面要加下DNS1 否则无法上网(oracle VM 安装)
~
~谢谢打赏~
赏