dhcpd.conf logging options?

142 views
Skip to first unread message

Enrique Flores

unread,
Oct 10, 2016, 3:15:25 PM10/10/16
to stacki
is there a way to add dhcpd.conf logging options ? the dhcpd.conf file is generated and if I add something manually, it will get updated on the next sync config. 

this is the version i'm running: 

# rpm -qa | grep -i stack
stack-config-server-3.2-7.x.x86_64
stack-images-3.2-7.x.x86_64
stack-tracker-3.2-7.x.x86_64
stack-admin-3.2-7.x.x86_64
stack-kickstart-3.2-7.x.x86_64
stack-sql-3.2-7.x.noarch
stack-pxeboot-3.2-7.x.x86_64
stack-wizard-3.2-7.x.noarch
stack-config-3.2-7.x.x86_64
stack-pylib-3.2-7.x.noarch
stack-build-3.2-7.x.noarch
stack-command-3.2-7.x.noarch
#
# more /etc/dhcp/dhcpd.conf
#
# WARNING: This file is generated do not edit.
#
# Contents last written on 10/09/16 21:35:57 PM by Stacki.
#

ddns-update-style none;




Thanks
-EHF

Bill Sanders

unread,
Oct 13, 2016, 2:06:17 PM10/13/16
to stacki
Hey Enrique,

Could you be a little more specific about what it is you're looking for?  There's some dhcpd logging done in /var/log/messages.

/etc/dhcpd/dhcpd.conf file is built by 'stack report dhcpd' (which is run anytime you add a host, for example), so if you're wanting to customize the output of that you'll need to at least edit '/opt/stack/lib/python2.6/site-packages/stack/commands/report/dhcpd/__init__.py' (or 'src/stack/command/stack/commands/report/dhcpd/__init__.py' in the source tree).

Adding a particular option line or stanza in that file (probably somewhere after line 100) wouldn't be terribly difficult, if you're at all comfortable with Python.  Modifying the stanza for each host only a bit more so.

Just be sure to test it!

Bill

Enrique Flores

unread,
Oct 13, 2016, 4:47:10 PM10/13/16
to stacki
I would like to add log-facility 
I'll take a look that those python scripts you listed. 

Thanks.
-EHF

Joe Kaiser

unread,
Oct 13, 2016, 5:18:32 PM10/13/16
to sta...@googlegroups.com
My reinstall is working:

This is what I did:

[root@kaiza ~]# stack list host interface backend-0-0
INTERFACE   DEFAULT NETWORK MAC               IP           NAME        MODULE VLAN OPTIONS CHANNEL
em1         True    private c8:1f:66:cb:e7:43 10.1.255.254 backend-0-0 ------ ---- ------- -------
em2         ------- ------- c8:1f:66:cb:e7:44 ------------ backend-0-0 ------ ---- ------- bond0
enp0s29u1u2 ------- ------- 00:06:88:0f:74:d6 ------------ backend-0-0 ------ ---- ------- bond0


[root@kaiza ~]# stack add host bonded backend-0-0 channel=bond0 interfaces=em2,enp0s29u1u2 ip=192.168.2.254 network=external options="mode=1 primary=em2"


This is the result:

[root@kaiza ~]# stack list host interface backend-0-0
INTERFACE   DEFAULT NETWORK  MAC               IP            NAME        MODULE  VLAN OPTIONS                           CHANNEL
bond0       ------- external ----------------- 192.168.2.254 backend-0-0 bonding ---- bonding-opts="mode=1 primary=em2" -------
em1         True    private  c8:1f:66:cb:e7:43 10.1.255.254  backend-0-0 ------- ---- --------------------------------- -------
em2         ------- -------- c8:1f:66:cb:e7:44 ------------- backend-0-0 ------- ---- --------------------------------- bond0
enp0s29u1u2 ------- -------- 00:06:88:0f:74:d6 ------------- backend-0-0 ------- ---- --------------------------------- bond0


This is the report:

