Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  | Правила  

Компьютерный форум OSzone.net » Linux и FreeBSD » Общий по Linux » Debian/Ubuntu - Web, DHCH сервер

Ответить
Настройки темы
Debian/Ubuntu - Web, DHCH сервер

Аватара для mdk666666

Пользователь


Сообщения: 56
Благодарности: 4

Профиль | Отправить PM | Цитировать


Изменения
Автор: mdk666666
Дата: 04-09-2016
Планирую сделать web и dhcp сервер на основе старого компа. Установил isc-dhcp-server. Интернет подается на eth1, а с eth0 он должен идти на ПК с windows. Обнаружил, что в /etc/network/interfaces нет eth0. Добавил строчку
Код: Выделить весь код
auto eth0
iface eth0 inet dhcp
Далее настроил isc-dhcp-server и прописал в файле /etc/dhcp/dhcpd.conf:
Код: Выделить весь код
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "workgroup";

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
range 192.168.1.150 192.168.1.200;
}
в файле /etc/default/isc-dhcp-server выбрал
Код: Выделить весь код
INTERFACES="eth0"
Но ничего не заработало. Что я делаю не так? Может витую пару не так обжал(пк-пк или пк-свич?)?

Отправлено: 14:31, 04-09-2016

 

Аватара для mdk666666

Пользователь


Сообщения: 56
Благодарности: 4

Профиль | Отправить PM | Цитировать


Прочитал, интересная статья, но не совсем то. Я обнаружил что у меня не настроен субнет на eth1 (который инет), если это не та сеть которая вам нужна:

dhcpd

# dhcpd
Internet Systems Consortium DHCP Server 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /etc/dhcp/dhcpd.conf
Database file: /var/lib/dhcp/dhcpd.leases
PID file: /var/run/dhcpd.pid
Wrote 1 leases to leases file.

No subnet declaration for eth1 (159.XXX.XX.45).
** Ignoring requests on eth1. If this is not what
you want, please write a subnet declaration
in your dhcpd.conf file for the network segment
to which interface eth1 is attached. **

Listening on LPF/eth0/00:19:5b:33:8a:0d/192.168.1.0/24
Sending on LPF/eth0/00:19:5b:33:8a:0d/192.168.1.0/24
Sending on Socket/fallback/fallback-net
There's already a DHCP server running.
root@E1sys:/home/elsys#
If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug. These pages explain the proper
process and the information we find helpful for debugging..

exiting.



Мой /etc/dhcp/dhcpd.conf

#
# 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...
default-lease-time 600;
max-lease-time 7200;

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.150 192.168.1.200;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "workgroup";
}
# 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;

# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.

#subnet 10.152.187.0 netmask 255.255.255.0 {
#}

# This is a very basic subnet declaration.

#subnet 10.254.239.0 netmask 255.255.255.224 {
# range 10.254.239.10 10.254.239.20;
# option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
#}

# This declaration allows BOOTP clients to get dynamic addresses,
# which we don't really recommend.

#subnet 10.254.239.32 netmask 255.255.255.224 {
# range dynamic-bootp 10.254.239.40 10.254.239.60;
# option broadcast-address 10.254.239.31;
# option routers rtr-239-32-1.example.org;
#}

# A slightly different configuration for an internal subnet.
#subnet 10.5.5.0 netmask 255.255.255.224 {
# range 10.5.5.26 10.5.5.30;
# option domain-name-servers ns1.internal.example.org;
# option domain-name "internal.example.org";
# option routers 10.5.5.1;
# option broadcast-address 10.5.5.31;
# default-lease-time 600;
# max-lease-time 7200;
#}

# Hosts which require special configuration options can be listed in
# host statements. If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.

#host passacaglia {
# hardware ethernet 0:0:c0:5d:bd:95;
# filename "vmunix.passacaglia";
# server-name "toccata.fugue.com";
#}

