Network config module won't work. -Mac address errors

149 views
Skip to first unread message

Luke

unread,
Dec 20, 2011, 3:41:34 PM12/20/11
to Puppet Users
Hello,

I created a module for modifying the base network settings on a
machine. However no matter what changes I make it keeps giving me the
error "has different MAC address than expected, ignoring" when the
network tries to startup.

I am testing this out on the puppet learning VM.

Does anyone see anything wrong with my code:

init.pp

--------------------------


define basehost ($ipaddress, $gateway, $hostname, $environ,
$macaddress) {


file { 'hosts':
path => '/etc/hosts',
ensure => 'present',
owner => 'root',
group => 'root',
mode => '644',
content => template("basehost/hosts.erb"),
notify => Service[network],

}

file { 'resolv.conf':
path => '/etc/resolv.conf',
ensure => 'present',
owner => 'root',
group => 'root',
mode => '644',
content => template("basehost/resolv.conf.erb"),
notify => Service[network],

}


file { 'network':
path => '/etc/sysconfig/network',
ensure => 'present',
owner => 'root',
group => 'root',
mode => '644',
content => template("basehost/network.erb"),
notify => Service[network],

}

file { 'ifcfg-eth0':
path => '/etc/sysconfig/network-scripts/ifcfg-eth0',
ensure => 'present',
owner => 'root',
group => 'root',
mode => '644',
content => template("basehost/ifcfg-eth0.erb"),
notify => Service[network],

}

service { network:
ensure => "running",
hasstatus => "true",
hasrestart => "true",
restart => "/etc/init.d/network restart",
}

}


hosts.erb
----------------------------

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
<%= ipaddress %> <%= hostname %> <%= hostname %>.<%= environ
%>.mydomain.local manage.<%= environ %>.mydomain.net
::1 localhost6.localdomain6 localhost6

resolve.conf.erb
----------------

search <%= environ %>.mydomain.local
nameserver 10.180.0.2
nameserver 10.180.0.4

network.erb

------------------


NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=<%= hostname %>.<%= environ %>.mydomain.local
GATEWAY=<%= gateway %>

ifcfg-eth0.erb

----------------

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
IPADDR=<%= ipaddress %>
NETMASK=255.255.255.0
ONBOOT=yes
HWADDR=<%= macaddress %>

Gets kicked off using:

basehost {'basehostsetup':
ipaddress => '10.148.0.32',
gateway => '10.148.0.1',
hostname => 'myhostname',
environ => 'test',
macaddress => '00:50:56:ac:40:8a',
}

Charles Buckley

unread,
Dec 20, 2011, 3:46:01 PM12/20/11
to puppet...@googlegroups.com

Hello,

  What are the VM's definitions of its network interfaces?

  Also, if you are trying Linux, what are the contents of /etc/udev/rules.d/70-persistent-net.rules ?


Charles Buckley


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.


Luke

unread,
Dec 21, 2011, 10:05:17 AM12/21/11
to Puppet Users
Hello Thank you for your reply.

I don't seem to have a 70-persistent-net.rules. I have a 60-net.rules
with

ACTION=="add", SUBSYSTEM=="net", IMPORT{program}="/lib/udev/
rename_device"
SUBSYSTEM=="net", RUN+="/etc/sysconfig/network-scripts/net.hotplug"

What do you mean by VM definition. I made sure that it was in the
right vlan etc. One thing that I noticed is that the puppet learning
VM is set to flexible while the rest of them are set to E1000.

Charles Buckley

unread,
Dec 21, 2011, 11:03:03 AM12/21/11
to puppet...@googlegroups.com

Hello,

  That is not quite what I am asking. Your VM configures a set of parameters for the
system to use when you build out the VM environment. One of those values is that
macaddr of the server. (Not just the driver).

  These settings look to all be on the VM guest. The host table. resolv.conf.

  What I am trying to determine is why you are feeding it a macaddr, at all. If you
were creating the VM guest, I could see feeding it a macaddr. But, here you are trying
to change the macaddr of an existing guest. (basically, if you bring up the VM
network properties, you will likely find that the macaddr below is different than the
one the VM host has in the guest properties.)

  Where did you acquire the macaddr below to use for this?

Charles Buckley

Luke

unread,
Dec 21, 2011, 3:30:19 PM12/21/11
to Puppet Users
Hi,

The macaddress in the vm is set to automatic but the populated value
matches exactly the value that I put into the file, that is where I
got it from (in fact I checked the ifconfig-eth0 before creating the
file and it had the same values that I specified).

On Dec 21, 12:03 pm, Charles Buckley <rijrun...@gmail.com> wrote:
> Hello,
>

Luke

unread,
Dec 22, 2011, 2:21:14 PM12/22/11
to Puppet Users
I mean does the code look ok?

Are we thinking that it is a prob with the vm config on the esx side?

Luke

unread,
Jan 17, 2012, 8:35:26 AM1/17/12
to Puppet Users
The code appears to be fine. The issue is with VMware it doesn't like
me replacing the network config files but if I manually edit them it
seems to be fine. Is it possible to have puppet just edit the contents
of files instead of completely replacing them? Does anyone else have
problems with file replacement messing with things?
> > > > > > error "has differentMACaddressthan expected, ignoring" when the

Ger Apeldoorn

unread,
Jan 19, 2012, 9:38:53 AM1/19/12
to puppet...@googlegroups.com
If you omit the macaddress in the ifcfg-eth0 file, it should work properly if there are no persistent network configs.

On Redhat, the 70-persistent-net.rules assigns a specific ethx device to a specific nic. Your 'ignoring' messages strongly point in the direction of such a mechanism.

So if you have a template with a macaddress, the 70-persistent-net.rules file always assigns eth0 to it. The nic in the cloned machine (with a new mac) will be named eth1.

I do not use puppet to configure the network, but made a script that combines a few parts of PE and configures the network too.

(See http://www.gerapeldoorn.nl/freelance/linux-automation for the script..)

Regards,
Ger.

Luke

unread,
Feb 2, 2012, 3:10:24 PM2/2/12
to Puppet Users
Thanks for your help.

I removed the mac. The issue actually turned out to be I needed to do
a dos2unix on my template files :{
Reply all
Reply to author
Forward
0 new messages