AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / unix / Perguntas / 781803
Accepted
PhilBot
PhilBot
Asked: 2024-08-13 00:42:48 +0800 CST2024-08-13 00:42:48 +0800 CST 2024-08-13 00:42:48 +0800 CST

Servidor DHCP systemd-networkd Falha ao configurar o pool de endereços para a instância do servidor DHCPv4: resultado numérico fora do intervalo

  • 772

Estou usando o systemd networkd versão 253.1. Tenho 2 portas Ethernet na minha caixa Linux 5.15 e quero configurar um servidor DHCP na segunda porta. Eu fiz isso com sucesso com a seguinte configuração para eth1.

Configuração funcional do servidor DHCP:

[Match]
Name=eth1
Type=ether

[DHCPV4]
DUIDType=link-layer
ClientIdentifier=mac

[Network]
Address=172.1.17.1/24
DHCPServer=yes
#IPMasquerade=ipv4

[DHCPServer]
PoolOffset=1
PoolSize=8

Agora, quero alterar o intervalo para o seguinte:

[Match]
Name=eth1
Type=ether

[DHCPV4]
DUIDType=link-layer
ClientIdentifier=mac

[Network]
#
# 10.1.193.24/29
#
#  Network Address: 10.1.193.24
#  Usable IP Range: 10.1.193.25 - 10.1.193.30
#  Broadcast Address: 10.1.193.31
#
Address= 10.1.193.24/29
DHCPServer=yes
#IPMasquerade=ipv4

[DHCPServer]
PoolOffset=2
PoolSize=5

No entanto, recebo o erro mostrado abaixo:

[root@machine ~]$  networkctl status eth1 -l
* 3: eth1
                     Link File: n/a
                  Network File: /etc/systemd/network/eth1.network
                         State: routable (failed)
                  Online state: online
                          Type: ether
                          Path: platform-30bf0000.ethernet
              Hardware Address: 00:01:c0:37:6d:56 (Company, Ltd.)
                           MTU: 1500 (min: 46, max: 9000)
                         QDisc: mq
  IPv6 Address Generation Mode: eui64
      Number of Queues (Tx/Rx): 8/8
              Auto negotiation: yes
                         Speed: 1Gbps
                        Duplex: full
                          Port: tp
                       Address: 10.1.193.24
                                fe80::201:c0ff:fe37:6d56
             Activation Policy: up
           Required For Online: yes
             DHCP6 Client DUID: DUID-EN/Vendor:0000ab1180dd9f24e9435b570000
           Offered DHCP leases: none

Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Received new foreign route (configured): dst: 10.1.193.24/29, src: n/a, gw: n/a, prefsrc: 10.1.193.24, scope: link, table: main(254), proto: kernel, type: unicast, nexthop: 0, priority: 0, flags: n/a
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Addresses set
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: link_check_ready(): dynamic addresses or routes are not configured.
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Configuring DHCP Server.
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Failed to configure address pool for DHCPv4 server instance: Numerical result out of range
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Failed to configure DHCP server: Numerical result out of range
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Failed
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: State changed: configuring -> failed
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: LLDP Rx: Stopping LLDP client
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: NDISC: Stopping IPv6 Router Solicitation client

Verifiquei várias calculadoras CIDR e acredito que os parâmetros do meu arquivo de configuração são válidos.

insira a descrição da imagem aqui

Por que o networkd não aceita meu arquivo de configuração?

linux
  • 1 1 respostas
  • 20 Views

