Автор Тема: Ядове със Dnsmasq  (Прочетена 3391 пъти)

limbozon

  • Гост
Re: Ядове със Dnsmasq
« Отговор #30 -: Mar 25, 2010, 18:37 »
Ip-тата бяха от сорта на 192.168.XXXX
Активен

bop_bop_mara

  • Напреднали
  • *****
  • Публикации: 2433
  • Distribution: Debian Testing
  • Window Manager: LXDE
  • Cute and cuddly
    • Профил
Re: Ядове със Dnsmasq
« Отговор #31 -: Mar 25, 2010, 18:43 »
Виж сега, не може тука да ти вадим думите от устата :)
Предполагам конфигурацията на интерфейсите ти е с /etc/network/interfaces. Дай да я видим. Това кои цифри ползваш, не ни помага особено, за да разберем защо гърми с грешка. Или ги дай грешките от сислога.
Второ, дай я тая конфигурация на dhcp-то, да не би да има някакви разминавания.
Активен

limbozon

  • Гост
Re: Ядове със Dnsmasq
« Отговор #32 -: Mar 25, 2010, 18:53 »
В момента не съм при дебиана.Утре ще опитам отново.
Активен

Acho

  • Напреднали
  • *****
  • Публикации: 5254
  • Distribution: Slackware, MikroTik - сървърно
  • Window Manager: console only
    • Профил
    • WWW
Re: Ядове със Dnsmasq
« Отговор #33 -: Mar 25, 2010, 20:34 »
И аз това исках да напише, на няколко пъти попитах за конкретните стойности. И тук давам пример:

eth0 : auto by dhcp

eth1 - static:
IP - 192.168.0.1
SM - 255.255.255.0

DHCP демона, запуснат на eth1, ще раздава адреси от следния POOL:

IP - от 192.168.0.2 до 192.168.0.254
SM - 255.255.255.0
DG - 192.168.0.1
DNS1 - 83.45.67.89
DNS2 - 83.45.67.88


Ето такова нещо исках да видя. А не -> "Ip-тата бяха от сорта на 192.168.XXXX"
« Последна редакция: Mar 25, 2010, 20:36 от Acho »
Активен

CPU - Intel Quad-Core Q8400, 2.66 GHz; Fan - Intel Box; MB - Intel G41M-T2; RAM - DDR2-800, Kingston HyperX, 2X2048 MB; VC - onboard, Intel G41 Express Chipset; HDD - Toshiba, 500 GB, SATAII; SB - Realtek HD Audio; DVD-RW - TSSTcorp DVD-RW; LAN - Realtek PCI-E GBE Controller; PSU - Fortron 350 Watt.

mitkomihov

  • Напреднали
  • *****
  • Публикации: 15
  • Distribution: Ubuntu 8.10 server
    • Профил
    • WWW
Re: Ядове със Dnsmasq
« Отговор #34 -: Mar 28, 2010, 16:12 »
Наскоро правих нещо подобно. След като тръгна сървъра събрах упътванията в една страница. По принцип е за Убунту сървър, ама може да ти е от полза. Това упътване при мен е напълно работещо, без допълнителни настройки. "eth0" е клиент на рутера, "eth1" раздава адресите на локалната мрежа.

Единствено след като инсталираш DHCP трябва да промениш файла /etc/dhcp3/dhcpd.conf да изглежда примерно така:


# Sample /etc/dhcpd.conf
# (add your comments here)
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.10.255;
option routers 192.168.10.1;
option domain-name-servers 192.168.1.1;
#option domain-name "mydomain.example";
option netbios-name-servers 192.168.10.1;
option netbios-node-type 2;
 

subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.10 192.168.10.100;
}

# 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;


Network Interface Cards

DHCP Server

Install

First install the dhcp3-server package

apt-get install dhcp3-server

Manual Static Address

The first step is to make sure that your internal network functions. You should setup your second Ethernet wired or wireless card and set its IP address to something like "192.168.10.1" via ifconfig utility as follows:

ifconfig eth1 192.168.10.1 netmask 255.255.255.0

Automatic Static Address

This setup will be forgotten after a reboot, its better to add these lines to /etc/network/interfaces (replacing any previous declarations of eth1):

nano -w /etc/network/interfaces

    # The extended interfaces
    auto eth1
    iface eth1 inet static
        address 192.168.10.1
        netmask 255.255.255.0

Testing Static Configuratiom

Check if the previous command worked by typing the following:

ifconfig

The result will look like this

    ifconfig
    eth0 Link encap:Ethernet HWaddr 00:0C:6E:8A:BD:ED
    inet addr:192.168.1.64 Bcast:192.168.1.255 Mask:255.255.255.0
    inet6 addr: fe80::20c:6eff:fe8a:bded/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:80071 errors:0 dropped:0 overruns:0 frame:0
    TX packets:44847 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:119404142 (113.8 MB) TX bytes:3332468 (3.1 MB)
    Interrupt:20
    eth1 Link encap:Ethernet HWaddr 00:20:18:3A:4E:AE
    inet addr:192.168.10.1 Bcast:192.168.10.255 Mask:255.255.255.0
    inet6 addr: fe80::220:18ff:fe3a:4eae/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:2092 errors:0 dropped:0 overruns:0 frame:17
    TX packets:1998 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:158939 (155.2 KB) TX bytes:348453 (340.2 KB)
    Interrupt:16 Base address:0xa800


Assign Network Card

One more thing needs to be configured before we can run the DHCP server Open the file /etc/default/dhcp3-server

nano -w /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"

Explanation: Like the comment it the file says we are specifying the network card which must be used to handle dhcp requests

Finally the setup is done!
Start DHCP server

So lets run the DHCP server with:

/etc/init.d/dhcp3-server start

    * Starting DHCP server dhcpd3
    done.

If it report fails then look at the error log file ($ less /var/log/syslog and press END to view the last events)

Configure NAT

Configure iptables for NAT translation so packets can be correctly routed through the Ubuntu gateway.

sudo iptables -A FORWARD -i eth1 -o eth0 -s 192.168.10.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE


(rule1 allows forwarded packets (initial ones), rule2 allows forwarding of established connection packets (and those related to ones that started), rule3 does the NAT.)

Enable routing

    * Configure the gateway for routing between two interfaces by enabling IP forwarding:

sudo -i
sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
su user



    * Edit /etc/sysctl.conf and add these lines:

net.ipv4.conf.default.forwarding=1
net.ipv4.conf.all.forwarding=1

The /etc/sysctl.conf edit is required because of following Bug (Hardy and later releases) Launchpad Bug Report
Load Firewall Rule

To load our new firewall rule on a reboot.

nano -w /etc/network/interfaces

replacing any previous declarations of eth0

    # The extended interfaces
    auto eth0
    iface eth0 inet dhcp
         pre-up iptables-restore < /etc/iptables.rules
         post-down iptables-save > /etc/iptables.rules


Interfaces Config File

The complete file /etc/network/interfaces should look like this after all the modifications we applied:

    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    auto eth0
    iface eth0 inet dhcp
         pre-up iptables-restore < /etc/iptables.rules
         post-down iptables-save > /etc/iptables.rules

    # The extended interfaces
    auto eth1
    iface eth1 inet static
         address 192.168.10.1
         netmask 255.255.255.0


Special Note

Never do:


apt-get remove ipmasq

Its a stupid thing we learned during testing, this will result in a LOT of malfunctions, so make sure you don’t do stupid things like we did!

Дотук би трябвало да имаш работещ DHCP сървър на "eth1" с форуърдинг и маскарадинг.
« Последна редакция: Mar 28, 2010, 16:38 от mitkomihov »
Активен

limbozon

  • Гост
Re: Ядове със Dnsmasq
« Отговор #35 -: Mar 28, 2010, 19:13 »
Мерси Митко този туториал ще ми помогне много!
Активен

limbozon

  • Гост
Re: Ядове със Dnsmasq
« Отговор #36 -: Mar 30, 2010, 10:28 »
Успях най-накрая успях!Благодаря на всички за отделеното време и затова,че имахте нервите да ме изтърпите!!!!!Можете да затваряте темата.
Активен

b2l

  • Напреднали
  • *****
  • Публикации: 4786
  • Distribution: MCC Interim
  • Window Manager: - // - // -
  • ...sometimes I feel like screaming... || RTFM!
    • Профил
    • WWW
Re: Ядове със Dnsmasq
« Отговор #37 -: Mar 30, 2010, 13:15 »
Хайде сега сподели какво си напавил и как по-точно си успял, за да може някой с подобен проблем като твоя да седне и да прочете.
Активен

"Човекът е въже, опънато между звяра и свръхчовека, въже над пропаст. Човекът е нещо, което трябва да бъде превъзмогнато." - Фр. Ницше

limbozon

  • Гост
Re: Ядове със Dnsmasq
« Отговор #38 -: Mar 30, 2010, 14:42 »
Дългия пост на Миткомихов ми помогна.И сега си имам работещ NAT debian router с работещ dhcp server.
Активен

Подобни теми
Заглавие Започната от Отговора Прегледи Последна публикация
DNSMASQ Проблем
Настройка на програми
lozanoww 8 1346 Последна публикация Mar 09, 2012, 14:58
от Acho
DNSMasq отговаря много бавно на DHCPDISCOVER
Настройка на програми
hojotoho 0 555 Последна публикация Jun 05, 2012, 13:30
от hojotoho