Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: rick1908 on November 28, 2007, 07:19:25 AM

Title: Trouble with Custom Template
Post by: rick1908 on November 28, 2007, 07:19:25 AM
I am trying to create a custom template for /etc/dhcpd.conf with "{" in the fragment. When I expand the template everything inside the fragments is removed.


Here is the fragment code;
Code: [Select]
#Start vmware subnets

subnet 172.16.180.0 netmask 255.255.255.0 {
# Note: No range is given, vmnet-dhcpd will deal with this subnet.
}

subnet 192.168.2.0 netmask 255.255.255.0 {
# Note: No range is given, vmnet-dhcpd will deal with this subnet.
}

#End vmware subnets
When I execute:
Code: [Select]
expand-template /etc/dhcpd.conf
The resulting /etc/dhcpd.conf looks like this:
Code: [Select]
#Start vmware subnets

subnet 172.16.180.0 netmask 255.255.255.0

subnet 192.168.2.0 netmask 255.255.255.0

#End vmware subnets

How might I get the template to expand with out executing what is inside the brackets in the fragment?

Thanks,
Rick Evans
Title: Re: Trouble with Custom Template
Post by: thomasch on November 28, 2007, 07:51:48 AM
Rick,

the secret is to use

Code: [Select]
$OUT .= "\}"
the fragment maybe looks like this :

Code: [Select]
#Start vmware subnets

$OUT .= "subnet 172.16.180.0 netmask 255.255.255.0\n\{";
# Note: No range is given, vmnet-dhcpd will deal with this subnet.
$OUT .= "\}"

$OUT .= "subnet 192.168.2.0 netmask 255.255.255.0\n\{";

# Note: No range is given, vmnet-dhcpd will deal with this subnet.
$OUT .= "\}"

#End vmware subnets

Off topic : Why do you want to do this?
Title: Re: Trouble with Custom Template
Post by: rick1908 on November 28, 2007, 08:04:25 AM
Thanks for replying...

...I was just following the instructions given from te vmware server setup. Not really sure to be frank.

Here is the output from the install:
Code: [Select]
DHCP Server exclusions
Probing for an unused private subnet (this can take some time)...

The subnet 172.16.180.0/255.255.255.0 appears to be unused.

This system appears to have a DHCP server configured for normal use.  Beware
that you should teach it how not to interfere with VMware Server's DHCP server.
There are two ways to do this:

1) Modify the file /etc/dhcpd.conf to add something like:

subnet 172.16.180.0 netmask 255.255.255.0 {
# Note: No range is given, vmnet-dhcpd will deal with this subnet.
}

2) Start your DHCP server with an explicit list of network interfaces to deal
with (leaving out vmnet8). e.g.:

dhcpd eth0

Consult the dhcpd(8) and dhcpd.conf(5) manual pages for details.

Hit enter to continue.

Is this correct?

Thanks,
Rick
Title: Re: Trouble with Custom Template
Post by: CharlieBrady on November 28, 2007, 05:00:57 PM
I am trying to create a custom template for /etc/dhcpd.conf with "{" in the fragment.

Wherever you want "{", use "\{". Wherever you want "}", use "\}".
Title: Re: Trouble with Custom Template
Post by: thomasch on November 29, 2007, 05:10:17 AM
Thanks for replying...

...I was just following the instructions given from te vmware server setup. Not really sure to be frank.

Here is the output from the install:
Code: [Select]
DHCP Server exclusions

[cut]

Consult the dhcpd(8) and dhcpd.conf(5) manual pages for details.


Is this correct?

Thanks,
Rick

Consult dhcpd.conf manual as advised by vmware script.

see /etc/e-smith/templates/etc/dhcpd.conf as there is the dhcpd.conf template
but DO NOT modify anything in there.. as this practise is not recommended
copy EVERYTHING into /etc/e-smith/templates-custom/etc/dhcpd.conf and edit the fragments from there instead

Title: Re: Trouble with Custom Template
Post by: rick1908 on November 29, 2007, 01:15:41 PM
That is exactly what I did. I would have expected that a question regarding "Custom Templates" would have made that all too clear.

Thanks for the reminder tho,
Rick