Koozali.org: home of the SME Server
Obsolete Releases => SME 7.x Contribs => Topic started by: partsgaw on January 29, 2010, 03:21:14 AM
-
good day,
Help me i need to push to a certain gateway and dns in my dhcp.
can set it in dhcpd.conf?
-
No, most normal linux config files can't be edited directly on SME.
Instead, you need to create "custom template fragments".
The SME templating system will give precedence to "custom" templates with the same name as any of the regular templates, so creating custom templates goes like this:
1) Identify the folder containing the template fragments you need to customize (the templates for /etc/dhcpd.conf are found in /etc/e-smith/templates/dhcpd.conf).
2) Search the templates to find the ones that interest you (the DNS server setting is generated by 25DomainNameServers, and the gateway/router setting is generated by 25Routers).
3) Create the required custom template folder (/etc/e-smith/templates-custom/etc/dhcpd.conf in this case):mkdir -p /etc/e-smith/templates-custom/dhcpd.conf
4) Create your custom templates in the new custom template folder, using the exact same names as the default templates, something like this (use your real information, not the sample IPs I have shown):echo "option domain-name-servers 4.2.2.1;" > /etc/e-smith/templates-custom/etc/dhcpd.conf/25DomainNameServers
echo "option routers 192.168.1.4;" > /etc/e-smith/templates-custom/etc/dhcpd.conf/25Routers
5) Expand the new template and restart the affected service(s):expand-template /etc/dhcpd.conf
sv t dhcpd
Having said that, the default DNS server on the SME can easily be configured as a forwarder for another DNS server, so I don't know why you would need to change the default. Also, I suspect that several parts of your SME will not work as expected if you change the router and DNS settings.
-
thanks alot it works!!!!! have a nice day
-
hi,
is it possible for the dhcp service to push to other dns and gateway just only for certain client ip address or mac address? i mean only a single pc will be affected for the dns and gateway push
-
Perhaps by creating a custom template fragment to insert a "group" declaration into dhcpd.conf.
See an example 'group' section at http://www.redhat.com/docs/manuals/linux/RHL-7.3-Manual/custom-guide/s1-dhcp-configuring-server.html#GROUP
-
thanks for the info, but how do i insert a group declaration in my custom templates? can use vi to insert?
-
vi, echo, pico - as you please.
When I use pico, I add the "-w" option to prevent automatic wrapping of any text that I might paste in.
When I use "echo", I surround multi-line text with single quotes.
Assuming you decide to name your new custom template fragment 99Group (and assuming that you want your "Group" section to look exactly like the example from the redhat link):
vi /etc/e-smith/templates-custom/etc/dhcpd.conf/99Group
pico -w /etc/e-smith/templates-custom/etc/dhcpd.conf/99Group
echo 'group {
option routers 192.168.1.254;
option subnet-mask 255.255.255.0;
option domain-name "example.com";
option domain-name-servers 192.168.1.1;
option time-offset -18000; # Eastern Standard Time
host apex {
option host-name "apex.example.com";
hardware ethernet 00:A0:78:8E:9E:AA;
fixed-address 192.168.1.4;
}
host raleigh {
option host-name "raleigh.example.com";
hardware ethernet 00:A1:DD:74:C3:F2;
fixed-address 192.168.1.6;
}
}' > /etc/e-smith/templates-custom/etc/dhcpd.conf/99Group
Since you are including a "host" declaration in this template fragment, you probably don't want to have the same host defined in server-manager.
-
thanks alot mccarn! i will try this later
-
hi i got error, this is my dhcp.conf custom-templates :
group { option routers 192.168.101.1;
option subnet-mask 255.255.255.0; option domain-name "example.com";
option domain-name-servers 208.67.222.222;
option time-offset -18000; # Eastern Standard Time host archie { option host-name "archie";
hardware ethernet 00:0D:88:40:01:C4;
fixed-address 192.168.101.57; } }
and this is the error :
[root@test /]# expand-template /etc/dhcpd.confWARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: Number found where op erator expected at /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group line 3, near " mask 255.255.255.0"WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: (Do you need to predeclare mask?)WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: String found where op erator expected at /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group line 5, near " name "example.com""WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: (Do you need to predeclare name?)WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: Number found where op erator expected at /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group line 6, near " servers 208.67.222.222"WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: (Do you need to predeclare servers?)WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: Unquoted string "opti on" may clash with future reserved word at /etc/e-smith/templates-custom//etc/dhcpd.con f/99Group line 8.WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: String found where op erator expected at /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group line 11, near "name "archie""WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: (Do you need to predeclare name?)WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: Bareword found where operator expected at /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group line 12, nea r "0D"WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: (Missing operat or before D?)WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: Unquoted string "fixe d" may clash with future reserved word at /etc/e-smith/templates-custom//etc/dhcpd.conf /99Group line 13.WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: Number found where op erator expected at /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group line 13, near "address 192.168.101.57"WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: (Do you need to predeclare address?)ERROR in /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group: Program fragment delive red error <<syntax error at /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group line 3, near "mask 255.255.255.0"syntax error at /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group line 5, near "nam e "example.com""syntax error at /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group line 6, near "ser vers 208.67.222.222"syntax error at /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group line 11, near "na me "archie""syntax error at /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group line 12, near "00 :"syntax error at /etc/e-smith/templates-custom//etc/dhcpd.conf/99Group line 13, near "ad dress 192.168.101.57">> at template line 1ERROR: Template processing failed for //etc/dhcpd.conf: 14 fragments generated warnings , 1 fragment generated errors at /sbin/e-smith/expand-template line 45[/color]
-
I can't read your post very easily.
Can you edit it and surround the template fragment and log output with "code" blocks (you can insert a code block by highlighting the desired text, then pressing the "#" icon at the top of the postedit window).
-
Hello,
I have the same situation as Partsgaw. Basically I have created a new custom template from /etc/e-smith/templates-custom/etc/dhcpd.conf and from there create this file 99group
group {
option domain-name "vpnisl2";
option routers 192.168.102.2;
option domain-name-servers 192.168.102.2;
host lab {
hardware ethernet 00:24:82:4C:5b:ce; fixed-address 192.168.102.4;}
}
Then I expand it by: #expand-template /etc/dhcpd.conf
And I got this error after
# expand-template /etc/dhcpd.conf
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: String found where operator expected at /etc/e-smith /templates-custom//etc/dhcpd.conf/99group line 2, near "name "vpnisl2""
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: (Do you need to predeclare name?)
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: Number found where operator expected at /etc/e-smith /templates-custom//etc/dhcpd.conf/99group line 4, near "servers 192.168.102.2"
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: (Do you need to predeclare servers?)
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: Bareword found where operator expected at /etc/e-smi th/templates-custom//etc/dhcpd.conf/99group line 6, near "4C"
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: (Missing operator before C?)
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: Bareword found where operator expected at /etc/e-smi th/templates-custom//etc/dhcpd.conf/99group line 6, near "5b"
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: (Missing operator before b?)
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: Unquoted string "b" may clash with future reserved w ord at /etc/e-smith/templates-custom//etc/dhcpd.conf/99group line 6.
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: Unquoted string "ce" may clash with future reserved word at /etc/e-smith/templates-custom//etc/dhcpd.conf/99group line 6.
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: Unquoted string "fixed" may clash with future reserv ed word at /etc/e-smith/templates-custom//etc/dhcpd.conf/99group line 6.
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: Number found where operator expected at /etc/e-smith /templates-custom//etc/dhcpd.conf/99group line 6, near "address 192.168.102.4"
WARNING in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: (Do you need to predeclare address?)
ERROR in /etc/e-smith/templates-custom//etc/dhcpd.conf/99group: Program fragment delivered error <<syntax error at /et c/e-smith/templates-custom//etc/dhcpd.conf/99group line 2, near "name "vpnisl2""
syntax error at /etc/e-smith/templates-custom//etc/dhcpd.conf/99group line 4, near "servers 192.168.102.2"
syntax error at /etc/e-smith/templates-custom//etc/dhcpd.conf/99group line 6, near "00:"
syntax error at /etc/e-smith/templates-custom//etc/dhcpd.conf/99group line 6, near "address 192.168.102.4">> at templa te line 1
ERROR: Template processing failed for //etc/dhcpd.conf: 13 fragments generated warnings, 1 fragment generated errors
at /sbin/e-smith/expand-template line 45
Can anyone explain why I have this error?
Regards,
Rocel