1 respostas

  • Voted
  1. Best Answer
    larsks
    2024-08-13T05:35:55+08:002024-08-13T05:35:55+08:00

    Acho que o problema aqui é esse 10.1.193.24é o .0endereço desse intervalo CIDR; isso seria como atribuir o endereço 192.168.1.0a um host na 192.168.1.0/24rede. Muitos sistemas consideram este um endereço de broadcast . Parece que systemd-networkdnão permitirá que você atribua esse endereço a uma interface.

    A seguinte configuração funciona bem para mim:

    [Match]
    Name=eth1
    Type=ether
    
    [DHCPV4]
    DUIDType=link-layer
    ClientIdentifier=mac
    
    [Network]
    Address=10.1.193.25/29
    DHCPServer=yes
    
    [DHCPServer]
    PoolOffset=2
    PoolSize=4
    

    Observe o tamanho reduzido do pool, pois com o endereço do servidor em 10.1.193.25 e um deslocamento de 2, temos os seguintes endereços disponíveis:

    10.1.193.27
    10.1.193.28
    10.1.193.29
    10.1.193.30
    

    10.1.193.31é o endereço de transmissão.

    Trazendo isso à tona, vejo nos logs:

    Aug 12 21:35:26 localhost systemd-networkd[699]: eth1: Link UP
    Aug 12 21:35:26 localhost systemd-networkd[699]: eth1: Gained carrier
    Aug 12 21:35:26 localhost systemd-networkd[699]: eth1: found matching network '/etc/systemd/network/internal.network', based on potentially unpredictable interface name.
    Aug 12 21:35:27 localhost systemd-networkd[699]: eth1: Gained IPv6LL
    

    E a interface se parece com:

    3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
        link/ether 52:54:00:a6:d6:f9 brd ff:ff:ff:ff:ff:ff
        altname enp2s0
        inet 10.1.193.25/29 brd 10.1.193.31 scope global eth1
           valid_lft forever preferred_lft forever
        inet6 fe80::5054:ff:fea6:d6f9/64 scope link proto kernel_ll
           valid_lft forever preferred_lft forever
    

    Como esperado, se eu colocar cinco máquinas nesta rede, quatro delas conseguirão adquirir uma concessão de DHCP:

    # tcpdump -i eth1 -nn port bootps or port bootpc
    21:51:12.762858 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 52:54:00:66:78:aa, length 282
    21:51:12.762990 IP 10.1.193.25.67 > 10.1.193.27.68: BOOTP/DHCP, Reply, length 279
    21:51:12.879438 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 52:54:00:9e:d6:aa, length 282
    21:51:12.879518 IP 10.1.193.25.67 > 10.1.193.26.68: BOOTP/DHCP, Reply, length 279
    21:51:13.334272 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 52:54:00:09:97:9b, length 276
    21:51:14.014954 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 52:54:00:44:0f:e6, length 282
    21:51:14.015032 IP 10.1.193.25.67 > 10.1.193.29.68: BOOTP/DHCP, Reply, length 279
    21:51:14.065205 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 52:54:00:c1:4f:c8, length 282
    21:51:14.065322 IP 10.1.193.25.67 > 10.1.193.28.68: BOOTP/DHCP, Reply, length 279
    21:51:15.568213 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 52:54:00:09:97:9b, length 276
    21:51:19.808546 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 52:54:00:09:97:9b, length 276
    21:51:28.489925 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 52:54:00:09:97:9b, length 276
    

    Na saída acima, você pode ver as Replymensagens. O host no endereço 52:54:00:09:97:9bnão conseguiu obter uma concessão porque todos os endereços disponíveis já haviam sido atribuídos a outros hosts.

    • 1

relate perguntas

  • Existe uma maneira de fazer ls mostrar arquivos ocultos apenas para determinados diretórios?

  • Inicie/pare o serviço systemd usando o atalho de teclado [fechado]

  • Necessidade de algumas chamadas de sistema

  • astyle não altera a formatação do arquivo de origem

  • Passe o sistema de arquivos raiz por rótulo para o kernel do Linux

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Possível firmware ausente /lib/firmware/i915/* para o módulo i915

    • 3 respostas
  • Marko Smith

    Falha ao buscar o repositório de backports jessie

    • 4 respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    user12345 Falha ao buscar o repositório de backports jessie 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl Por que a maioria dos exemplos do systemd contém WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST

Hot tag

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve