![/etc/dhcp/dhcpd.conf](https://linux22.com/image/821178/%2Fetc%2Fdhcp%2Fdhcpd.conf.png)
下周我将举办一个局域网聚会,我们将创建一个没有互联网连接的独立局域网。由于我不想在 8 台计算机上设置静态 IP,所以我想在我的计算机上设置一个 DHCP 服务器。我发现有dhcp3-server
。
问题可能是 DHCP 服务器会一直运行,当我在另一个网络中时,就会出现问题。我该如何设置它,以便在 LAN 聚会时启动它?
我使用带有 KDE 的 Kubuntu,如果这有什么区别的话。
好的,我已经安装了 dhcp 服务器,但它无法启动。我附上了一些命令、配置文件的输出
/etc/dhcp/dhcpd.conf
ddns-update-style none;
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.100 192.168.100.200;
}
/etc/default/isc-dhcp 服务器
INTERFACES="eth0"
是否配置
eth0 Link encap:Ethernet HWaddr f0:de:f1:de:a2:90
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:20 Memory:f2500000-f2520000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2830 errors:0 dropped:0 overruns:0 frame:0
TX packets:2830 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:405626 (405.6 KB) TX bytes:405626 (405.6 KB)
wlan0 Link encap:Ethernet HWaddr 10:0b:a9:bf:e8:fc
inet addr:131.220.201.217 Bcast:131.220.207.255 Mask:255.255.248.0
inet6 addr: fe80::120b:a9ff:febf:e8fc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:43878 errors:0 dropped:0 overruns:0 frame:0
TX packets:27630 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:52123963 (52.1 MB) TX bytes:2967812 (2.9 MB)
路线-n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 131.220.207.254 0.0.0.0 UG 0 0 0 wlan0
131.220.200.0 0.0.0.0 255.255.248.0 U 2 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlan0
服务 isc-dhcp-服务器状态
isc-dhcp-server stop/waiting
DHCP服务器
Internet Systems Consortium DHCP Server 4.1-ESV-R4
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Wrote 0 leases to leases file.
No subnet declaration for wlan0 (131.220.201.217).
** Ignoring requests on wlan0. If this is not what
you want, please write a subnet declaration
in your dhcpd.conf file for the network segment
to which interface wlan0 is attached. **
Not configured to listen on any interfaces!
dhcpd eth0
Internet Systems Consortium DHCP Server 4.1-ESV-R4
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Wrote 0 leases to leases file.
No subnet declaration for eth0 (no IPv4 addresses).
** Ignoring requests on eth0. If this is not what
you want, please write a subnet declaration
in your dhcpd.conf file for the network segment
to which interface eth0 is attached. **
Not configured to listen on any interfaces!
答案1
dhcp3 服务器安装 ISC DHCP 服务器变体。
启动后或者不需要时使用以下命令停止服务器:
sudo 服务 isc-dhcp-server 停止 sudo 服务 isc-dhcp-server6 停止
当你准备好参加派对时,先做以下准备:
sudo 服务 isc-dhcp-服务器启动 sudo 服务 isc-dhcp-server6 启动
答案2
有很多选择,但最简单的方法是在聚会之前安装它,然后在连接到另一个网络之前将其卸载。