安裝套件
$ sudo apt-get install isc-dhcp-server -y配置DHCP Server
$ sudo vim /etc/dhcp/dhcpd.conf新增下面內容:
default-lease-time 600; max-lease-time 7200; option domain-name "mydomain.example"; subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.10 192.168.1.100; range 192.168.1.150 192.168.1.200; option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; option routers 192.168.1.1; option domain-name-servers 192.168.1.1, 192.168.1.2; }修改/etc/default/isc-dhcp-server
$ sudo vim /etc/default/isc-dhcp-server找到INTERFACES=""這行並修改,指定DHCP Server所使用的網路卡:
INTERFACES="eth2"修改/etc/network/interfaces
$ sudo vim /etc/network/interfaces配置eth2網路卡,新增下面內容:
auto eth2 iface eth2 inet static address 192.168.1.1 netmask 255.255.255.0讓eth2網路卡設定生效
# Ubuntu 14.04 $ sudo ifdown eth2; sudo ifup eth2
# Ubuntu 12.04 $ sudo service networking restart重新啟動DHCP Server
$ sudo service isc-dhcp-server restartDHCP Server 啟動|停止|狀態
$ sudo service isc-dhcp-server start|stop|status開機不要啟動DHCP Server
# Ubuntu 16.04 $ sudo update-rc.d isc-dhcp-server disable
# Ubuntu 14.04 與 Ubuntu 12.04 $ echo manual | sudo tee -a /etc/init/isc-dhcp-server.override開機啟動DHCP Server
# Ubuntu 16.04 $ sudo update-rc.d isc-dhcp-server enable
# Ubuntu 14.04 與 Ubuntu 12.04 $ sudo rm -f /etc/init/isc-dhcp-server.override
安裝環境Ubuntu 10.04
安裝套件
$ sudo apt-get install dhcp3-server -y配置DHCP Server
$ sudo vim /etc/dhcp3/dhcpd.conf新增下面內容:
default-lease-time 600; max-lease-time 7200; option domain-name "mydomain.example"; subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.10 192.168.1.100; range 192.168.1.150 192.168.1.200; option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; option routers 192.168.1.1; option domain-name-servers 192.168.1.1, 192.168.1.2; }修改/etc/default/dhcp3-server
$ sudo vim /etc/default/dhcp3-server找到INTERFACES=""這行並修改,指定DHCP Server所使用的網路卡:
INTERFACES="eth2"修改/etc/network/interfaces
$ sudo vim /etc/network/interfaces配置eth2網路卡,新增下面內容:
auto eth2 iface eth2 inet static address 192.168.1.1 netmask 255.255.255.0讓eth2網路卡設定生效
$ sudo /etc/init.d/networking restart重新啟動DHCP Server
$ sudo /etc/init.d/dhcp3-server restartDHCP Server 啟動|停止|狀態
$ sudo /etc/init.d/dhcp3-server start|stop|status開機不要啟動DHCP Server
$ sudo update-rc.d dhcp3-server disable開機啟動DHCP Server
$ sudo update-rc.d dhcp3-server enable
沒有留言:
張貼留言