dhcp3 servermc - udost

Masz problemy z siecią bądź internetem? Zapytaj tu
canibals
Posty: 16
Rejestracja: 07 marca 2009, 16:48

dhcp3 server - udostępnianie internetu przez wifi

Post autor: canibals »

Witam.
Chcę sobie zrobić coś podobnego do serwera z laptopa by udostępnić internet poprzez wifi dla telefonu (sieć typu ad hoc odpada bo ten model telefonu nie obsługuje tego) i już na samym początku mam problem z serwerem dhcp, nie chce działać.
Po kolei przedstawię moje zestawienie.
System Debian Lenny 5.0.5
jajko 2.6.26-2-686
karta wifi atheros z zainstalowanym sterownikiem madwifi, który umożliwia jej prace jako punkt dostępowy
internet mam z sieci lokalnej. Adres dostaję przez dhcp (192.168.0.28).
Zawartość pliku etc/network/interfaces:

Kod: Zaznacz cały

# 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

auto eth0
iface eth0 inet dhcp

auto ath0
iface ath0 inet static
address 192.168.1.1
netmask 255.255.255.0
Zawartość pliku dhcpd.conf:

Kod: Zaznacz cały

#
# Sample configuration file for ISC dhcpd for Debian
#
# $Id: dhcpd.conf,v 1.1.1.1 2002/05/21 00:07:44 peloy Exp $
#

ddns-update-style none;
subnet 192.168.1.0 netmask 255.255.255.0 {
    interface ath0;
    range dynamic-bootp 192.168.1.2 192.168.1.6;
    option subnet-mask 255.255.255.0;
    option broadcast-address 192.168.1.255;
    option routers 192.168.1.1;
    option domain-name-servers 194.204.159.1, 194.204.152.34;
    #deny unknown-clients;
    default-lease-time 86400;
}
Zawartość pliku /etc/default/dhcp3-server:

Kod: Zaznacz cały

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="ath0"
Zawartość pliku etc/rc.local:

Kod: Zaznacz cały

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

echo "Konfigurowanie ath0..."
wlanconfig ath0 destroy
sleep 30
wlanconfig ath0 create wlandev wifi0 wlanmode ap
sleep 1
iwconfig ath0 essid htc
sleep 1
iwconfig ath0 channel 6
sleep 1
Interfejs po uruchomieniu systemu:

Kod: Zaznacz cały

lysy:/home/lysy# ifconfig ath0
ath0      Link encap:Ethernet  HWaddr 06:15:af:41:d3:a4
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lysy:/home/lysy# iwconfig ath0
ath0      IEEE 802.11g  ESSID:"htc"  Nickname:""
          Mode:Master  Frequency:2.437 GHz  Access Point: Not-Associated
          Bit Rate:0 kb/s   Tx-Power:17 dBm   Sensitivity=1/1
          Retry :o ff   RTS thr :o ff   Fragment thr :o ff
          Encryption key :o ff
          Power Management :o ff
          Link Quality=0/70  Signal level=-96 dBm  Noise level=-96 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
mariaczi
Member
Posty: 1343
Rejestracja: 08 lutego 2008, 12:58
Lokalizacja: localhost@śląskie

Post autor: mariaczi »

A jak wygląda konfiguracja interfejsu wifi0? To chyba jego tworzysz i z niego dalej chcesz korzystać? Czyli jemu należy się odpowiednia konfiguracja sieci i na nim DHCP powinien nasłuchiwać.
canibals
Posty: 16
Rejestracja: 07 marca 2009, 16:48

Post autor: canibals »

jestem początkujący jeżeli chodzi o Linuksa i czytałem przed zabraniem się do konfiguracji, że karta musi pracować w trybie punktu dostępowego (chyba że źle zrozumiałem), a na to pozwalają sterowniki madwifi.
Przedstawiam resztę interfejsów po uruchomieniu systemu.

Kod: Zaznacz cały

lysy:/home/lysy# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wifi0     no wireless extensions.

