各位前輩,小弟目前要在CentOS6.5 架設 單網卡發多網段,與VLAN 的DHCP Server
因找到前資訊主管留下的設定方式 在終端機輸入 service dhcpd start 啟動失敗
從/var/log/messages 底下看到下列訊息,是否能提示小弟我哪裡需要設定的
------log中的錯誤訊息
localhost dhcpd: Copyright 2004-2010 Internet Systems Consortium.
localhost dhcpd: All rights reserved.
localhost dhcpd: For info, please visit https://www.isc.org/software/dhcp/
localhost dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
localhost dhcpd: Can't chown new lease file: Operation not permitted
localhost dhcpd: ...中略
Aug 26 09:13:22 localhost dhcpd: exiting
------下列為前資訊主管dhcpd.conf與sysconfig/dhcp跟腳本rc.loacl
/etc/dhcpd/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
# --- default gateway
range dynamic-bootp 192.168.1.231 192.168.1.240;
option routers 192.168.1.2;
option subnet-mask 255.255.255.0;
option domain-name-servers 168.95.1.1;
option domain-name-servers 8.8.8.8;
option time-offset -18000; # Eastern
default-lease-time 3600;
max-lease-time 14400;
}
subnet 192.168.8.0 netmask 255.255.255.0 {
# --- default gateway
range dynamic-bootp 192.168.8.230 192.168.8.240;
option routers 192.168.8.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 168.95.1.1;
option domain-name-servers 8.8.8.8;
option time-offset -18000; # Eastern
default-lease-time 3600;
max-lease-time 14400;
}
# --- default gateway
range dynamic-bootp 192.168.10.51 192.168.10.210;
option routers 192.168.10.2;
option subnet-mask 255.255.255.0;
option domain-name-servers 168.95.1.1;
option domain-name-servers 8.8.8.8;
option time-offset -18000; # Eastern
default-lease-time 3600;
max-lease-time 28800;
}
subnet 192.168.12.0 netmask 255.255.255.0 {
# --- default gateway
range dynamic-bootp 192.168.12.51 192.168.12.200;
option routers 192.168.12.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 168.95.1.1;
option domain-name-servers 8.8.8.8;
option time-offset -18000; # Eastern
default-lease-time 3600;
max-lease-time 28800;
}
略......
------------------------------------------------------------------
設定要派發的網卡
/etc/sysconfig/dhcpd
DHCPDARGS="eth0.2 eth0.3 eth0.5 eth0.8 eth0.10 eth0.11 eth0.12 eth0.13 eth0.14 eth0.15 eth0.16 eth0.17 eth0.18 eth0.19 eth0.20 eth0.21 eth0.22"
-------------------------------------------------------------------
開機自動載入腳本
檔案位置↓↓↓
/etc/rc.loacl
#!/bin/sh
touch /var/lock/subsys/local
/sbin/modprobe -a 8021q
載入802.q模組
/sbin/vconfig add eth0 2 新增虛擬網卡掛載再eth0,vlan2
ifconfig eth0.2 192.168.1.3 netmask 255.255.255.0
設定eth0.22的interface IP為192.168.1.3/24
/sbin/vconfig add eth0 3
ifconfig eth0.3 192.168.10.3 netmask 255.255.255.0
/sbin/vconfig add eth0 5
ifconfig eth0.5 192.168.12.3 netmask 255.255.255.0
/sbin/vconfig add eth0 8
ifconfig eth0.8 192.168.8.3 netmask 255.255.255.0
略.....
service dhcpd start
起動dhcpd
```