wagnerfs
(usa Fedora)
Enviado em 21/11/2014 - 23:55h
Acabei de realizar os testes aqui com duas máquinas virtuais: CentOS 7 e WindowsXP. Configurei quatro placas virtuais uma para WAN e as demais para a LAN. Os testes foram feitos com sucesso. No início dos testes fiz com o Fedora 20, que é a base do centos7, porém apresentava erro nas interfaces. Só deixava o DHCP funcionar na p7p1 nas demais interfaces dava erro.
Segue abaixo o meu arquivo dhcp.conf:
_______________________________________
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 10.10.10.0 netmask 255.255.255.0 {
range 10.10.10.100 10.10.10.199;
option routers 10.10.10.254;
option domain-name-servers 10.10.10.252;
option broadcast-address 10.10.10.255;
option domain-name "wfs.local";
}
host SRV-DC-01 {
hardware ethernet 08:00:27:D8:71:18;
fixed-address 10.10.10.252;
}
subnet 172.16.1.0 netmask 255.255.255.0 {
range 172.16.1.100 172.16.1.199;
option routers 172.16.1.254;
option domain-name-servers 8.8.8.8;
option broadcast-address 172.16.1.255;
}
subnet 200.200.200.0 netmask 255.255.255.0 {
range 200.200.200.100 200.200.200.199;
option routers 200.200.200.254;
option domain-name-servers 8.8.8.8;
option broadcast-address 200.200.200.255;
}
_______________________________________
Segue o meu arquivo /etc/sysconfig/dhcd:
_______________________________________
# 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.
# If you still insist on adding some command line options,
# copy dhcpd.service from /lib/systemd/system to /etc/systemd/system and modify
# it there.
#
https://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
# example:
# $ cp /usr/lib/systemd/system/dhcpd.service /etc/systemd/system/
# $ vi /etc/systemd/system/dhcpd.service
# $ ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid <your_interface_name(s)>
# $ systemctl --system daemon-reload
# $ systemctl restart dhcpd.service
DHCPDARGS="enp0s8 enp0s9 enp0s10";
Configurei as interfaces como static.
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.10.10.254 netmask 255.255.255.0 broadcast 10.10.10.255
inet6 fe80::a00:27ff:fe05:59c4 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:05:59:c4 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 180 bytes 25352 (24.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s9: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.1.1 netmask 255.255.255.0 broadcast 172.16.1.255
inet6 fe80::a00:27ff:fe7b:b73a prefixlen 64 scopeid 0x20<link>
ether 08:00:27:7b:b7:3a txqueuelen 1000 (Ethernet)
RX packets 69 bytes 9898 (9.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 184 bytes 28780 (28.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s10: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 200.200.200.1 netmask 255.255.255.0 broadcast 200.200.200.255
inet6 fe80::a00:27ff:fe64:80cd prefixlen 64 scopeid 0x20<link>
ether 08:00:27:64:80:cd txqueuelen 1000 (Ethernet)
RX packets 44 bytes 6168 (6.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 85 bytes 13250 (12.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Configuração das interfaces
# cat /etc/sysconfig/network-scripts/ifcfg-enp0s8
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s8
UUID=aabd11bb-7f47-46cf-8e15-f4f96e5be0bf
ONBOOT=yes
HWADDR=08:00:27:05:59:C4
IPADDR0=10.10.10.254
PREFIX0=24
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
# cat /etc/sysconfig/network-scripts/ifcfg-enp0s9
DEVICE="enp0s9"
BOOTPROTO="static"
HWADDR="08:00:27:7B:B7:3A"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR="172.16.1.1"
NETMASK="255.255.255.0"
BROADCAST="172.16.1.255"
# cat /etc/sysconfig/network-scripts/ifcfg-enp0s10
DEVICE="enp0s10"
BOOTPROTO="static"
HWADDR="08:00:27:64:80:CD"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR="200.200.200.1"
NETMASK="255.255.255.0"
BROADCAST="200.200.200.255"
Bom amigo é isso aí! Aqui está tudo funcionando de boa. Dê uma olhada nessas configurações e veja se consegue solucionar o problema.
Detalhe: para visualizar o status do serviço do DHCP, execute o comando systemctl status dhcpd.service. O retorno tem que apresentar que o serviço está running como mostrado abaixo:
# systemctl status dhcpd.service
dhcpd.service - DHCPv4 Server Daemon
Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled)
Active: active (running) since <span class='censurado'>[*****]</span> 2014-11-21 22:40:56 BRT; 12min ago
Docs: man:dhcpd(8)
man:dhcpd.conf(5)
Main PID: 3978 (dhcpd)
Status: "Dispatching packets..."
CGroup: /system.slice/dhcpd.service
└─3978 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid