CentOS 70-persistent-net.rules will not regenerate - linux

I am running CentOS 5.5 as VirtualBox guest on a Win 7 host.
It is a common problem in the forums that moving images across VMs encounters networking issues due to the MAC address persistence in /etc/udev/rules.d/70-persistent-net.rules. A solution typically proposed is to delete this file and reboot for it to be automatically regenerated.
In my case however, I cannot get the file to regenerate, despite multiple reboots with different VM network interface options. I became fairly hopeful when introduced to udevadm on an Ubuntu forum but could not find an equivalent for CentOS.
Specifying the new MAC address in /etc/sysconfig/network-scripts/ifcfg-eth0 has not helped, and neither has playing around with different network configurations in the manager.
Any pointers/assistance much appreciated.

I'm not a Centos expert, but know why this doesn't work in Ubuntu and a couple of other distributions. Have a read of the file which generates it which is normally /lib/udev/rules.d/75-persistent-net-generator.rules.
You will note that it will skip various types of ethernet interface, depending on MAC address and subsystem (i.e. where the interface comes from). Here's one from a RHEL like distro that skips Xen:
# ignore Xen virtual interfaces
SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end"
Here are some from Ubuntu that skip other hypervisors:
# ignore KVM virtual interfaces
ENV{MATCHADDR}=="52:54:00:*", GOTO="persistent_net_generator_end"
# ignore VMWare virtual interfaces
ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end"
# ignore Hyper-V virtual interfaces
ENV{MATCHADDR}=="00:15:5d:*", GOTO="persistent_net_generator_end"
# ignore Eucalyptus virtual interfaces
ENV{MATCHADDR}=="d0:0d:*", GOTO="persistent_net_generator_end"
# ignore Ravello Systems virtual interfaces
ENV{MATCHADDR}=="2c:c2:60:*", GOTO="persistent_net_generator_end"
As you can see, your distro is probably skipping the generation of net rules on VM interfaces, precisely because its normally annoying. For instance if you take a templated VM image with this file in, and rehydrate it elsewhere and it gets a different MAC, you don't normally want your eth0 to disappear and you to get a new eth1 instead. If you don't like this, you can introduce your own rules.d file to handle the persistent rules generation.

Related

Virtual box based development for Embedded Linux

I am new to embedded linux development.I have inherited a particular way of Embedded linux development from the previous developer.
I was just wondering if there is a more industry standard way of working.
This is how he was working,
There is an ARM embedded linux board which is not on the corporate network and has a fixed IP address of 192.168.0.52.I have a virtualbox based linux host which is connected directly to this linux board via an Ethernet cable.This host has an NFS shared with the target for running the cross compiled binaries.I have to set a fixed IP address for the host of 192.168.0.50.Then I can telnet with the target to run the compiled binaries on the NFS folder. Also as the VM host is not connected to the corporate network.I cannot use the company issued SVN for version control.So what I do is have a shared folder via virtual box between Windows and Linux host and I manually keep transferring the files which I have to commit/test.
What I would I ideally like, is both networks connected to the corporate network,so that I can update the OS,use version control.Is there way by which the VM on Windows access the corporate network and also be connected to the target.IT is not willing to give a static IP to the target.If we connect the target via DHCP what is the best way to discover it on the network.Also IT is concerned about the traffic it will generate.Can I use a switch to create a subnetwork,so that the target can have a fixed address?
Another question is they are open to a linux based host as well.Is a VM based linux any worse off than a Linux PC.The only problem I have been having are networking based issues,not really Virtualbox issues.But I am curious to know if there are any limitations at all.
In order to have the VM connected to the corporate network, you can setup the VM network adapter in bridge mode.
In order to discover the embedded device, you can use the arp command (for instance: arm -i eth0 -a).
If you have got two network interfaces you could also connect the remote device directly through this interface and setup a dhcp server in your VM.
Personally, I think that with the VM you can do everything that you need (cross-compiling the Kernel and bootloader and creating the remote File System). I have been using a VM for embedded linux development on a AT91SAM board without problems at all.

Access files on Linux mint VirtualBox guest

I have a Linux virtualbox that I use for development. The stuff I'd like to share to the host operating system resides in /var/www. I tried setting up a samba share, but I can't seem to see my virtualbox on the network. Does anyone know how I'd go about doing this? I searched, but the only thing I've found is virtualbox's shared folders which isn't quite what I'm looking for.
By default VirtualBox networking defaults to an internal NAT implementation, which only allows the guest to access the network and not the other way around.
To access the guest from the host you have to use a different networking mode.
My preferred solution is host-only networking, because the guest appears as a proper networked-machine on the host, without being exposed to the public network.
Bridged networking would also do, but you'd have to secure the guest as if it was a separate machine and there may be networks where having two MAC addresses for a single physical PC is not advised or even allowed.
Why aren't shared folders what you are looking for, anyway?