# Fixed IP addresses can also be specified for hosts. These addresses
# should not also be listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses have been specified can boot using
# BOOTP or DHCP. Hosts for which no fixed address is specified can only
# be booted with DHCP, unless there is an address range on the subnet
# to which a BOOTP client is connected which has the dynamic-bootp flag
# set.
#host fantasia {
# hardware ethernet 08:00:07:26:c0:a5;
# fixed-address fantasia.fugue.com;
#}

# You can declare a class of clients and then do address allocation
# based on that. The example below shows a case where all clients
# in a certain class get addresses on the 10.17.224/24 subnet, and all
# other clients get addresses on the 10.0.29/24 subnet.

#class "foo" {
# match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
#}

#shared-network 224-29 {
# subnet 10.17.224.0 netmask 255.255.255.0 {
# option routers rtr-224.example.org;
# }
# }
# pool {
# allow members of "foo";
# range 10.17.224.10 10.17.224.250;
# }
# pool {
# deny members of "foo";
# range 10.0.29.10 10.0.29.230;
# }
#}


Отправлено: 18:49, 04-09-2016 | #11



Для отключения данного рекламного блока вам необходимо зарегистрироваться или войти с учетной записью социальной сети.

Если же вы забыли свой пароль на форуме, то воспользуйтесь данной ссылкой для восстановления пароля.


Аватара для ruslandh

info man howto


Сообщения: 6958
Благодарности: 384

Профиль | Сайт | Отправить PM | Цитировать


Нет, вы логику работы не понимаете.
У сервера на eth0 должен быть статический адрес, и он компам, обращаемся к нему по этому интерфейсу раздёт ip адреса, настройки шлюза и dns, так, что-бы компы могли выйти в интернет - его субсеть.
А все другие интерфейсы не должны работать с dhcp, вот если -бы надо было раздавать адреса на других интерфейсах, тогда надо было сделать аналогичное и для них.
Тот интерфейс, который смотрит в инет, в общем случае также получает всё это от dhcp более высокого уровня (например провайдера). А вам надо раздать адреса в своей подсети, висящей на eth0.
Более того, если на eth0 висит только один комп, то можно вообще не использовать dhcp, а всё это прописать статически на клиенте (что присылает обчно dhcp).

-------
Поспешай не торопясь


Отправлено: 19:14, 04-09-2016 | #12


Аватара для MakaBooka

Старожил


Сообщения: 342
Благодарности: 46

Профиль | Отправить PM | Цитировать


Ваша внутренняя сеть - eth0, static ip, на нём слушает iscdhcpd и всем желающим раздаёт ip из своей подсети (точнее из пула, которые в ней выделен).

так понятнее?

Отправлено: 16:44, 05-09-2016 | #13


Аватара для mdk666666

Пользователь


Сообщения: 56
Благодарности: 4

Профиль | Отправить PM | Цитировать


Я уже 20 раз все перенастроил, внешний eth1, внутренний eth 0. Я уже сетевуху сменил, кабель поменял.
настроил несколькими способами. Последний из них:

/etc/default/isc-dhcp-server
server-name DERPian;
authoritative;
ddns-update-style interim;
ignore client-updates;

subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option domain-name "workgroup";
range 192.168.0.4 192.168.0.222;
option domain-name-servers 192.168.0.1, 8.8.8.8;
option ip-forwarding off;
default-lease-time 43200;
max-lease-time 86400;

host DERPian {
hardware ethernet 00:13:60:86:04:8b;
fixed-address 192.168.0.3;
option subnet-mask 255.255.255.0;
option host-name "DERPian";
}
}


/etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth1
iface eth1 inet dhcp

allow-hotplug eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1


В /etc/sysctl.conf заменил строку net.ipv4.ip_forward=0 на net.ipv4.ip_forward=1

Добавил в /etc/rc.local строчку iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

Ничего не помогает, интернета нет.

Отправлено: 20:31, 10-09-2016 | #14


Аватара для ruslandh

info man howto