ath0      IEEE 802.11g  ESSID:"htc"  Nickname:""
          Mode:Master  Frequency:2.437 GHz  Access Point: Not-Associated
          Bit Rate:0 kb/s   Tx-Power:17 dBm   Sensitivity=1/1
          Retry :o ff   RTS thr :o ff   Fragment thr :o ff
          Encryption key :o ff
          Power Management :o ff
          Link Quality=0/70  Signal level=-96 dBm  Noise level=-96 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Tak wygląda interfejs po wydaniu polecenia:

Kod: Zaznacz cały

lysy:/home/lysy# ifconfig ath0 up
lysy:/home/lysy# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wifi0     no wireless extensions.

ath0      IEEE 802.11g  ESSID:"htc"  Nickname:""
          Mode:Master  Frequency:2.437 GHz  Access Point: 06:15:AF:41 :D 3:A4
          Bit Rate:0 kb/s   Tx-Power:17 dBm   Sensitivity=1/1
          Retry :o ff   RTS thr :o ff   Fragment thr :o ff
          Encryption key :o ff
          Power Management :o ff
          Link Quality=0/70  Signal level=-96 dBm  Noise level=-96 dBm
          Rx invalid nwid:5  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Kod: Zaznacz cały

lysy:/home/lysy# ifconfig ath0
ath0      Link encap:Ethernet  HWaddr 06:15:af:41:d3:a4
          inet6 addr: fe80::415:afff:fe41:d3a4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:3065 (2.9 KiB)
Po wydaniu tego polecenia telefon widzi sieć ale się z nią nie łączy.

Wynik polecenia:

Kod: Zaznacz cały

lspci

Kod: Zaznacz cały

00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express Memory Controller Hub (rev 03)
00:01.0 PCI bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express PCI Express Root Port (rev 03)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 02)
00:1c.2 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 3 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 02)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 02)
01:00.0 VGA compatible controller: nVidia Corporation G72M [Quadro NVS 110M/GeForce Go 7300] (rev a1)
04:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01)
05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 01)
06:04.0 CardBus bridge: Texas Instruments PCIxx12 Cardbus Controller
06:04.1 FireWire (IEEE 1394): Texas Instruments PCIxx12 OHCI Compliant IEEE 1394 Host Controller
06:04.2 Mass storage controller: Texas Instruments 5-in-1 Multimedia Card Reader (SD/MMC/MS/MS PRO/xD)
06:04.3 SD Host controller: Texas Instruments PCIxx12 SDA Standard Compliant SD Host Controller
Po kilku dniach walki doszedłem co zrobić by DHCP "działało".
Robię tak, po uruchomieniu systemu wydaje polecenie:

Kod: Zaznacz cały

ysy:/home/lysy# ifconfig ath0 192.168.1.1
lysy:/home/lysy# ifconfig ath0
ath0      Link encap:Ethernet  HWaddr 06:15:af:41:d3:a4
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::415:afff:fe41:d3a4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:6211 (6.0 KiB)
Wtedy jest widoczny punkt dostępowy dla telefonu ale się niechce z nim połączyć.
Dopiero gdy wydam polecenie

Kod: Zaznacz cały

lysy:/home/lysy# /etc/init.d/dhcp3-server restart
Stopping DHCP server: dhcpd3.
Starting DHCP server: dhcpd3.

Telefon się łączy ale co około 20 30 sekund zrywa połączenie i na nowo nawiązuje,
gdy pinguje telefon to nie zrywa wtedy połączenia.
No to teraz jak to wszystko ogarnąć by interfejs ath0 startował z systemem z ustawieniami 192.168.1.1 przed uruchomieniem serwera dhcp.
canibals
Posty: 16
Rejestracja: 07 marca 2009, 16:48

Post autor: canibals »

Uporałem się z tym DHCP, wszystko się uruchamia jak należy.
Teraz mam problem z udostępnieniem internetu. Jakiej regułki iptables muszę użyć aby zadziałało, próbowałem na kilku znalezionych w sieci ale nie uruchamia się.
ODPOWIEDZ