Oracle Labs by Yuri Khazin, Oracle DBA

April 14, 2016

RHEL 6.7, OEL 6.7 network adapters configuration and VM cloning


Cloning of a virtual machine in Oracle’s VB (Virtual Box) presents a particular pain. The exact clone, of course, is created with same MAC and IP addresses for all NICs present. Great for some purposes, not so great if you wanted a duplicate to repurpose. Then you would have reinitialized MACs during or after cloning and your trouble would start as all NICs in the clone won’t be functional upon power up. In older Linux distribution all you had to do is edit MAC addresses in the ifcfg-eth* files in /etc/sysconfig/network-scripts and that was it. Not so now.

In Linux 6 (Red Hat, Fedora, Centos) the hardware device control is primarily done by udev system and by NetworkManager service. This is an out of the box configuration. In the following exercise we will look at a case of a virtualized OEL 6.7 Server, which is a non-GUI Oracle’s package based on RHEL 6.7

Why Server edition? Because it is a headless, non-GUI distro, where all management needs to be done via command line and not through the nice desktop tools.

As stated above, in Linux 6 the udev system looks after changes in hardware and enumerates new NICs while preserving the old NIC records. Both parts are now present in this file: /etc/udev/rules.d/70-persistent-net.rules

Therefore, your /etc/sysconfig/network-scripts/ifcfg-eth* files are now not in sync with persistent rules. We will look at how they should be reconciled.

A few additional notes:

  • In my practice with OEL 6.7 the system-config-network-tui tool had no effect on configuration so I don’t recommend using it
  • Don’t just edit /etc/sysconfig/network-scripts/ifcfg-eth* files after cloning, read this article to the end to understand why you need to examine and change the udev part
  • OEL 6.7 Server (and probably Red Hat, Centos and Fedora distros) come with sshd server preconfigured with some annoying security features that make ssh login very slow. If you went through this article and still have issues logging into your machine you may need to read this guide about “Fixing SSH login long delay”

So, let’s start:

On original machine our network configuration is as follows:

eth0 is an adapter with static IP connected to host-only network

eth1 is an adapter with DHCP connected to NAT network

Both are running

Following are their respective config files

[root@oms1 network-scripts]# cat ifcfg-eth0
DEVICE=eth0BOOTPROTO=none

ONBOOT=yes

IPADDR=20.20.10.21

NETMASK=255.255.255.0

[root@oms1 network-scripts]# cat ifcfg-eth1
DEVICE=eth1HWADDR=08:00:27:F9:3C:34

TYPE=Ethernet

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=dhcp

Notice, that although ifcfg-eth1 contains HWADDR keyword it is not required and can be removed when udev is allowed to manage the hardware.

Below is the contents of persistent rules (before cloning). Sometimes after cloning, the order of devices may be mixed up, so pay close attention to MAC addresses and then assign the desired names in proper order.

/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}==”08:00:27:7d:f0:88″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

# PCI device 0x8086:0x100e (e1000)

SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”08:00:27:f9:3c:34″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1″

After cloning with MAC address re-initialized the machine comes up like this (new NICs detected but since there are no matching ifcfg-eth* files the NICs are inactive):

Old NICs are eth0 and eth1, the new ones are eth2 and eth3

Delete old NICs:

Rename the ordering of NICs:

Make sure ifcfg* files match (optionally change the static IP)

Make sure original machine is NOT online as the clone will try to come up with same static IP. Reboot the clone machine (necessary, because of change to persistent rules)

After reboot of the clone:

If you want to change the static IP you can do it in ifcfg-eth0 and then restart networks

service network restart

Acknowledgements and references:

March 13, 2013

Oracle Virtual Server (Oracle VM, OVM) inside Virtual Box


As if Oracle Virtual Box was not virtual enough, now you can put one dream into another dream, just like in my favorite movie Inception.

Get this, you can run Oracle Virtual Server (other names: Oracle VM, OVM) inside Virtual Box. Wrap you mind around that…

Now, for confused, Oracle VM Server is a product separate from Virtual Box and comes with it’s own history. As far as I know, Oracle VM Server is a Xen Linux based software that is not hosted, i.e. installs onto a bare metal hardware. Virtual Box, in turn, is hosted and can run within almost any known operating system. Virtual Box was not always Oracle’s product and not even Sun’s, it was originally developed by Innotek.

So… if you wanted to test drive a VM Server farm but don’t have some 4-5 physical servers lying around, you can still do so if you put it all in Virtual Box environment.

Oracle provides VirtualBox Templates for Oracle VM Manager and Oracle VM Server. From these templates you can create actual guests in Vritual Box. (Once again, this is not an installation media for physical servers but VM templates. If you are after that sort of media, you need to go to Oracle Software Delivery Cloud – Oracle Linux and Oracle VM).

To run this virtual farm you will need a lot of RAM on a single machine or, even better, run this setup on two machines. One PC can run the VM Manager and another will run one or two VM Servers. So much fun with the networking!

Follow the instructions on the download page, they are quite thorough. The only trouble I have had with version OVM 3.1.1  template (build 365) was that VM Manager comes with Oracle Express Edition 11g as an internal repository and it won’t start after guest starts for the first time. Turns out, there is a MEMORY_TARGET parameter in spfileXE.ora that is set to about 1GB and there was not enough free memory. Once this parameter was removed the database started and all works like a charm after guest reboot. I run this guest with 1.6GB RAM and the VM Servers needs 4GB at least (starts with 3GB but not sure if it works well). Honestly, I have not tried to create a guest inside VM Server yet, but I suspect I may need much more RAM for that (notice to self, update this post when I try).

One more thing. VM Manager is a browser based control interface for OVM, you can run it within your guest machine but it is better to do so from your PC. In that case you will need to check that firewall is turned off in the VM Manager guest (service iptables stop, then set it in chkconfig so it will stay stopped after reboot). Check firewall on your PC as well. Direct your browser to the guest IP address and appropriate port. If you somehow happened to install OVM 3.2.1, notice that http is now replaced by https and default port is not 7001 but 7002.

Good luck on your test drive.

OEL 6.2 on Virtual Box 4.2.4

Filed under: Oracle VirtualBox, Virtualization, Windows 7 — Tags: , , — oraclelabs @ 10:28

I was installing “Oracle Linux Release 6 Update 2 Media Pack v1 for x86_64 (64 bit)” on VBox 4.2.4 the other day. It was on Windows 7 Home Premium SP1, the RAM given to the guest was set to 2GB (quite generous). The installation of “basic” server went well and by the end of it the guest wanted to reboot. This is when the dreaded message “Virtualbox Manager has stopped working” appeared. A research on forums was educational, but useless, as a wide variety of causes may be in play. Tried this and that, upgraded first to VBox 4.2.6, then to 4.2.8 with no luck. Then, remembering that this Linux version used to work well on older VBox I have downgraded to 4.1.22 and recreated host only networks (those were deleted during the reinstall). Guess what? All works fine now. Maybe in later versions of 4.2.x this problem will be resolved.

Blog at WordPress.com.