VMware虚构机克隆Linux系统引起的网卡难题,CentOS系统双网卡IP音讯的布局

关于CentOS系统的网卡配置,相信大家都蒙受过,好多时候唯有四个网卡形式,但是不经常大家须要七个网卡的时候,比方配置数据库集群的时候,要求二个扭转IP,大家该怎么铺排呢?上面带着这么些难题,大家来稳步完成双网卡的安排进程。

VMware虚构机克隆Linux系统引起的网卡难点

主题材料现象

用VirtualBox搭建Oracle
12cRAV41的RAC测量试验蒙受,由于在开立虚机的时候只安顿了1块网卡,而后再关机状态下又增添了一块心跳互联网络用的私家网卡,重启linux后,通过system-config-network配置IP地址,在其列表里却无eth1那块网卡的音信,后自个儿到/etc/sysconfig/network-scripts目录里查看,果不其然,该目录下并从未ifcfg-eth1配置。

于是本人想经过copy ifcfg-eth0 复制出一份 ifcfg-eth1的别本出来

[root@ligle2 network-scripts]# cp ifcfg-eth0 ifcfg-eth1

在本人希图修改ifcfg-eth1文件,并替换IP配置新闻时,开掘配置文件里有一条UUID的音讯,见下:

[root@ligle2 network-scripts]# vi ifcfg-eth1
DEVICE=eth0
HWADDR=08:00:27:06:a3:94
TYPE=Ethernet
UUID=9420c638-16e9-41a1-bf59-325c6f601871 ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.0.53
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
IPV6INIT=no
USERCTL=no

一、系统意况:

  1. 手动配置静态网卡地址不奏效
  2. 网卡名改成了eth1
    [root@localhost network-scripts]# ls |grep ifcfg
    ifcfg-eth0
    ifcfg-lo
    [root@localhost network-scripts]# ifconfig
    eth1      Link encap:Ethernet  HWaddr 00:0C:29:3A:8B:02
    inet addr:192.168.1.134  Bcast:192.168.1.255  Mask:255.255.255.0
    inet6 addr: fe80::20c:29ff:fe3a:8b02/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    RX packets:5154 errors:0 dropped:0 overruns:0 frame:0
    TX packets:299 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:529420 (517.0 KiB)  TX bytes:32319 (31.5 KiB)
    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:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
    [root@localhost network-scripts]# vim ifcfg-eth0

标题浅析

轮换配置文件内的IP地址和MAC音讯都比较轻巧,独一就是网卡的UUID怎么样显明呢?

1、CentOS:32位6.3版本;

DEVICE=eth0
HWADDR=00:0C:29:52:39:18
TYPE=Ethernet
UUID=d12572cd-6808-4cae-b7b6-5480982206e8
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.1.119
NETMASK=255.255.255.0
GATEWAY=192.168.1.1

标题一蹴而就

在Linux或CentOS中,能够通过如下命令获取网卡的uuid消息:

[root@ligle2 ~]# uuidgen eth1
07d07031-eb0f-4691-8606-befb46645433

得到到eth1网卡的uuid,就能够达成对ifcfg-eth1配置文件的更动,最后经过service
network restart命令重启网卡,OK。

[root@ligle2 network-scripts]# ifconfig

eth0      Link encap:Ethernet  HWaddr 08:00:27:06:A3:94
inet addr:192.168.0.53  Bcast:192.168.0.255  Mask:255.255.255.0
VMware虚构机克隆Linux系统引起的网卡难题,CentOS系统双网卡IP音讯的布局。inet6 addr: fe80::a00:27ff:fe06:a394/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:723 errors:0 dropped:0 overruns:0 frame:0
TX packets:385 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:78659 (76.8 KiB)  TX bytes:66909 (65.3 KiB)
eth1      Link encap:Ethernet  HWaddr 08:00:27:54:F2:E0
inet addr:10.10.1.2  Bcast:10.255.255.255  Mask:255.0.0.0
inet6 addr: fe80::a00:27ff:fe54:f2e0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:65 errors:0 dropped:0 overruns:0 frame:0
TX packets:96 errors:0 dropped:0 overruns:0 carrier:0
美高梅开户网址,collisions:0 txqueuelen:1000
RX bytes:20820 (20.3 KiB)  TX bytes:30684 (29.9 KiB)
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:65536  Metric:1
RX packets:212 errors:0 dropped:0 overruns:0 frame:0
TX packets:212 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:15232 (14.8 KiB)  TX bytes:15232 (14.8 KiB)

2、虚拟机:VMware® Workstation 9.0.0 build-812388;

手动设置静态ip地址和网关后,保存退出;然后重启互连网后出现错误
[root@localhost network-scripts]# service network restart
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Error: No suitable device found: no device
found for connection ‘System eth0’.
[FAILED]
[root@localhost network-scripts]#

