Linux   发布时间:2022-04-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了linux – 如何在dhcpd中通过MAC地址分配IP大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

如何使用dhcpd分配特定于mac地址的IP地址? 到目前为止我已经尝试过 host blah { hardware ethernet <mac address>; fixed-address <ip address>;} 在我的dhcpd.conf中.但重新启动dhcpd和有问题的mac地址的机器后,我再次获得一个随机IP. 这是完美的格式 – 我使用完全相同.只有我在行尾添加注释(另外).这是
如何使用dhcpd分配特定于mac地址的IP地址?

到目前为止我已经尝试过

host blah { hardware ethernet <mac address>; fixed-address <ip address>;}

在我的dhcpd.conf中.但重新启动dhcpd和有问题的mac地址的机器后,我再次获得一个随机IP.

解决方法

这是完美的格式 – 我使用完全相同.只有我在行尾添加注释(另外).这是从dhcpd.conf工作的摘录:
host wrt45gl-etika  { hardware ethernet 00:21:29:a1:c3:a1; fixed-address ---.219.43.135; } # MSIE routeris WRT54GL

正如@Christoph所提到的,可能会声明全局选项(或使用服务认值),这可能会影响IP分配/可能覆盖它的方式.

从dhcp3-server(v3)迁移到isc-dhcp-server(v4)时,我需要添加一些必需的选项并重写一些声明.但配置文件的结构仍然很简单:

#
# Sample configuration file for ISC dhcpd for Debian
#

# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none',since DHCP v2 didn't
# have support for DDNs.)

ddns-update-style none;

# option deFinitions common to all supported networks...

option domain-name "mf.vu.---";
option domain-name-servers ---.219.80.11,---.219.80.2,---.171.22.22;

default-lease-time 2678400;
max-lease-time 2678400;

# If this DHCP server is the official DHCP server for the local
# network,the authoritative directive should be uncommented.

authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).

log-facility local7;


# The subnet that shares this physical network

shared-network @R_449_10586@L_MF {
 server-name "letta.mf.vu.--";

 subnet ---.219.43.128 netmask 255.255.255.192 {
  option routers ---.219.43.190;
  option broadcast-address ---.219.43.191;

  group {
    host wrt45gl-etika  { hardware ethernet 00:21:29:a1:c3:a1; fixed-address ---.219.43.135; } # MSIE routeris WRT54GL
    # ...
    host saulute        { hardware ethernet 00:21:28:10:f4:16; fixed-address ---.219.43.189;  } # Virtual Qemu PC NIC
  }
 }

 subnet 172.16.43.128 netmask 255.255.255.192 {
  option routers 172.16.43.129;
  option broadcast-address 172.16.43.191;

  group{
    host ligo           { hardware ethernet 08:00:20:7A:E2:70; fixed-address 172.16.43.179;   } #a225 ligo
    # ...
    host vumfsa2        { hardware ethernet 00:80:48:8d:12:f0; fixed-address 172.16.43.140;   } # 118
  }
 }
}

在那里我没有使用池,没有范围声明.只有两个子网声明(一个后跟另一个).

在那里,我没有分配给我的主机的随机IP,这些IP在这里被声明(与MAC绑定).

大佬总结

以上是大佬教程为你收集整理的linux – 如何在dhcpd中通过MAC地址分配IP全部内容,希望文章能够帮你解决linux – 如何在dhcpd中通过MAC地址分配IP所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。