Difference between revisions of "FreePBX/en/dhcp server"

From Teknologisk videncenter
< FreePBX‎ | en
Jump to: navigation, search
m (Install DHCP server on Centos)
m (Static IP on DHCP server)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
=Static IP on DHCP server=
 +
In order for the DHCP to start when CentOS is bootet it is necesary to have an static IP address on the interface connected to the network.
 +
 +
edit /etc/sysconfig/network-scripts/ifcfg-eth0 to contain
 +
<source lang=cli>
 +
DEVICE=eth0
 +
ONBOOT=yes
 +
BOOTPROTO=none
 +
NETMASK=255.255.0.0
 +
IPADDR=172.24.0.2
 +
</source>
 +
=Adding a default gateway=
 +
Edit the /etc/sysconfig/network file:
 +
 +
Add the following line to point at your default gateway.
 +
<source lang=cli>
 +
GATEWAY=172.24.0.1
 +
</source>
 +
 
=Install DHCP server on Centos=
 
=Install DHCP server on Centos=
 
<source lang=cli>
 
<source lang=cli>
Line 40: Line 59:
 
</source>
 
</source>
  
=File /etc/dhcpd.conf=
+
=Configuring DHCP=
Configure /etc/dhcpd.conf using your favorite UNIX editor.
+
Configure /etc/dhcp/dhcpd.conf using your favorite UNIX editor.
 
*
 
*
 
<source lang=cli>
 
<source lang=cli>
Line 53: Line 72:
 
         option routers                  172.24.0.1;
 
         option routers                  172.24.0.1;
 
         option subnet-mask              255.255.0.0;
 
         option subnet-mask              255.255.0.0;
         option tftp                    172.24.0.1;
+
         option tftp                    172.24.0.2;
 
         option domain-name              "Hold2.tekkom.dk";
 
         option domain-name              "Hold2.tekkom.dk";
         option domain-name-servers      208.67.222.222;
+
         option domain-name-servers      10.2.1.11
 +
;
 
}
 
}
 
</source>
 
</source>
 
{{Source cli}}
 
{{Source cli}}
 +
 +
=Starting DHCP=
 +
<source lang=cli>
 +
[root@localhost etc]# <input>service dhcpd start</input>
 +
Starting dhcpd:                                            [OK]
 +
[root@localhost etc]# <input>chkconfig --level 2345 dhcpd on</input>
 +
</source>

Latest revision as of 12:43, 8 May 2013

Static IP on DHCP server

In order for the DHCP to start when CentOS is bootet it is necesary to have an static IP address on the interface connected to the network.

edit /etc/sysconfig/network-scripts/ifcfg-eth0 to contain

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
NETMASK=255.255.0.0
IPADDR=172.24.0.2

Adding a default gateway

Edit the /etc/sysconfig/network file:

Add the following line to point at your default gateway.

GATEWAY=172.24.0.1

Install DHCP server on Centos

[root@localhost etc]# <input>yum install dhcp</input>
Loaded plugins: fastestmirror, kmod
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package dhcp.x86_64 12:4.1.1-31.0.1.P1.el6.centos.1 will be installed
--> Processing Dependency: portreserve for package: 12:dhcp-4.1.1-31.0.1.P1.el6.centos.1.x86_64
--> Running transaction check
---> Package portreserve.x86_64 0:0.0.4-9.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch      Version                              Repository  Size
================================================================================
Installing:
 dhcp           x86_64    12:4.1.1-31.0.1.P1.el6.centos.1      updates    818 k
Installing for dependencies:
 portreserve    x86_64    0.0.4-9.el6                          base        23 k

Transaction Summary
================================================================================
Install       2 Package(s)

Total download size: 840 k
Installed size: 1.9 M
Is this ok [y/N]: <input>y</input>
<notice>... OUTPUT OMITTED ...</notice>
Installed:
  dhcp.x86_64 12:4.1.1-31.0.1.P1.el6.centos.1

Dependency Installed:
  portreserve.x86_64 0:0.0.4-9.el6

Complete!

Configuring DHCP

Configure /etc/dhcp/dhcpd.conf using your favorite UNIX editor.

ddns-update-style none;

option tftp code 150 = ip-address;
server-name "freepbx.henrik.dk";

subnet 172.24.0.0 netmask 255.255.0.0 {
        range dynamic-bootp 172.24.100.1 172.24.199.255;
        option routers                  172.24.0.1;
        option subnet-mask              255.255.0.0;
        option tftp                     172.24.0.2;
        option domain-name              "Hold2.tekkom.dk";
        option domain-name-servers      10.2.1.11
;
}


Starting DHCP

[root@localhost etc]# <input>service dhcpd start</input>
Starting dhcpd:                                            [OK]
[root@localhost etc]# <input>chkconfig --level 2345 dhcpd on</input>