centos6.4静态ip设置于eth1的问题

星期五, 2013-09-06 | Author: Lee | linux | 6,468 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 安装)
~

Tags: , ,

文章作者: Lee

本文地址: https://www.pomelolee.com/1241.html

除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址

一条评论 to centos6.4静态ip设置于eth1的问题

Lee
2014 年 08 月 12 日

设置 ONBOOT=yes
即可自动获得对应的ip地址,实现上网功能,如果不设置静态IP的话

Leave a comment

Search

文章分类

Links

Meta