[root@kaiza ~]# stack report host interface backend-0-0
<![CDATA[
grep -v "\<bond0\>" /etc/modprobe.conf > /tmp/modprobe.conf
echo 'alias bond0 bonding' >> /tmp/modprobe.conf
mv /tmp/modprobe.conf /etc/modprobe.conf
chmod 444 /etc/modprobe.conf
]]>
<file name="/etc/sysconfig/network-scripts/ifcfg-bond0">
DEVICE=bond0
IPADDR=192.168.2.254
NETMASK=255.255.0.0
BOOTPROTO=static
ONBOOT=yes
BONDING_OPTS="mode=1 primary=em2"
MTU=1500
</file>
<file name="/etc/sysconfig/network-scripts/ifcfg-em1">
DEVICE=em1
HWADDR=c8:1f:66:cb:e7:43
IPADDR=10.1.255.254
NETMASK=255.255.0.0
BOOTPROTO=static
ONBOOT=yes
MTU=1500
</file>
<file name="/etc/sysconfig/network-scripts/ifcfg-em2">
DEVICE=em2
HWADDR=c8:1f:66:cb:e7:44
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
</file>
<file name="/etc/sysconfig/network-scripts/ifcfg-enp0s29u1u2">
DEVICE=enp0s29u1u2
HWADDR=00:06:88:0f:74:d6
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
</file>
<file name="/etc/udev/rules.d/70-persistent-net.rules">
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="None", ATTR{type}=="1", KERNEL=="eth*", NAME="bond0"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="c8:1f:66:cb:e7:43", ATTR{type}=="1", KERNEL=="eth*", NAME="em1"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="c8:1f:66:cb:e7:44", ATTR{type}=="1", KERNEL=="eth*", NAME="em2"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:06:88:0f:74:d6", ATTR{type}=="1", KERNEL=="eth*", NAME="enp0s29u1u2"


</file>


A reinstall sets up the bond:


[root@kaiza ~]# ssh backend-0-0 ifconfig
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>  mtu 1500
        inet 192.168.2.254  netmask 255.255.0.0  broadcast 192.168.255.255
        inet6 fe80::ca1f:66ff:fecb:e744  prefixlen 64  scopeid 0x20<link>
        ether c8:1f:66:cb:e7:44  txqueuelen 0  (Ethernet)
        RX packets 641  bytes 63752 (62.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 96  bytes 10624 (10.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

em1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.1.255.254  netmask 255.255.0.0  broadcast 10.1.255.255
        inet6 fe80::ca1f:66ff:fecb:e743  prefixlen 64  scopeid 0x20<link>
        ether c8:1f:66:cb:e7:43  txqueuelen 1000  (Ethernet)
        RX packets 756  bytes 76426 (74.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 146  bytes 21767 (21.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16

em2: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether c8:1f:66:cb:e7:44  txqueuelen 1000  (Ethernet)
        RX packets 641  bytes 63752 (62.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 96  bytes 10624 (10.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 17

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0



This is what the hostfile looks like. You can always edit a hostfile and reload it to get the same thing that the "stack add host bonded" should give you.

NAME,INTERFACE HOSTNAME,DEFAULT,APPLIANCE,RACK,RANK,IP,MAC,INTERFACE,NETWORK,CHANNEL,OPTIONS,VLAN
kaiza,,True,frontend,0,0,10.1.1.1,18:66:da:66:a1:e3,em1,private,,,
kaiza,,,,,,192.168.2.1,18:66:da:66:a1:e4,em2,external,,,
kaiza,,,,,,10.1.2.1,32:ea:8b:c1:0d:35,tap0,test,,,
kaiza,,,,,,192.168.42.1,0a:00:27:00:00:00,vboxnet0,vbox,,,
kaiza,,,,,,10.1.20.1,0a:00:27:00:00:01,vboxnet1,vbox1,,,
backend-0-0,,,backend,0,0,192.168.2.254,,bond0,external,,"bonding-opts=""mode=1 primary=em2""",
backend-0-0,,True,,,,10.1.255.254,c8:1f:66:cb:e7:43,em1,private,,,
backend-0-0,,,,,,,c8:1f:66:cb:e7:44,em2,,bond0,,
backend-0-0,,,,,,,00:06:88:0f:74:d6,enp0s29u1u2,,bond0,,

Thanks,

Joe


--
You received this message because you are subscribed to the Google Groups "stacki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stacki+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Enrique Flores

unread,
Oct 13, 2016, 5:33:56 PM10/13/16
to stacki
this ended up working for me: 

[]# cd /opt/stack/lib/python2.6/site-packages/stack/commands/report/dhcpd/
[]# 
[]# diff -u __init__.py.ORIG __init__.py
--- __init__.py.ORIG 2016-07-01 05:52:51.000000000 -0700
+++ __init__.py 2016-10-13 14:24:46.488430672 -0700
@@ -111,6 +111,7 @@

                 self.addOutput('', stack.text.DoNotEdit())
  self.addOutput('', 'ddns-update-style none;')
+ self.addOutput('', 'log-facility local5;')

                 # Build a dictionary of DHCPD server addresses
                 # for each subnet that serves PXE (DHCP).
[]#
[]# stack sync config

[]# head -9 !$
head -9 /etc/dhcp/dhcpd.conf
#
# WARNING: This file is generated do not edit.
#
# Contents last written on 10/13/16 14:32:53 PM by Stacki.
#

ddns-update-style none;
log-facility local5;

[]#



thanks for your help
-EHF

Reply all
Reply to author
Forward
0 new messages