【问题标题】:how do i specify an interface in dhcpd.conf?如何在 dhcpd.conf 中指定接口?
【发布时间】:2020-04-30 05:22:07
【问题描述】:

我有一个看起来像这样的 dhcpd.conf。 enp2s0接口如何监听?

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page

subnet 192.168.10.0 netmask 255.255.255.0 {
    authoritative;
    range 192.168.10.10 192.168.10.100;
    }

【问题讨论】:

    标签: dhcp


    【解决方案1】:

    在 Red Hat 8 及其衍生版本上,您现在无需执行任何操作,只需正确配置接口和 dhcpd.conf

    [root@foo ~]# cat /etc/sysconfig/dhcpd 
    # WARNING: This file is NOT used anymore.
    
    # If you are here to restrict what interfaces should dhcpd listen on,
    # be aware that dhcpd listens *only* on interfaces for which it finds subnet
    # declaration in dhcpd.conf. It means that explicitly enumerating interfaces
    # also on command line should not be required in most cases.
    ...
    
    

    如果您检查/var/log/messages,您会看到:

    ...
    No subnet declaration for eno1 (no IPv4 addresses).
    ** Ignoring requests on eno1.  If this is not what
      you want, please write a subnet declaration
      in your dhcpd.conf file for the network segment
      to which interface eno1 is attached. **
    ...
    

    所以这应该只是工作 (TM),但会因担心在错误的接口上运行 DHCP 服务器而获得积分。 ;)

    【讨论】:

      【解决方案2】:

      dhcpd 手册页显示:

      命令行

      dhcpd 应该侦听的网络接口的名称 可以在命令行上指定广播。应该这样做 在 dhcpd 无法识别非广播接口的系统上, 但在其他系统上不应该是必需的。如果没有接口名称 在命令行中指定 dhcpd 将识别所有网络 已启动的接口,消除非广播接口,如果 可能,并在每个接口上侦听 DHCP 广播。

      在 Debian 上,必须在 /etc/default/isc-dhcp-server (ref) 中指定 dhcpd 侦听的接口:

      INTERFACES="enp2s0"
      

      在 RedHat 上,它似乎在 /etc/sysconfig/dhcpd (ref):

      DHCPDARGS="enp2s0";
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-05-27
        • 1970-01-01
        • 2016-11-22
        • 1970-01-01
        • 2011-08-31
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多