Formatting code for DHCP


show source only

{{parent page="Network"}}

===DHCPd===

==Quick start==
Nothing fancy, just use this config as a start and you should be able to get it up and running in 5minutes.

%%
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
default-lease-time 600;
max-lease-time 7200;
ddns-update-style ad-hoc;
option subnet-mask 255.255.255.0;
option broadcast-address 172.16.181.255;
option routers 172.16.181.1;
option domain-name-servers 172.16.18.1;
option domain-name "mydomain.org";

subnet 172.16.181.0 netmask 255.255.255.0 {
range 172.16.181.200 172.16.181.250;
}
%%

==Binding DHCPd to an interface==
If you want DHCPd to bind to a certain interface, edit /etc/sysconfig/dhcpd and set
%%
DHCPDARGS=eth1
%%

==DHCP and DNS==
This is untested. Basically when an IP is assigned, it will update DNS.

%%
authoritative;
ddns-update-style interim;
ignore client-updates;

key DHCP_UPDATER {
algorithm HMAC-MD5;
secret xxyy;
};

zone domain.com. {
primary 127.0.0.1;
key DHCP_UPDATER;
}

zone 1.168.192.in-addr.arpa. {
primary 127.0.0.1;
key DHCP_UPDATER;
}
%%

==Filtering dhcp log with syslog-ng==
Configure dhcpd to log to local7, then edit syslog-ng.conf:

%%
# Add destination and filter.
destination df_dhcpd { file("/var/log/dhcpd.log"); };
filter f_dhcpd { match("dhcpd"); };

# Modify /var/log/messages to exclude dhcpd logs
filter f_messages {
level(info,notice,warn)
and not facility(auth,authpriv,cron,daemon,mail,news)
and not match("dhcpd");
};

# Finally define dhcpd log
log {
source(s_all);
filter(f_dhcpd);
destination(df_dhcpd);
};
%%

And remember to configure logrotate to rotate dhcpd.log

%%(text;logrotate.d/syslog-ng)
/var/log/dhcpd.log {
rotate 4
missingok
notifempty
weekly
compress
}
%%

Yea.. sometimes Linux stuff can be overly complicated.
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki