Автор Тема: Gentoo dhcp server  (Прочетена 5669 пъти)

gizi_

  • Напреднали
  • *****
  • Публикации: 521
  • Distribution: Debian/Lenny, SLES/9-11
  • Window Manager: Gnome 2.22.3
    • Профил
Gentoo dhcp server
« -: Oct 07, 2006, 16:40 »
Имам един компютър на Гентоо 2006.0 и искам да го накарам да рутира интернет през eth1.Инсталирах му едно dhcp след което си му направих настройките на /etc/dhcp/dhcpd.conf, а те са следните:

authoritative;
ddns-update-style ad-hoc;

subnet 192.168.0.0 netmask 255.255.255.0 {
    option routers 192.168.0.1;
    option subnet-mask 255.255.255.0;
    option domain-name-servers 10.0.0.1, 141.70.120.53; -> това си ми е от доставчика
    option domain-name "vaih.whnetz"; -> както и това
    range 192.168.0.2 192.168.0.252;
    default-lease-time 21600;
    max-lease-time 43200;
host Niki { -> името на лаптопа ми който е най често свързан
    hardware ethernet 00:ХХ:ХХ:ХХ:ХХ:ХХ; -> и МАС му
    fixed-address 192.168.0.2;
    }
}

след което разреших ip_forward в /etc/sysctl.conf -> net.ipv4.ip_forward = 1 както и echo "1" > /proc/sys/net/ipv4/ip_forward и реших да го пусна да видя какво ще се получи но не.След като проверих какво казва и Google от там промених и /etc/conf.d/dhcpd добавих DHCPD_IFACE="eth1" но отново резулатат няма.Правих си и различни опити с /etc/conf.d/net там пробвах да добавя как да се стартира eth1.Единственто нещо което забелязах е че когато предварително задам ip адрес на eth1 който естествено трябва да съвпада с този в /etc/dhcp/dhcpd.conf тогава го стартира без проблем като даже и машината включена на eth1 си взима ip адреса без проблем но нет въпреки всичко не теква.Не искам да го правя със статични ip-та защото към този компютър се включват различни компютри и не е удобно всеки път да им се задават ip-та.Според мен има проблем с разпознаването на eth1 при стартирането на DHCP Server.Знам че при Убунту примерно има един файл dhcp3-server в /etc/default/ в който може да  се зададе на кой eth да пуска dhcp но при Гентоо такъв няма още повече нали уж за това писах в /etc/conf.d/dhcpd.



Активен

Dean79

  • Напреднали
  • *****
  • Публикации: 151
    • Профил
Gentoo dhcp server
« Отговор #1 -: Oct 07, 2006, 16:44 »
ifconfig eth1 192.168.x.x netmask 255.255.255.0
dhcpd eth1


Хубаво си пуснал DHCP  и си разрешил forward-а , ама пакетния филтър какво ти казва ?



Активен

gizi_

  • Напреднали
  • *****
  • Публикации: 521
  • Distribution: Debian/Lenny, SLES/9-11
  • Window Manager: Gnome 2.22.3
    • Профил
Gentoo dhcp server
« Отговор #2 -: Oct 08, 2006, 20:51 »
# dhcpd eth1
Internet Systems Consortium DHCP Server V3.0.3-Gentoo-r9
Copyright 2004-2005 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 1 leases to leases file.

No subnet declaration for eth1 (0.0.0.0).
** 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. **


Not configured to listen on any interfaces!

If you did not get this software from ftp.isc.org, please
get the latest from ftp.isc.org and install that before
requesting help.

If you did get this software from ftp.isc.org and have not
yet read the README, please read it before requesting help.
If you intend to request help from the dhcp-server@isc.org
mailing list, please read the section on the README about
submitting bug reports and requests for help.

Please do not under any circumstances send requests for
help directly to the authors of this software - please
send them to the appropriate mailing list as described in
the README file.

exiting.

Това трябва ли да ме навежда на мисълта че не ми е конфигуриран правилно интерфейса(eth1) и къде трябва да го конфигурирам.Нали съм го описал в -> /etc/conf.d/dhcpd

DHCPD_CONF="/etc/dhcp/dhcpd.conf"

# Configure which interface or interfaces to for dhcpd to listen on.
# List all interfaces space separated. If this is not specified then
# we listen on all interfaces.
DHCPD_IFACE="eth1"

# Insert any other dhcpd options - see the man page for a full list.
DHCPD_OPTS=""
Активен

alabal

  • Напреднали
  • *****
  • Публикации: 2173
  • cat /earth/europe/bg/sofia | grep Nacamura
    • Профил
Gentoo dhcp server
« Отговор #3 -: Oct 08, 2006, 21:29 »
Цитат
No subnet declaration for eth1 (0.0.0.0).


Виж как ти е описан subnet - да не би вместо 10.0.0.0 да си написал 0.0.0.0 и дали имаш въобще нейде subnet в  /etc/dhcp/dhcpd.conf
IP адреса на eth1 трябва да е някой от range на subnet.
Активен

It makes you awful glad that you were born a man.

Dean79

  • Напреднали
  • *****
  • Публикации: 151
    • Профил
Gentoo dhcp server
« Отговор #4 -: Oct 08, 2006, 23:43 »
Да не би случайно да си забравил да направиш ето това?
ifconfig eth1 192.168.0.1 netmask 255.255.255.0 up
'<img'>?'<img'>?'<img'>??
Активен

gizi_

  • Напреднали
  • *****
  • Публикации: 521
  • Distribution: Debian/Lenny, SLES/9-11
  • Window Manager: Gnome 2.22.3
    • Профил
Gentoo dhcp server
« Отговор #5 -: Oct 09, 2006, 02:27 »
Ами аз мога да вдигна интерфейса и след това даже и dhcp сработва ама интенет няма.Няма даже пинг от втората машина към DNS-a.Незнам защо така уж всико му е наред.
Активен

gizi_

  • Напреднали
  • *****
  • Публикации: 521
  • Distribution: Debian/Lenny, SLES/9-11
  • Window Manager: Gnome 2.22.3
    • Профил
Gentoo dhcp server
« Отговор #6 -: Oct 09, 2006, 02:31 »
Ами аз мога да вдигна интерфейса и след това даже и dhcp сработва ама интернет няма.Няма даже пинг от втората машина към DNS-a.Незнам защо така уж всико му е наред.
Активен

Dean79

  • Напреднали
  • *****
  • Публикации: 151
    • Профил
Gentoo dhcp server
« Отговор #7 -: Oct 09, 2006, 07:25 »
Виж тази статия:
http://www.linux-bg.org/cgi-bin....9911239
Активен

gizi_

  • Напреднали
  • *****
  • Публикации: 521
  • Distribution: Debian/Lenny, SLES/9-11
  • Window Manager: Gnome 2.22.3
    • Профил
Gentoo dhcp server
« Отговор #8 -: Oct 12, 2006, 01:14 »
Здравейте на всички отново!Искам да кажа че проблема си го реших до някъде или поне времено с един скрипт за iptables.Е не стана с DHCP.Доста опити направих и не успях.Явно е че някъде бъркам но за сега и с това ще се задоволя.Ако някой иска скрипта може да го paste тук.Благодаря на всички отзовали се.
Активен

redcure

  • Напреднали
  • *****
  • Публикации: 914
    • Профил
Gentoo dhcp server
« Отговор #9 -: Oct 12, 2006, 03:15 »
Какъв е скрипта?
Активен

Debian testing 2.6.18, Enlightenment DR17

http://www.debian.org/doc/manuals/apt-howto/index.en.html

gizi_

  • Напреднали
  • *****
  • Публикации: 521
  • Distribution: Debian/Lenny, SLES/9-11
  • Window Manager: Gnome 2.22.3
    • Профил
Gentoo dhcp server
« Отговор #10 -: Oct 12, 2006, 14:29 »
#!/bin/sh
#
# rc.firewall-iptables
FWVER=0.76
#
#               Initial SIMPLE IP Masquerade test for 2.6 / 2.4 kernels
#               using IPTABLES.  
#
#               Once IP Masquerading has been tested, with this simple
#               ruleset, it is highly recommended to use a stronger
#               IPTABLES ruleset either given later in this HOWTO or
#               from another reputable resource.
#
#
#
# Log:
#       0.76 - Added comments on why the default policy is ACCEPT
#       0.75 - Added more kernel modules to the comments section
#       0.74 - the ruleset now uses modprobe vs. insmod
#       0.73 - REJECT is not a legal policy yet; back to DROP
#       0.72 - Changed the default block behavior to REJECT not DROP
#       0.71 - Added clarification that PPPoE users need to use
#              "ppp0" instead of "eth0" for their external interface
#       0.70 - Added commented option for IRC nat module
#            - Added additional use of environment variables
#            - Added additional formatting
#       0.63 - Added support for the IRC IPTABLES module
#       0.62 - Fixed a typo on the MASQ enable line that used eth0
#              instead of $EXTIF
#       0.61 - Changed the firewall to use variables for the internal
#              and external interfaces.
#       0.60 - 0.50 had a mistake where the ruleset had a rule to DROP
#              all forwarded packets but it didn't have a rule to ACCEPT
#              any packets to be forwarded either
#            - Load the ip_nat_ftp and ip_conntrack_ftp modules by default
#       0.50 - Initial draft
#

echo -e "\n\nLoading simple rc.firewall-iptables version $FWVER..\n"


# The location of the iptables and kernel module programs
#
#   If your Linux distribution came with a copy of iptables,
#   most likely all the programs will be located in /sbin.  If
#   you manually compiled iptables, the default location will
#   be in /usr/local/sbin
#
# ** Please use the "whereis iptables" command to figure out
# ** where your copy is and change the path below to reflect
# ** your setup
#
#IPTABLES=/sbin/iptables
IPTABLES=/sbin/iptables
DEPMOD=/sbin/depmod
MODPROBE=/sbin/modprobe


#Setting the EXTERNAL and INTERNAL interfaces for the network
#
#  Each IP Masquerade network needs to have at least one
#  external and one internal network.  The external network
#  is where the natting will occur and the internal network
#  should preferably be addressed with a RFC1918 private address
#  scheme.
#
#  For this example, "eth0" is external and "eth1" is internal"
#
#
#  NOTE:  If this doesnt EXACTLY fit your configuration, you must
#         change the EXTIF or INTIF variables above. For example:
#
#            If you are a PPPoE or analog modem user:
#
#               EXTIF="ppp0"
#
#
EXTIF=`ifconfig | grep "Hardware Adresse 00:XX:XX:XX:XX:XX" | awk '{print $1}'`
INTIF=`ifconfig | grep "Hardware Adresse 00:XX:XX:XX:XX:XX" | awk '{print $1}'`
echo "   External Interface:  $EXTIF"
echo "   Internal Interface:  $INTIF"


#======================================================================
#== No editing beyond this line is required for initial MASQ testing ==


echo -en "   loading modules: "

# Need to verify that all modules have all required dependencies
#
echo "  - Verifying that all kernel modules are ok"
$DEPMOD -a

# With the new IPTABLES code, the core MASQ functionality is now either
# modular or compiled into the kernel.  This HOWTO shows ALL IPTABLES
# options as MODULES.  If your kernel is compiled correctly, there is
# NO need to load the kernel modules manually.  
#
#  NOTE: The following items are listed ONLY for informational reasons.
#        There is no reason to manual load these modules unless your
#        kernel is either mis-configured or you intentionally disabled
#        the kernel module autoloader.
#

# Upon the commands of starting up IP Masq on the server, the
# following kernel modules will be automatically loaded:
#
# NOTE:  Only load the IP MASQ modules you need.  All current IP MASQ
#        modules are shown below but are commented out from loading.
# ===============================================================

echo "----------------------------------------------------------------------"

#Load the main body of the IPTABLES module - "iptable"
#  - Loaded automatically when the "iptables" command is invoked
#
#  - Loaded manually to clean up kernel auto-loading timing issues
#
echo -en "ip_tables, "
$MODPROBE ip_tables


#Load the IPTABLES filtering module - "iptable_filter"
#  - Loaded automatically when filter policies are activated


#Load the stateful connection tracking framework - "ip_conntrack"
#
# The conntrack  module in itself does nothing without other specific
# conntrack modules being loaded afterwards such as the "ip_conntrack_ftp"
# module
#
#  - This module is loaded automatically when MASQ functionality is
#    enabled
#
#  - Loaded manually to clean up kernel auto-loading timing issues
#
echo -en "ip_conntrack, "
$MODPROBE ip_conntrack


#Load the FTP tracking mechanism for full FTP tracking
#
# Enabled by default -- insert a "#" on the next line to deactivate
#
echo -en "ip_conntrack_ftp, "
$MODPROBE ip_conntrack_ftp


#Load the IRC tracking mechanism for full IRC tracking
#
# Enabled by default -- insert a "#" on the next line to deactivate
#
echo -en "ip_conntrack_irc, "
$MODPROBE ip_conntrack_irc


#Load the general IPTABLES NAT code - "iptable_nat"
#  - Loaded automatically when MASQ functionality is turned on
#
#  - Loaded manually to clean up kernel auto-loading timing issues
#
echo -en "iptable_nat, "
$MODPROBE iptable_nat


#Loads the FTP NAT functionality into the core IPTABLES code
# Required to support non-PASV FTP.
#
# Enabled by default -- insert a "#" on the next line to deactivate
#
echo -en "ip_nat_ftp, "
$MODPROBE ip_nat_ftp


#Loads the IRC NAT functionality into the core IPTABLES code
# Required to support NAT of IRC DCC requests
#
# Disabled by default -- remove the "#" on the next line to activate
#
#echo -e "ip_nat_irc"
#$MODPROBE ip_nat_irc

echo "----------------------------------------------------------------------"

# Just to be complete, here is a partial list of some of the other  
# IPTABLES kernel modules and their function.  Please note that most
# of these modules (the ipt ones) are automatically loaded by the
# master kernel module for proper operation and don't need to be
# manually loaded.
# --------------------------------------------------------------------
#
#    ip_nat_snmp_basic - this module allows for proper NATing of some
#                        SNMP traffic
#
#    iptable_mangle    - this target allows for packets to be
#                        manipulated for things like the TCPMSS
#                        option, etc.
#
# --
#
#    ipt_mark       - this target marks a given packet for future action.
#                     This automatically loads the ipt_MARK module
#
#    ipt_tcpmss     - this target allows to manipulate the TCP MSS
#                     option for braindead remote firewalls.
#                     This automatically loads the ipt_TCPMSS module
#
#    ipt_limit      - this target allows for packets to be limited to
#                     to many hits per sec/min/hr
#
#    ipt_multiport  - this match allows for targets within a range
#                     of port numbers vs. listing each port individually
#
#    ipt_state      - this match allows to catch packets with various
#                     IP and TCP flags set/unset
#
#    ipt_unclean    - this match allows to catch packets that have invalid
#                     IP/TCP flags set
#
#    iptable_filter - this module allows for packets to be DROPped,
#                     REJECTed, or LOGged.  This module automatically
#                     loads the following modules:
#
#                     ipt_LOG - this target allows for packets to be
#                               logged
#
#                     ipt_REJECT - this target DROPs the packet and returns
#                                  a configurable ICMP packet back to the
#                                  sender.
#

echo -e "   Done loading modules.\n"



#CRITICAL:  Enable IP forwarding since it is disabled by default since
#
#           Redhat Users:  you may try changing the options in
#                          /etc/sysconfig/network from:
#
#                       FORWARD_IPV4=false
#                             to
#                       FORWARD_IPV4=true
#
echo "   Enabling forwarding.."
echo "1" > /proc/sys/net/ipv4/ip_forward


