热门标签 | HotTags
当前位置:  开发笔记 > IOS > 正文

VMware下CentOS6.4网卡设置为桥接模式静态IP配置方法详解

1、禁用网络管理器chkconfigNetworkManageroffserviceNetworkManagerstop2、创建用以桥接的虚拟网卡cdetcsysconfignetwork-scriptscpifcfg-eth0ifcfg-br03、编辑ifcf

1、禁用网络管理器

# chkconfig NetworkManager off
# service  NetworkManager stop

2、创建用以桥接的虚拟网卡

# cd /etc/sysconfig/network-scripts 

# cp ifcfg-eth0 ifcfg-br0
3、编辑 ifcfg-br0
# vi ifcfg-br0 

DEVICE="br0"
TYPE="Bridge"
OnBOOT="yes"
BOOTPROTO=static
IPADDR=192.168.1.17
PREFIX=24
GATEWAY=192.168.1.1
DNS1=202.106.46.151
DNS2=202.106.0.20

DELAY=0 
注意:最好切换到root帐户操作,否则保存时可能会提示:E45: 'readonly' option is set (add ! to override)

4、编辑ifcfg-eth0

# vi ifcfg-eth0 

DEVICE="eth0"
NM_COnTROLLED="yes"
OnBOOT=yes
TYPE=Ethernet
BRIDGE="br0"
BOOTPROTO=none
IPADDR=192.168.1.17
PREFIX=24
GATEWAY=192.168.1.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
DNS1=202.106.46.151
DNS2=202.106.0.20
HWADDR=00:1E:67:07:EC:30 
IPADDR:和你的电脑同一网段的IP地址
GATEWAY:与你的电脑的默认网关相同

5、重新启动网络

# service network restart
6、可能提示以下错误

Bringing up interface eth0: Device eth0 does not seem to be present,delaying initialization. [FAILED]

\

解决办法:

首先,打开/etc/udev/rules.d/70-persistent-net.rules内容如下面例子所示:

# 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)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:8f:89:9
7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:50:bd:1
7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
记录下,eth1网卡的mac地址00:0c:29:50:bd:17
接下来,打开/etc/sysconfig/network-scripts/ifcfg-eth0

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

将 DEVICE="eth0" 改成 DEVICE="eth1" ,
将 HWADDR="00:0c:29:8f:89:97" 改成上面的mac地址 HWADDR="00:0c:29:50:bd:17"

最后,重启网络

# service network restart
或者

# /etc/init.d/network restart

正常了。


推荐阅读
author-avatar
堕落戥囝_631
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有