Strona 1 z 2

[+] Problem z serwerem dhcp

: 27 października 2014, 11:52
autor: dawidekch
Witam

Zainstalowałem serwer dhcp na Debianie (7.7.0).
Problem polega na tym, że serwer dhcp nie przydziela adresów ip w sieci.

eth0 - połączenie z internetem
eth1 - sieć lokalna


Pliki konfiguracyjne:

/etc/network/interfaces

auto lo eth0 eth1
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
<------>address 10.0.10.1
<------>netmask 255.255.255.0
<------>network 10.0.10.0
<------>broadcast 10.0.0.255

dhcpd.conf
option domain-name “lan.local”;
option domain-name-servers 10.0.10.1, 8.8.8.8;
default-lease-time 3600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 10.0.10.0 netmask 255.255.255.0 {
range 10.0.10.1 10.0.10.150;
option subnet-mask 255.255.255.0;
option broadcast-address 10.0.10.255;
option routers 10.0.10.1;


/etc/sysctl.conf
net.ipv4.ip_forward=1

/etc/rc.local
iptables -P FORWARD ACCEPT
iptables –table nat -A POSTROUTING -o eth0 -j MASQUERADE
exit 0


/etc/default/isc-dhcp-server
INTERFACES="eth1"

/etc/init.d/isc-dhcp-server restart
dhcpd self-test failed. Please fix /etc/dhcp/dhcpd.conf.
The error was:
Internet Systems Consortium DHCP Server 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visithttps://www.isc.org/software/dhcp/
/etc/dhcp/dhcpd.conf line 3: semicolon expected.
option domain-name
^
/etc/dhcp/dhcpd.conf line 23: unexpected end of file
option routers 10.0.10.1;
^
Configuration file errors encountered -- exiting
Co jest nie tak w konfiguracji?

Pozdrawiam

: 27 października 2014, 12:01
autor: pawkrol
Jak widzę adres eth1 masz 10.0.10.1/24, a broadcast 10.0.0.255.
Powinno być broadcast 10.0.10.255 - Twoja sieć

Pokaż także /var/log/syslog

Jak z politykami łańcuchach input output tabeli filter ?

Spróbuj dać spacje przed każdą opcją "option" , brakuje średnika w lini 3
option domain-name;
option routers 10.0.10.1;
Zobacz także czy nie masz jakiś dziwnych znaków na końcu pliku ( /etc/dhcp/dhcpd.conf line 23: unexpected end of file)

: 27 października 2014, 13:13
autor: dawidekch
Zmieniłem broadcast, dodałem spację i przydziela adresy ip w sieci.

Pojawił się nowy problem. Nie działa internet na serwerze.

: 27 października 2014, 13:40
autor: pawkrol
Pokaż

Kod: Zaznacz cały

iptables -L -nvx
iptables -t nat -L -nvx
Czy ping po ip działa? np:

Kod: Zaznacz cały

ping 8.8.8.8

: 27 października 2014, 13:50
autor: dawidekch
iptables -L -nvx
iptables -t nat -L -nvx
ping
Chain INPUT (policy ACCEPT 3905 packets, 716907 bytes) pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 2 packets, 138 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 1214 packets, 128970 bytes)
pkts bytes target prot opt in out source destination



iptables: No chain/target/match by that name.



ping wp.pl -c 4


PING wp.pl (212.77.100.101) 56(84) bytes of data.
From DSK2.local (10.0.10.3) icmp_seq=1 Destination Host Unreachable
From DSK2.local (10.0.10.3) icmp_seq=2 Destination Host Unreachable
From DSK2.local (10.0.10.3) icmp_seq=3 Destination Host Unreachable
From DSK2.local (10.0.10.3) icmp_seq=4 Destination Host Unreachable

--- wp.pl ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3102ms
pipe 3



: 27 października 2014, 14:16
autor: dedito
Kolego dawidekch, miał być ping po IP.
Pytanie czy masz określone serwery dns w resolv.conf.

: 27 października 2014, 14:37
autor: pawkrol
iptables: No chain/target/match by that name.
Podaj jescze raz:

Kod: Zaznacz cały

iptables -t nat -L -nvx
i jeszcze

Kod: Zaznacz cały

ifconfig
Rozumiem, że serwer o którym mowa jest zarazem bramą do internetu.

: 27 października 2014, 14:51
autor: LordRuthwen
A nie jest tak, że sam sobie przydzieliłeś adres?

: 27 października 2014, 17:50
autor: dawidekch
Teraz nie mam dostępu do serwera. Jutro z rana dodam logi z komend.
Jeśli chodzi o ping to nie ma znaczenia czy poda się na www czy na ip. Odpowiedź jest taka sama.
Tak, serwer jest bramą do internetu.
Dopóki serwer DHCP nie działał to internet był na serwerze.

Dziwnie wygląda wpis podczas pingowania: From DSK2.local (10.0.10.3).
Dlaczego pokazuje adres 10.0.10.3?

PS.
Jestem początkującym użytkownikiem linuxa. Dopiero poznaje system.

: 28 października 2014, 07:45
autor: dawidekch
ping 8.8.8.8 -c 4
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 10.0.10.3 icmp_seq=1 Destination Host Unreachable
From 10.0.10.3 icmp_seq=2 Destination Host Unreachable
From 10.0.10.3 icmp_seq=3 Destination Host Unreachable
From 10.0.10.3 icmp_seq=4 Destination Host Unreachable
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3013ms pipe 3
ping 10.0.0.1 -c 3
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_req=1 ttl=128 time=0.160 ms
64 bytes from 10.0.0.1: icmp_req=2 ttl=128 time=0.205 ms
64 bytes from 10.0.0.1: icmp_req=3 ttl=128 time=0.227 ms

-- 10.0.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms

rtt min/avg/max/mdev = 0.160/0.197/0.227/0.030 ms

iptables -t nat -L -nvx
Chain PREROUTING (policy ACCEPT 7033 packets, 1331539 bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 5969 packets, 1275543 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 1159 packets, 139787 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 1159 packets, 139787 bytes)
pkts bytes target prot opt in out source destination


# ifconfig
eth0 Link encap:Ethernet HWaddr 00:e0:4c:3a:b0:80
inet addr:10.0.0.198 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:4cff:fe3a:b080/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:42361 errors:0 dropped:0 overruns:0 frame:0
TX packets:3123 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4253993 (4.0 MiB) TX bytes:344738 (336.6 KiB)
Interrupt:17 Base address:0x3000



eth1 Link encap:Ethernet HWaddr 3c:4a:92:49:12:f8
inet addr:10.0.10.3 Bcast:10.0.10.255 Mask:255.255.255.0
inet6 addr: fe80::3e4a:92ff:fe49:12f8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:72225 errors:0 dropped:0 overruns:0 frame:0
TX packets:9242 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24907893 (23.7 MiB) TX bytes:848404 (828.5 KiB)
Interrupt:19

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:11099 errors:0 dropped:0 overruns:0 frame:0
TX packets:11099 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3208225 (3.0 MiB) TX bytes:3208225 (3.0 MiB)