Tuesday, February 17, 2009

STEP BY STEP DHCP

Dynamic IP, this document describes briefly set DHCP on Linux machines. Only the translation.

DHCP Server Step-by-Step

What is DHCP
DHCP (Dynamic Host Configuration Protocol) is a protocol in which an IP address automatically provided from the server to clients. This means
Menghandle the DHCP server IP address, so that the other computer dalamnetwork does not need to manually set the address
Ip-nya. Setting up a DHCP server mean that we need to reduce the work setting up the network on each PC is connected
in a network.

To setup a DHCP server on linux (Redhat 6.0 used here)
required

LAN yag work well
dhcpd (dhcp-2.0b1pl6-6.i386.rpm or newer)

Redhat 6.0 in all required in the kernel has terkompiled in.
If you have a computer in a few network devices such as:

eth0 - nyambung to the Internet
eth1 - LAN to nyambung

You must determine Hati2 in the interface which will
have a DHCP service. Suppose diingankan a DHCP server
only request from eth1, and eth0 is not for the ISP to tekoneksi.

Download DHCP server software
Search in http://ww.rpmfind.net
or
nohup wget-T0 ftp://ftp.isc.org/isc/dhcp/dhcp-3.0b1pl17.tar.gz

Configure / etc / dhcpd.conf
After DHCP (either by NER or by source) is installed, create a configuration file
/ etc / dhcpd.conf. Suppose the network's internal IP address is 192.168.0.x
kira2 the configuration will be like this

# / Etc / dhcpd.conf
# Dhcpd Configuration
default-lease-time 86400; # one day
max-lease-time 86400; # one day

subnet 192.168.0.0 netmask 255.255.255.0 (
range 192.168.0.2 192.168.0.250;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
# # The IP address of the server name
option domain-name-servers 192.168.0.1;
option domain-name "mydomain.com";
# # If you have Samba acting as a Wins Server
option NetBIOS-name-servers 192.168.0.1;
NetBIOS option-dd-server 192.168.0.1;
NetBIOS node-option-type 8;
NetBIOS option-scope "";
)
If you have a Linux box and Samba DNS diperluka the extra
options in a specific configuration. If your DNS server
123123123123 and 123123123124 the required options below:

option domain-name-servers 123,123,123,123 123,123,123,124;

If you do not use Samba acting as a primary server and Wins
the "option NetBIOS-" you need to remove or comment out.

Configuring / etc / rc.d / init.d / dhcpd
If you install the DHCP package from the rpm will be obtained directly filestart up
/ etc / rc.d / init.d / dhcpd running order for both the need to change little in

#! / bin / sh
#
Dhcpd # This shell script takes care of starting and stopping
# Dhcpd.
#
# Chkconfig: 2345 65 35
# Description: dhcpd provide access to Dynamic Host Control Protocol.

# Source function library.
. / etc / rc.d / init.d / functions

# Source networking configuration.
. / etc / sysconfig / network

# Check that networking is up.
[$ (Networking) = "no"] & & exit 0

[-F / usr / sbin / dhcpd] | | exit 0
[-F / etc / dhcpd.conf] | | exit 0

# See how we were called.
case "$ 1" in
start)
# Start daemons.
echo-n "Starting dhcpd:"
/ sbin / route add-host 255255255255 dev eth1 2> / dev / null
daemon / usr / sbin / dhcpd eth1
echo
touch / var / lock / subsys / dhcpd
;
stop)
# Stop daemons.
echo-n "Shutting down dhcpd:
/ sbin / route del-host 255255255255 dev eth1 2> / dev / null
killproc dhcpd
echo
rm-f / var / lock / subsys / dhcpd
;
restart)
$ 0 stop
$ 0 start
;
status)
dhcpd status
;
*)
echo "Usage: dhcpd (start | stop | restart | status)"
exit 1
esac

exit 0

Required the addition of
/ sbin / route add-host 255255255255 dev eth1 2> / dev / null
at startup, and additional options when dhcpd eth1 run
DHCP server function that can only be direquest from eth1

Running DHCP
Before DHCP mejalankan first need to leases made before the file is empty

# Touch / etc / dhcpd.leases

If the file has been created over startpup run with

# / Etc / rc.d / init.d / dhcpd start

No comments:

Post a Comment