linux 下 dhcp server安装与配置

上官和韵
2023-12-01

环境:Ubuntu10.10 32bit, kernel 2.6.35

dhcp: dhcp3-server

install.

 it is told that the newer Ubuntu will have to install isc-dhcp-server instead of dhcp3-server.

at first i think my Ubuntu is among the 'newer' groups and try to install the 'new' packege while was told by the sys that the source is not found.

so lazy i am that i did not update the source and just install the 'old' one:

$sudo apt-get installdhcp3-server

if your OS is really new, you can replace the 'dhcp3-server' with the new 'isc-dhcp-server'.

config.

after you have installed the tool, you will have to config the network interface card.

i have two NIC: an wired one -eth0, an wireless -wlan0.

and i just want to make the 'eth0' as the dhcp server's network port.

here the eth0 card is configured as static IP:172.17.16.1, netmask as you should be familiar, 255.255.255.0.

now edit the config files:

$sudo vi /etc/dhcp3/dhcpd.conf

and paste below info just at the end of the file:

 #=================================added here===============================
 authoritative;
 option subnet-mask 255.255.255.0;
 option broadcast-address 172.17.16.255;
 option routers 172.17.16.1;
 option domain-name-servers 10.33.8.21, 8.8.8.8, 8.8.4.4;
 subnet 172.17.16.0 netmask 255.255.255.0 {
     range 172.17.16.111 172.17.16.222;
 }
 #==========================================================================


if you want to allocate static IPs for the hosts, you can also add as below(host julie with its MAC and allocated IP)

host julie {
hardware ethernet insert-MAC-address;
fixed-address 172.17.16.100;
}


as i have two NIC, it is best that i config explicit the NIC dhcp server will use:

$sudo vi /etc/default/dhcp3-server

and add as below:

INTERFACES="eth0"

if you want both, you can also config like

INTERFACES="eth0 wlan0"

separate the interfaces with blank.

and also do not forget to modify network config:

$sudo vi /etc/network/interfaces

as i only use one NIC for DHCP, it is as below:

   #==================add here===========================
   auto eth0
   iface eth0 inet static
      address 172.17.16.1
      netmask 255.255.255.0
  #=====================================================

and now, you can start your dhcp server

$sudo dhcp3

of course you can also make it that the dhcp server started while sys boot up.

while i have not done this part yet,XDD.

i can be your turn, and you can share to us.


a little addtional tips,:D

config dual NIC network sharing

Internet < --- > PC:wlan0|PC:eth0 < --- > router/AP < --- > client PC

#echo "1" > /proc/sys/net/ipv4/ip_forward
#iptables -t nat -A POSTROUTING -s 172.17.16.111/32 -o wlan0 -j SNAT --to 192.168.88.30
you can also replace the iptables cmd with below
#iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
here my wlan0's IP is 192.168.88.30 and the client router/AP's IP is 172.17.16.111


here just find another url just for ubuntu14.04.

http://www.tuicool.com/articles/AzEbii


ref:

http://askubuntu.com/questions/70339/how-do-i-setup-dhcp-server-interfaces-so-they-are-mapped-bridged-to-each-other?rq=1

https://help.ubuntu.com/community/dhcp3-server

http://wiki.ubuntu.com.cn/index.php?title=UbuntuHelp:Dhcp3-server&variant=zh-tw

http://nwlinux.com/how-to-configure-dhcp3-server-in-ubuntu-server/

 类似资料: