小编Rie*_*ies的帖子

使用 DHCP 和 DNS 配置具有不同主机名的多个接口

我有一台运行 Ubuntu 12.04 服务器的机器,有两个接口(eth0、eth1)连接到网络。我们的网络被设置为一个基于 FreeBSD 的 DHCP 服务器分发租约,并将客户端提供的主机名注册到同一网络上的 DNS 服务器。

这两个接口需要有不同的主机名才能在 DNS 上注册。在 /etc/network/interfaces 中,我为 eth1 添加了主机名:

# The primary network interface (hostname: host0)
auto eth0
iface eth0 inet dhcp

# Secondary interface 
auto eth1
iface eth1 inet dhcp
  hostname host1
Run Code Online (Sandbox Code Playgroud)

dhcp 客户端配置如下所示:

    option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

    send host-name "<hostname>";
    request subnet-mask, broadcast-address, time-offset, routers,
            domain-name, domain-name-servers, domain-search, host-name,
            netbios-name-servers, netbios-scope, interface-mtu,
            rfc3442-classless-static-routes, ntp-servers,
            dhcp6.domain-search, dhcp6.fqdn,
            dhcp6.name-servers, dhcp6.sntp-servers;
Run Code Online (Sandbox Code Playgroud)

获得的租约如下所示:


# /var/run/resolvconf/interface/eth0.dhclient
lease {
  interface …
Run Code Online (Sandbox Code Playgroud)

freebsd networking ubuntu dns dhcp

5
推荐指数
2
解决办法
3万
查看次数

标签 统计

dhcp ×1

dns ×1

freebsd ×1

networking ×1

ubuntu ×1