Twitter
RSS
Showing posts with label dhcp configuration. Show all posts
Showing posts with label dhcp configuration. Show all posts

DHCP and TFTP server configuration in Linux

0
Setting up DHCP and TFTP servers:

A DHCP server is required to provide IP addresses for the clients when booting Grub (BOOTP) and later when booting Linux. A TFTP server is required to make the boot images available on the network for Linux to boot. The TFTP server is also necessary to make it possible to save and restore the disk images.

3.1. Setting up DHCP
Details on DHCP are beyond the scope of this article. The "Linux Networking HOWTO" has a chapter on DHCP.

Setting up DHCP is very easy, but if you are in a network environment administered by someone else, it's advisable to use a preexisting DHCP server. If you "own" the network then you can follow this procedure.

Install DHCP, if not installed, from the rpm package, normally found in Linux distributions:
# rpm -ihv dhcp-*.rpm

Edit the /etc/dhcpd.conf file to configure DHCP service.

In our setup, the server has IP address 10.0.0.1 and provides IP addresses up to 253 clients. Configure /etc/dhcpd.conf according to your environment:

#/etc/dhcpd.conf
server-identifier dhcp.clonedomain.com;
default-lease-time 172800;
max-lease-time 604800;
option domain-name "clonedomain.com";
subnet 10.0.0.0 netmask 255.255.255.0 {
range dynamic-bootp 10.0.0.2 10.0.0.254;}

Start the dhcpd server:
/etc/rc.d/init.d/dhcpd start.

3.2. Setting up TFTP:

Setting up TFTP is almost as easy as DHCP.
First install from the rpm package:
# rpm -ihv tftp-server-*.rpm

Create a directory for the files:
# mkdir /tftpboot
# chown nobody:nobody /tftpboot

The directory /tftpboot is owned by user nobody, because this is the default user id set up by tftpd to access the files.
Edit the file /etc/xinetd.d/tftp to look like the following:
service tftp
{ socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -c -s /tftpboot
disable = no
per_source = 11
cps = 100 2 }

The changes from the default file are the parameter disable = no (to enable the service) and the server argument -c. This argument allows for the creation of files, which is necessary if you want to save boot or disk images. You may want to make TFTP read only in normal operation.

Then reload xinetd:
/etc/rc.d/init.d/xinetd reload

You can use the tftp command, available from the tftp (client) rpm package, to test the server. At the tftp prompt, you can issue the commands put and get.


DHCP Enable in Redhat Enterprise 4

0

I) Need to check in Linux DHCP installed or not first ?

2) In teminal type : "rpm -q dhcp" like below


[root@iccserver ~]# rpm -q dhcp
package dhcp is not installed


3) if not install software -
please get rpm file from http://rpmfind.net search 'dhcp' and get this
file "dhcp-3-0.EL.i386.rpm" for Redhat ES4 & save to /opt then cd /opt


4) then install "rpm -ivh dhcp-3-0.EL.i386.rpm" enter like below

[root@iccserver opt]# rpm -ivh dhcp-3.0.5-3.el5.i386.rpm
warning: dhcp-3.0.5-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:dhcp ########################################### [100%]
[root@iccserver opt]#


5) After install success need to edit dhcpd.conf like below:

Vi /etc/dhcpd.conf
=============================================================
ddns-update-style interim;
ignore client-updates;

subnet 192.168.0.0 netmask 255.255.255.0 {
authoritative;
deny unknown-clients;
# --- default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name "www.nsharif.com,";
option domain-name-servers 66.178.2.25, 66.178.2.16;
option time-offset -18000;
range dynamic-bootp 192.168.0.5 192.168.0.253;
default-lease-time 51600;
max-lease-time 93200;
#}

# through mac address assigned ip address without aquiring like below
host sharif {
ddns-updates on;
hardware ethernet 00:00:E2:47:12:75;
fixed-address 192.168.0.150;
}
host xxx {
ddns-updates on;
hardware ethernet 00:00:E2:47:12:75;
fixed-address 192.168.0.131;
}
}
=================================================================
save command : Esc, shift+: wq (will save and quit from dhcpd.conf)

6) Assign which interface want to get dhcp range and edit below file:
Vi /etc/sysconfig/dhcpd
=============================
DHCPDARGS=eth0 or eth1
=============================
save command : Esc, shift+: wq (will save and quit from dhcpd.conf)
7) service dhcpd start - ( it will show success [ok] if not check file any mistakes in dhcpd.conf)

8) service network restart

9) If need start by auto during boot : go to "ntsysv" check the option "dhcpd" then clik save.

10) For checking dhcp lease :
touch /var/lib/dhcp/dhcpd.leases ( it will result dhcp client list).............