View previous topic :: View next topic |
Author |
Message |
darkmanPPT Veteran
Joined: 13 Apr 2006 Posts: 1069 Location: vi/bo
|
Posted: Wed Dec 28, 2011 3:22 pm Post subject: [sovled] realizzare un access point con gentoo |
|
|
Il problema è il seguente.
Antefatto:
- Possiedo uno smartphone che però non può collegarsi ad una determinata rete (che chiameremo RETE1) in quanto è necessario far girare un programma .jar che non può girare sullo smartphone.
- Possiedo un pc alla quale ho due interfacce wireless funzionanti (eth1 e wlan2) e con il quale non ho problemi a collegarmi a RETE1
Domanda:
- è possibile far si che una delle due interfacce (ad esempio wlan2) diventi una specie di access point (nome rete ACCESS_POINT) in modo tale che lo smartphone si possa collegare senza troppi problemi (usando crittazione wpa) e che poi il traffico di wlan2 venga rediretto sulla interfaccia eth1 ?
tale argomento è completamente nuovo per me. ho cercato in giro con google e sul forum e par che sia consigliato l'utilizzo di un programma chiamato hostadp.
Ho provato a smanettarci ma non funziona e ho come l'impressione che mi manchi qualcosa.
Allorchè mi piacerebbe capire se sto andando nella direzione giusta oppure ci sono già tool "facili e veloci" per realizzare quel che mi serve.
finora io mi sono installato dhcp (server dhcp) e hostapd.
ho configurato secondo le millemila guide il file /etc/hostapd/hostapd.conf
nel caso, questo è il mio file di configurazione
Code: | cat /etc/hostapd/hostapd.conf
interface=wlan2
driver=rt2800usb
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=1
debug=0
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ssid=pptnetworkdevice
macaddr_acl=0
accept_mac_file=/etc/hostapd/hostapd.accept
deny_mac_file=/etc/hostapd/hostapd.deny
auth_algs=1
wpa=1
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
|
Code: | ls /etc/init.d/net.*
/etc/init.d/net.lo /etc/init.d/net.wlan2
|
Code: | /etc/init.d/hostapd restart
* Bringing up interface wlan2
* Starting wpa_supplicant on wlan2 ...
* Starting wpa_cli on wlan2 ...
* Backgrounding ... ...
* WARNING: net.wlan2 has started, but is inactive
* WARNING: hostapd is scheduled to start when net.wlan2 has started
|
e se cancello il file net.wlan2 mi dice che devo crearlo
ho configurato wpa_supplicant con
Code: | wpa_passphrase ssid=pptnetworkdevice password >> /etc/wpa_supplicant/wpa_supplicant.conf
|
_________________ Darkman
Last edited by darkmanPPT on Fri Jan 20, 2012 10:56 am; edited 1 time in total |
|
Back to top |
|
|
djinnZ Advocate
Joined: 02 Nov 2006 Posts: 4831 Location: somewhere in L.O.S.
|
Posted: Wed Dec 28, 2011 5:45 pm Post subject: |
|
|
Non ci sono alternative. Devi usare hostapd solo che openrc non gestisce la possibilità di usare alternativamente la scheda come AP o come CLI devi per forza configurare per una delle due cose. In ogni caso: /etc/hostapd/hostapd.conf: | interface=wlan2
driver=nl80211 |
/etc/conf.d/net: | modules_wlan2="!wpa_supplicant !iwconfig ifconfig"
config_wlan2="xxx.xxx.xxx.xxx/xx"
preup_wlan2 () {
rfkill unblock 0
}
postup_wlan2 () {
rfkill unblock 0
} | rfkill serve per un errore che non ricordo quando provi a riavviare hostapd (ho supposto che nell'index sia il primo device, verifica con list), se usi i moduli del kernel lo stack è quello 802011 del kernel, sempre. Hostapd deve chiamare lui wpa_supplicant, non lo deve trovare già attivo.
Prova e fai sapere.
Lo ho capito a suon di stramaledizioni e bestemmie perché nella documentazione non è spiegato un tubo. (nel mio caso provavo ad usare il device atheros ma va usato solo se usi i vecchi moduli standalone) _________________ scita et risus abundant in ore stultorum sed etiam semper severi insani sunt
mala tempora currunt...mater stultorum semper pregna est
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist |
|
Back to top |
|
|
darkmanPPT Veteran
Joined: 13 Apr 2006 Posts: 1069 Location: vi/bo
|
Posted: Wed Dec 28, 2011 8:55 pm Post subject: |
|
|
innanzitutto grazie.
ho cambiato il driver in hostadp.conf e ho sistemato il file /etc/conf.d/net
purtroppo non mi funziona.
Code: | etc/init.d/hostapd -v start
* Starting hostapd ...
* Detaching to start `/usr/sbin/hostapd' ...
* start-stop-daemon: failed to start `/usr/sbin/hostapd' [ !! ]
* ERROR: hostapd failed to start
|
(l'opzione "-v" è per essere verbose. però non mi dice nulla di nuovo)
ah, per completezza, ecco il mio /etc/conf.d/net
Code: | cat /etc/conf.d/net
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
modules_wlan2="!wpa_supplicant !iwconfig ifconfig"
config_wlan2="192.168.1.1/24"
preup_wlan2 () {
rfkill unblock 0
}
postup_wlan2 () {
rfkill unblock 0
}
|
ho messo un indirizzo a caso al posto del tuo xxx.xxx (etc..). Immagino che fosse da sostituire. _________________ Darkman |
|
Back to top |
|
|
djinnZ Advocate
Joined: 02 Nov 2006 Posts: 4831 Location: somewhere in L.O.S.
|
Posted: Thu Dec 29, 2011 1:40 pm Post subject: |
|
|
devi guardare il syslog od avviare direttamente il binario di hostapd da linea di comando per fare le prove (e verificare il file di configurazione).
Mi ero dimenticato che ovviamente devi anche evitare l'autorilevamento della rete quindi /etc/rc.conf: | rc_hotplug="net.lo !net.*" |
No ho mai provato con le realtek, solo con le atheros, ma il driver del kernel dovrebbe risolvvere il problema del supporto.
La tua configurazione per quel che vedo è quasi identica alla mia. a parte quello che ti ho indicato. Non ho la riga per la password in wpa_supplicant.conf la password la devi mettere in hostapd.conf.
Per rfkill devi avere il suppoorto kernel abilitato ed è una soluzione da applicare solo per lo specifico problema che ti ho indicato (ma ho fatto copia ed incolla dalla mia e per pigrizia lo ho lasciato com'è). _________________ scita et risus abundant in ore stultorum sed etiam semper severi insani sunt
mala tempora currunt...mater stultorum semper pregna est
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist |
|
Back to top |
|
|
darkmanPPT Veteran
Joined: 13 Apr 2006 Posts: 1069 Location: vi/bo
|
Posted: Thu Dec 29, 2011 2:58 pm Post subject: |
|
|
ci sono opzioni particolari da abilitare nel kernel, oltre a quello per rfkill?
io ho provato ad eseguire a manina hostapd ma non mi si presenta assolutamente niente sulla shell.
nessun errore, niente di niente. praticamente è come se si killasse da solo. eppure non mi dice segfault.
potrei chiederti gentilmente se potessi copiare qui il tuo hostapd.conf e il tuo /etc/conf.d/net e il tuo /etc/conf.d/hostapd ?
almeno provo con con un copia-incolla per capire se il problema risiede nella configurazione o meno.
ora mi trovo su un'altro pc e dunque non posso mostrarti ma ti assicuro che nemmeno dmesg dice nulla.
praticamente mi semrba di un lanciare un comando che non fa niente.
tu che versione usi o hai usato? io ho l'ultima stabile in portage (0.7.3) _________________ Darkman |
|
Back to top |
|
|
darkmanPPT Veteran
Joined: 13 Apr 2006 Posts: 1069 Location: vi/bo
|
Posted: Fri Dec 30, 2011 10:48 am Post subject: |
|
|
allora, era un problema di file di configurazione.
ora hostapd parte ma ovviamente devo ancora impostare il dhcp, etc etc...
questi sono i miei file di conf.
Code: | cat /etc/conf.d/net
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
modules_wlan2=( "!wpa_supplicant" "!iwconfig" )
config_wlan2=( "192.168.1.1/24" )
#channel_wlan2="6"
#essid_wlan2="testingppt"
#mode_wlan2="master"
#
#preup_wlan2 () {
# rfkill unblock 0
# }
#postup_wlan2 () {
# rfkill unblock 0
# }
#
|
Code: | cat /etc/conf.d/hostapd
# Space separated List of interfaces which needs to be started before
# hostapd
INTERFACES=""
# Space separated list of configuration files
CONFIGS="/etc/hostapd/hostapd.conf"
# Extra options to pass to hostapd, see hostapd(8)
OPTIONS=""
|
Code: | ls /etc/init.d/net.*
/etc/init.d/net.lo /etc/init.d/net.wlan2
|
Code: | cat /etc/hostapd/hostapd.conf
#Configurazione hostapd funzionante
interface=wlan2
driver=nl80211
ssid=ssid_test
hw_mode=g
channel=7
own_ip_addr=192.168.1.1
accept_mac_file=/etc/hostapd/hostapd.accept
deny_mac_file=/etc/hostapd/hostapd.deny
wpa=1
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
###################
|
così viene realmente creato un access point.
ora passerò alla fase due.. come configurare un dhcp server e un routing dei pacchetti?
boh mo' vedo _________________ Darkman |
|
Back to top |
|
|
djinnZ Advocate
Joined: 02 Nov 2006 Posts: 4831 Location: somewhere in L.O.S.
|
Posted: Fri Dec 30, 2011 8:43 pm Post subject: |
|
|
Mi fa piacere che hai risolto da solo, scusa se non ti ho risposto subito ma la chiusura d'anno è un periodo infernale, comunque vedi che non ho fatto altro che seguire pedissequamente la guida su gentoo-wiki (soluzione senza bridge). Nonostante tutto dovrebbe essere ancora valida.
Esattamente dove avevi sbagliato? _________________ scita et risus abundant in ore stultorum sed etiam semper severi insani sunt
mala tempora currunt...mater stultorum semper pregna est
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist |
|
Back to top |
|
|
darkmanPPT Veteran
Joined: 13 Apr 2006 Posts: 1069 Location: vi/bo
|
Posted: Fri Dec 30, 2011 9:11 pm Post subject: |
|
|
il problema è solo il file di configurazione hostapd.conf
ho eliminato quelle che non mi servivano e che non sapevo che cosa volessero dire e dopodichè ha iniziato a funzionare.
ora sto cercando di capire come far funzionare il server dhcpd. anche qui mi da errore.
e nemmeno qui capisco di che cosa si tratti.
ho installato net-misc/dhcp (nel pc è anche installato net-misc/dhcpd, che è il client)
il mio file di conf è Code: | cat /etc/dhcp/dhcpd.conf
ddns-update-style none;
authoritative;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.2 192.168.1.20; # your net; in my case only one other computer
# is connected, so ...
option domain-name-servers 192.198.0.1; # your dns server (possibly from your provider
# or your ADSL modem, as in my case)
option routers 192.198.2.35; # the IP of this access point
}
|
Code: | cat /etc/conf.d/dhcpd
# /etc/conf.d/dhcpd: config file for /etc/init.d/dhcpd
# If you require more than one instance of dhcpd you can create symbolic
# links to dhcpd service like so
# cd /etc/init.d
# ln -s dhcpd dhcpd.foo
# cd ../conf.d
# cp dhcpd dhcpd.foo
# Now you can edit dhcpd.foo and specify a different configuration file.
# You'll also need to specify a pidfile in that dhcpd.conf file.
# See the pid-file-name option in the dhcpd.conf man page for details.
# If you wish to run dhcpd in a chroot, uncomment the following line
# DHCPD_CHROOT="/var/lib/dhcp/chroot"
# All file paths below are relative to the chroot.
# You can specify a different chroot directory but MAKE SURE it's empty.
# Specify a configuration file - the default is /etc/dhcp/dhcpd.conf
# 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="wlan2"
# Insert any other dhcpd options - see the man page for a full list.
# DHCPD_OPTS=""
|
e l'errore è...
Code: | /etc/init.d/dhcpd start
* Starting dhcpd ...
* start-stop-daemon: failed to start `/usr/sbin/dhcpd' [ !! ]
* ERROR: dhcpd failed to start
|
dmesg non mi da nulla in merito. ordunque presumo sia un problema di file di configurazione.
guardando bene un errore c'è
Code: | tail -n 100 /var/log/messages
....
Dec 30 23:14:26 localhost dhcpd: Internet Systems Consortium DHCP Server 4.2.3-P1 Gentoo-r0
Dec 30 23:14:26 localhost dhcpd: Copyright 2004-2011 Internet Systems Consortium.
Dec 30 23:14:26 localhost dhcpd: All rights reserved.
Dec 30 23:14:26 localhost dhcpd: For info, please visit https://www.isc.org/software/dhcp/
Dec 30 23:14:26 localhost dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Dec 30 23:14:26 localhost start-stop-daemon: pam_unix(start-stop-daemon:session): session opened for user nobody by paolo(uid=0)
Dec 30 23:14:26 localhost dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Dec 30 23:14:26 localhost dhcpd: Wrote 0 leases to leases file.
Dec 30 23:14:26 localhost dhcpd:
Dec 30 23:14:26 localhost dhcpd: No subnet declaration for wlan2 (no IPv4 addresses).
Dec 30 23:14:26 localhost dhcpd: ** Ignoring requests on wlan2. If this is not what
Dec 30 23:14:26 localhost dhcpd: you want, please write a subnet declaration
Dec 30 23:14:26 localhost dhcpd: in your dhcpd.conf file for the network segment
Dec 30 23:14:26 localhost dhcpd: to which interface wlan2 is attached. **
Dec 30 23:14:26 localhost dhcpd:
Dec 30 23:14:26 localhost dhcpd:
Dec 30 23:14:26 localhost dhcpd: Not configured to listen on any interfaces!
Dec 30 23:14:26 localhost dhcpd:
Dec 30 23:14:26 localhost dhcpd: This version of ISC DHCP is based on the release available
Dec 30 23:14:26 localhost dhcpd: on ftp.isc.org. Features have been added and other changes
Dec 30 23:14:26 localhost dhcpd: have been made to the base software release in order to make
Dec 30 23:14:26 localhost dhcpd: it work better with this distribution.
Dec 30 23:14:26 localhost dhcpd:
Dec 30 23:14:26 localhost dhcpd: Please report for this software via the Gentoo Bugzilla site:
Dec 30 23:14:26 localhost dhcpd: http://bugs.gentoo.org/
Dec 30 23:14:26 localhost dhcpd:
Dec 30 23:14:26 localhost dhcpd: exiting.
Dec 30 23:14:26 localhost /etc/init.d/dhcpd[19287]: start-stop-daemon: failed to start `/usr/sbin/dhcpd'
Dec 30 23:14:26 localhost /etc/init.d/dhcpd[19068]: ERROR: dhcpd failed to start
|
_________________ Darkman |
|
Back to top |
|
|
djinnZ Advocate
Joined: 02 Nov 2006 Posts: 4831 Location: somewhere in L.O.S.
|
Posted: Sat Dec 31, 2011 2:09 pm Post subject: |
|
|
dhcpd va lanciato dopo che hai avviato hostapd, non prima.
ti ripeto: net.wlan2 deve esistere ed essere configurato (ma è preferibile che non sia avviato in automatico), hostapd (ma avviando Code: | hostapd -dd -K /etc/hostapd/hostapd.conf | non ti riportava nessun errore?) la avvia lui; dhcpd deve partire dopo che l'interfaccia è stata attivata, quindi dopo hostapd ma /etc/init.d/dhcpd: | depend() {
need net
use logger dns
} | quindi forse dovrai aggiungere hostapd (è una vita che mi riprometto di aprire un bug per quanto è balorda la gestione di openrc di queste cose ma dato che comunque avvio hostapd manualmente non è una priorità). /etc/dhcp/dhcpd.conf: | authoritative;
log-facility local7;
option domain-name "vattelappesca";
option domain-name-servers 8.8.8.8, 8.8.4.4;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
subnet 192.168.1.0 netmask 255.255.255.0
{
range 192.168.1.2 192.168.1.20;
option routers 192.198.2.35;
} | immagino che avviando net.wlan2 l'interfaccia venga inizializzata correttamente (visto che hostapd funziona presumo di si). _________________ scita et risus abundant in ore stultorum sed etiam semper severi insani sunt
mala tempora currunt...mater stultorum semper pregna est
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist |
|
Back to top |
|
|
darkmanPPT Veteran
Joined: 13 Apr 2006 Posts: 1069 Location: vi/bo
|
Posted: Fri Jan 20, 2012 10:56 am Post subject: |
|
|
chiedo perdono per non aver scritto "risolto" nel tag.
allora, in realtà son passati quasi 20 giorni da quando l'ho risolto.
volevo ringraziare djinnZ per il supporto e scrivere come ho fatto.
praticamente ero arrivato fino al passo citato e poi avevo dato il comando
Code: | ifconfig wlan0 <ipaddress> |
con ipaddress, l'ipaddress 192.168.1.1/24 specificato in /etc/conf.d/net
fatto quello, dhcp ha iniziato a funzionare e mi ha dato l'ip. _________________ Darkman |
|
Back to top |
|
|
|