OS reload on a remote linux machine

If we need to do OS reload on a remote machine, how can the network boot be enabled on the client machine without making any changes in the BIOS ??
I am in a try to develop a control panel, in which this feature is included. i.e., fully automated OS reload and thinking of using the pxe boot. But enabling and disabling boot from network is a problem. Any work around, please ?
Hacker approach: Use the bootloader to load GPXE from the harddisk.
You'll need a version that fits to your NIC: Images for many hardware types and booting methods can be generated at ROM-o-matic. Use the PCI ID from the NIC to programmatically select the version that fits best. People may also have add-on network cards, e.g. for gigabit LAN.
This way you don't need to fiddle with the mainboard and network card specific ways to turn PXE on.
First, since your question is not programming related, I suggest you pose it again on the sister site serverfault.com. You might get more/better answers there.
Second, I do not think you will be able to remotely activate PXE on arbitrary machines. Maybe this works when you have Intel's AMT (Active Management Technology) on those machines, but then you already have BIOS access. But nevertheless you could activate PXE boot on all machines and from your PXE server, selectively offer boot images only to those machines you want to. All other machines would then just boot the installed OS. The FAI (Fully Automatic Install) system uses that approach, but is Linux only, AFAIK.
I agree with Dubu that reliable enable/disable of PXE boot in the BIOS across heterogeneous target hardware is not readily achievable. The better suggestion is to configure all your target machines to include PXE prior to local disk in their configured boot order always. You can PXE boot to something like PXELINUX and have the default choice be a local disk boot. Then you can selectively target particular machines to PXE boot into a network loaded OS (for OS reinstallation purposes) by configuring symlinks with the target machine's MAC address inside the PXELINUX TFTP root.

Figuring out if a server you are connecting to is virtualised?

Is there a way to figure out if a win 2003 server server you are connecting to is virtualised? I tried asking but not 100% sure of the answer is correct.
This is a duplicate of this question: How to identify that you’re running under a VM?.
Quoting from the accepted answer to that question by JawnV6:
The classic trick to detect a VM is to populate the ITLB, run an instruction that must be virtualized (which necessarily clears out such processor state when it gives control to the hypervisor), then run some more code to detect if the ITLB is still populated. The first paper on it is located here, and a rather colorful explanation from a researcher's blog is located here.
I guess looking at the Device Manager (Control Panel | System | Hardware | Device Manager) should give you a good idea.
On one server, running on VMWare ESX, I see the following tell-tale signs of a virtual machine:
System Devices: VMware server memory controller
Network adapters: VMware Accelerated AMD PCNet Adapter
Mice: VMware Pointing Device
Disk drives: VMware Virtual disk SCSI Disk Device
A simple test that detects a VMware network adapter, is:
ipconfig /all | grep "VMware Accelerated"
(would perhaps also detect a host running VMware workstation)
Here's a decent explanation. You can check the manufacturer of a piece of hardware from WMI or within Device Manager to determine if it's a physical device or not.
http://blogs.msdn.com/virtual_pc_guy/archive/2005/10/27/484479.aspx
Can you tell us any more about how you're connecting to this server?
This depends on a couple of factors.
Are you using remote desktop to connect to the server and can you gain access to system files and folders?
Do you know what type of virtualization software is running the server?
Without know that information this question may be a litle difficult to answer correctly. There are a large number of virtualization software vendors and each of them have different setups that are in the virtual servers.
Without more information, the short answer is no. To the actual guest operating system it looks and acts like an operating system that is running on bare metal.
You could look for support software installed, for instance VMware usually installs VMware Tools on the guest operating system.

VMWare Server Under Linux Secondary NIC connection

With VMWare Server running under Linux (Debain), I would like to have the following setup:
1st: NIC being used by many of the
images running under VMWare, as well
as being used by the Linux OS
2nd: NIC being used by only 1 image and to be unused by the Linux OS (as its part of a DMZ)
Although the second NIC won't be used by Linux, it is certainly recognised as a NIC (e.g. eth1).
Is this possible under VMWare Server, and if so, is it as simple as not binding eth1 under Linux and then bridging it to the image under VMWare Server?
I believe you can set the desired solution up by rerunning the vmware configuration script. And doing a custom network setup, so that both NIC's are mapped to your vmware instance. I would recommend making eth0 the 2nd NIC since it will be easier for Linux to use by default. Then make eth1 the 1st NIC.

Resources