# Dynamic IP users:
#
#   If you get your IP address dynamically from SLIP, PPP, or DHCP,
#   enable this following option.  This enables dynamic-address hacking
#   which makes the life with Diald and similar programs much easier.
#
echo "   Enabling DynamicAddr.."
echo "1" > /proc/sys/net/ipv4/ip_dynaddr


# Enable simple IP forwarding and Masquerading
#
#  NOTE:  In IPTABLES speak, IP Masquerading is a form of SourceNAT or SNAT.
#
#  NOTE #2:  The following is an example for an internal LAN address in the
#            192.168.0.x network with a 255.255.255.0 or a "24" bit subnet mask
#            connecting to the Internet on external interface "eth0".  This
#            example will MASQ internal traffic out to the Internet but not
#            allow non-initiated traffic into your internal network.
#
#            
#         ** Please change the above network numbers, subnet mask, and your
#         *** Internet connection interface name to match your setup
#        

#!/bin/sh
#
# Partial IPTABLES config to enable simple IP forwarding and Masquerading
# v0.61
#
#  NOTE:  The following is an example to allow only IP Masquerading for the
#         192.168.0.2 and 192.168.0.8 machines with a 255.255.255.0 or a
#         "/24" subnet mask connecting to the Internet on interface eth0.
#
#         ** Please change the network number, subnet mask, and the Internet
#         ** connection interface name to match your internal LAN setup
#
echo "  - Setting the default FORWARD policy to DROP"
$IPTABLES -P FORWARD DROP

echo "  - Enabling SNAT (IPMASQ) functionality on $EXTIF"
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -s 192.168.1.2/32 -j MASQUERADE
#$IPTABLES -t nat -A POSTROUTING -o $EXTIF -s 192.168.0.8/32 -j MASQUERADE

echo "  - Setting the FORWARD policy to 'DROP' all incoming / unrelated traffic"
$IPTABLES -A INPUT -i $EXTIF -m state --state NEW,INVALID -j DROP
$IPTABLES -A FORWARD -i $EXTIF -m state --state NEW,INVALID -j DROP


#Clearing any previous configuration
#
#  Unless specified, the defaults for INPUT and OUTPUT is ACCEPT
#    The default for FORWARD is DROP (REJECT is not a valid policy)
#
#   Isn't ACCEPT insecure?  To some degree, YES, but this is our testing
#   phase.  Once we know that IPMASQ is working well, I recommend you run
#   the rc.firewall-*-stronger rulesets which set the defaults to DROP but
#   also include the critical additional rulesets to still let you connect to
#   the IPMASQ server, etc.
#
echo "   Clearing any existing rules and setting default policy.."
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F

echo "   FWD: Allow all connections OUT and only existing and related ones IN"
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -j LOG

echo "   Enabling SNAT (MASQUERADE) functionality on $EXTIF"
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

echo -e "\nrc.firewall-iptables v$FWVER done.\n"

redcure знам, че ти също беше дал скрипт не съм ги сравнявал двата.Може и същия да е.
Активен

redcure

  • Напреднали
  • *****
  • Публикации: 914
    • Профил
Gentoo dhcp server
« Отговор #11 -: Oct 12, 2006, 14:54 »
Не е, но просто исках да го видя '<img'>

Всичко най-свежо от мен
Активен

Debian testing 2.6.18, Enlightenment DR17

http://www.debian.org/doc/manuals/apt-howto/index.en.html

phantomlord

  • Напреднали
  • *****
  • Публикации: 1832
  • Distribution: Debian Sid
  • Window Manager: KDE 4
  • Fall to your knees and bow to the Phantom Lord
    • Профил
    • WWW
Gentoo dhcp server
« Отговор #12 -: Oct 12, 2006, 19:23 »
Цитат

ddns-update-style none;