二、配置进程:

英汉互译
No suitable device found: no device found for connection ‘System
eth0’.
从未有过找到适当的设施:没有找到设备连接的体系eth0”。
 
小结了以下解决方案
 
更改ifconfig展现的eth1网卡名叫eth0,并设置static ip地址
 
编辑/etc/udev/rules.d/70-persistent-net.rules文件,把NAME=”eth0″的那行配置注释掉大概删掉,把NAME=”eth1″的修改成NAME=”eth0″,修改后如下:
[root@localhost network-scripts]# vim
/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:0x100f (e1000)
#SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”,
ATTR{address}==”00:0c:29:52:39:18″, ATTR{type}==”1″, KERNEL==”eth*”,
NAME=”eth0″
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”,
ATTR{address}==”00:0c:29:3a:8b:02″, ATTR{type}==”1″, KERNEL==”eth*”,
NAME=”eth0″

1、查看网卡配置:

查看以下消息
[root@localhost network-scripts]# ls |grep ifcfg-
ifcfg-eth0
ifcfg-lo
[root@localhost network-scripts]# vim ifcfg-eth0
DEVICE=eth0
HWADDR=00:0c:29:3a:8b:02
TYPE=Ethernet
UUID=d12572cd-6808-4cae-b7b6-5480982206e8
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.1.119
NETMASK=255.255.255.0
GATEWAY=192.168.1.1

[root@localhost ~]# ifconfig -a

重启运维网卡服务
[root@localhost network-scripts]# service network restart
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Active connection state: activating
Active connection path:
/org/freedesktop/NetworkManager/ActiveConnection/2
state: activated
Connection activated
[  OK  ]
[root@localhost network-scripts]# ifconfig
eth1      Link encap:Ethernet  HWaddr 00:0C:29:3A:8B:02
inet addr:192.168.1.119  Bcast:192.168.1.255  Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe3a:8b02/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:3833 errors:0 dropped:0 overruns:0 frame:0
TX packets:273 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:380984 (372.0 KiB)  TX bytes:45223 (44.1 KiB)
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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

突显结果:

美高梅开户网址 1

eth0      Link encap:Ethernet  HWaddr 00:0C:29:E6:68:51 
          inet addr:192.168.31.132  Bcast:192.168.31.255 
Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fee6:6851/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:98 errors:0 dropped:0 overruns:0 frame:0
          TX packets:119 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:21284 (20.7 KiB)  TX bytes:15269 (14.9 KiB)
          Interrupt:19 Base address:0x2024

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:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:960 (960.0 b)  TX bytes:960 (960.0 b)

2、Linux与Unix系统的上上下下安插都以在文书中贯彻的,那么我们来探视Centos系统的网卡及IP配置是如何兑现的,张开/etc/sysconfig/network-scripts目录:

[root@localhost ~]# cd /etc/sysconfig/network-scripts

[root@localhost network-scripts]# ls -ls

-rw-r–r–. 1 root root  287 Mar  6 19:04 ifcfg-eth0

通过ls -ls
命令能够看出有一个ifcfg-eth0的文书,那即是大家要找的互连网IP配置文件。那么我们看看当中皆某些什么内容?

[root@localhost network-scripts]# more ifcfg-eth0

DEVICE=”eth0″
#BOOTPROTO=”dhcp”
BOOTPROTO=”static”
HWADDR=”00:0C:29:E6:68:51″
#IPV6INIT=”yes”
IPV6INIT=”no”
IPADDR=”192.168.31.132″
NM_CONTROLLED=”yes”
ONBOOT=”yes”
TYPE=”Ethernet”
UUID=”5ea8127a-4031-4d99-9adf-f810ed05a215″
DNS1=192.168.31.2

#DEVICE=eth0
#BOOTPROTO=dhcp
#ONBOOT=yes

在文件中,大家来看了ifconfig命令推行所见到的网卡的驱动、IP地址、以致DNS服务器等的配置音信,当然那是作者原先布署好的文件。那么我们仍是能够不能够配置一个近乎那样的网络IP的布置呢?答案是显明的,那么该怎么布署呢?请王往下走:

3、配置虚构机的网络适配器:

A:虚构机的美食做法:VM–>Setting……,展开虚构机的设置分界面,如图所示:

美高梅开户网址 2

B:选用“Add”开关,在弹出的对话框中甄选“Network Adapter”选项,如图所示:

美高梅开户网址 3

C:点击“Next”开关,在弹出的对话框中精选“Bridged”选项,如图所示:

美高梅开户网址 4

D:点击“Finish”开关,回到主分界面,就能够看见大家新建的网卡适配器“Network
Adapter 2”。

美高梅开户网址 5

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图