Сообщения: 6958
Благодарности: 384

Профиль | Сайт | Отправить PM | Цитировать


Цитата mdk666666:
gateway 192.168.0.1 »
Нафига вы указываете в настройках eth0 gateway 192.168.0.1 ?

Цитата mdk666666:
option ip-forwarding off; »
Это зачем.

Рекомендую вам расписать тут каждую строчку - как вы это понимаете.

-------
Поспешай не торопясь


Отправлено: 21:47, 10-09-2016 | #15


Аватара для mdk666666

Пользователь


Сообщения: 56
Благодарности: 4

Профиль | Отправить PM | Цитировать


Цитата ruslandh:
Рекомендую вам расписать тут каждую строчку - как вы это понимаете. »
Я не знаю зачем, но пускай:
server-name DERPian; \\Рандомное имя сервера
authoritative; \\Единственный и неповторимый DHCP сервер в сети
ddns-update-style interim; \\Наверное указывает на то, кто кому, как и когда выдаст данные ipv4
ignore client-updates; \\Игнорировать клиентов и их запросы на смену/получение IP

subnet 192.168.0.0 netmask 255.255.255.0 { \\Задаем в какой подсети будут находятся клиенты
option routers 192.168.0.1; \\ IP DHCP сервера?
option subnet-mask 255.255.255.0; \\ фиг знает, широковещательный сигнал по этому адресу?
option broadcast-address 192.168.0.255; \\ Н.Д.
option domain-name "workgroup"; \\ Название сети, может быть произвольным
range 192.168.0.4 192.168.0.222; \\ пул IP адресов
option domain-name-servers 192.168.0.1, 8.8.8.8; \\Сервера доменных имен, я не знаю что указать, кто-то указывает IP сервера, кто-то ip гугля
option ip-forwarding off; \\ Сделал как в гайде, потом закомментировал эффект нулевой
default-lease-time 43200; \\Время аренды?
max-lease-time 86400; \\Макс время аренды?
host DERPian { \\Дальше идет что-то непонятное просто сделал как по аналогии
hardware ethernet 00:13:60:86:04:8b;
fixed-address 192.168.0.3;
option subnet-mask 255.255.255.0;
option host-name "DERPian";
}
}

allow-hotplug eth0 \\ Разрешить "Горячую замену"
iface eth0 inet static \\ Включить стат IP
address 192.168.0.1 \\ Адрес
netmask 255.255.255.0 \\ Маска подсети
network 192.168.0.0 \\ Сеть????
broadcast 192.168.0.255 \\Хм...
gateway 192.168.0.1 \\Адрес шлюза, мб адрес моего шлюза?

Отправлено: 22:11, 10-09-2016 | #16


Аватара для ruslandh

info man howto


Сообщения: 6958
Благодарности: 384

Профиль | Сайт | Отправить PM | Цитировать


Удалите последнюю строчку.

-------
Поспешай не торопясь


Отправлено: 22:24, 10-09-2016 | #17



Компьютерный форум OSzone.net » Linux и FreeBSD » Общий по Linux » Debian/Ubuntu - Web, DHCH сервер

Участник сейчас на форуме Участник сейчас на форуме Участник вне форума Участник вне форума Автор темы Автор темы Шапка темы Сообщение прикреплено

Похожие темы
Название темы Автор Информация о форуме Ответов Последнее сообщение
Web-сервер в Linux-е cibin Программное обеспечение Linux и FreeBSD 2 28-06-2012 07:36
Сервер сертификации, web vilotiv Microsoft Windows NT/2000/2003 4 11-11-2010 15:09
Использование - Web сервер butterfly83 Лицензирование продуктов Microsoft 1 09-07-2008 14:56
Тормозит WEB сервер?.. :-/ Frodo Sumkin Сетевые технологии 1 23-05-2006 10:08
Web-сервер Scorpion666 Microsoft Windows NT/2000/2003 5 24-01-2006 09:27




 
Переход