subnet 192.168.0.0 netmask 255.255.255.0 {
   option routers 192.168.0.1;
   option subnet-mask 255.255.255.0;
   option domain-name-servers 10.0.0.1, 141.70.120.53; -> това си ми е от доставчика
   option domain-name "vaih.whnetz"; -> както и това
   range 192.168.0.2 192.168.0.252;
   default-lease-time 21600;
   max-lease-time 43200;
host Niki { -> името на лаптопа ми който е най често свързан
   hardware ethernet 00:ХХ:ХХ:ХХ:ХХ:ХХ; -> и МАС му
   fixed-address 192.168.0.2;
   }
}

/etc/default/dhcp3-server:
Примерен код
# Defaults for dhcp initscript
# sourced by /etc/init.d/dhcp
# installed at /etc/default/dhcp3-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#   Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth1"


Може да пробваш и така с DHCP-то.



Активен

http://myfreesoft.net/phpBB2/index.php?c=7
Помогни си сам, за да ти помогне и Господ
Linux - connecting people...

gizi_

  • Напреднали
  • *****
  • Публикации: 521
  • Distribution: Debian/Lenny, SLES/9-11
  • Window Manager: Gnome 2.22.3
    • Профил
Gentoo dhcp server
« Отговор #13 -: Oct 13, 2006, 02:38 »
Пробвал съм има нещо друго което не разбирам още повече при Гентоо такова нещо като /etc/default/dhcp3-server няма.Ако го създам този файл отново не става.Някъде другаде има проблем.Последно на старото ми Убунту от теб гледах настройките и тогава тръгна но вече и не знам как(беше и доста отдавна).Сега пробвах и на убунту със същите настройки но и то не сработи нищо не разбирам.Прочетох настройките и в викито на Убунту.Не иска да ми стартира DHCP server дава си ми fail и това е.Ще пробвам отново няма да се откажа но се нуждаех от спешно решение и това с iptables ме устройва защото на лаптопа ми трябва интенет.Мерси все пак на всички и когато успея ще пиша да кажа какъв е бил проблема.
Активен

alabal

  • Напреднали
  • *****
  • Публикации: 2173
  • cat /earth/europe/bg/sofia | grep Nacamura
    • Профил
Gentoo dhcp server
« Отговор #14 -: Oct 13, 2006, 20:35 »
Братко, и аз много мразя като видя двете червени удивителни при /etc/init.d/dhcpd restart. Брзия начин да намериш решение е да отвориш две конзоли в едната да напишеш:
# tail -f /var/log/messages
а след това в другата:
/etc/init.d/dhcpd start
 и да видиш какво ти говори dhcpd.

P.S.: А, по-нагоре видях, че вероятно си го направил. Нищо. Има ли разлика в лога след като експериментира или си е все същото.
/etc/default/dhcp3-server е чисто дебиански файл за настройки - няма как да го има в Gentoo. Изпълнява същите функции като /etc/dhcp/dhcpd.conf но очевидно е кръстен на пакета, който инсталира dhcp в Дебиан.



Активен

It makes you awful glad that you were born a man.

Подобни теми
Заглавие Започната от Отговора Прегледи Последна публикация
DHCP server
Настройка на програми
GrimReaper 7 4060 Последна публикация Nov 09, 2005, 10:10
от PhobosK
Настройка на DHCP Server под Slackware 9 или 10.2
Настройка на програми
Ali Nebi 4 3680 Последна публикация Dec 07, 2005, 01:18
от Ali Nebi
Настройка на dhcp server във vmware?
Настройка на програми
korea60 2 1399 Последна публикация Jul 15, 2014, 14:56
от korea60
ПРЕМЕСТЕНО: Настройка на dhcp server във vmware?
Десктопи
neter 0 1768 Последна публикация Jul 15, 2014, 14:00
от neter
FreeBSD DHCP Server
Настройки на софтуер
supportpc 13 6414 Последна публикация Aug 14, 2015, 11:53
от daniel_vulchev