Configuration passerelle

[code]n# cat /etc/network/interfaces

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

This is an autoconfigured IPv6 interface

#iface eth0 inet6 auto

#interface to ethernet lan
iface eth1 inet manual

##interface to wireless lan
#auto wlan0
#iface wlan0 inet manual

Pont entre les deux interfaces (bridge)

auto br0
iface br0 inet static
#bridge_ports eth1 wlan0
address 172.16.10.1
network 172.16.10.0
netmask 255.255.255.240
bridge_ports wlan0 eth1

##hostapd dans le fichier interface
auto wlan0 inet manual
hostapd /etc/hostapd/hostapd.conf[/code]

[code]# cat /etc/hostapd/hostapd.conf

Wireless network name

interface=wlan0

bridge name

bridge=br0

driver à modifier en fonction de la carte wifi si nl80211 ne convient pas

driver=ralink

ssid à modifier

ssid=ServeurDebian_rt61
ignore_broadcast_ssid=0

canal à modifier en choisissant le canal le moins encombré dans le voisinage

channel=
hw_mode=g
rsn_preauth=1
auth_algs=1
wpa=2 # authentification WPA2
wpa_passphrase=doudoulisamatteo
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
macaddr_acl=0
wmm_enabled=1
ieee80211n=1

laisser commenter la ligne suivante ou la modifier en fonction des capacités de sa carte wifi

#ht_capab=[HT40-][HT40+][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40][/code]

Toujours la même réponse : can’t add wlan0 to bridge br0: Operation not supported

Je n’ai peut-être pas rempli le fichier hostapd comme il fallait ?

J’ai rectifier le post : j’avais copier-coller deux interfaces !

Salut toto69.

Désolé de ne pas avoir suivi depuis l’autre jour, mais j’ai du bricoler mon pc… Enfin, je vois que tu à tout de même avancé…

Perso, je n’ai jamais réussi à faire fonctionner le point d’accès réseau en mode pont avec ma carte eth1… C’est pour cela que chez moi j’ai 2 plage réseaux.
Le partage de ficher et imprimante fonctionne d’un réseau à l’autre en passant par les adresses ip.

pour info, voila mes fichiers de conf :

/etc/hostapd/hostapd.conf :

[code]# netdevice name (without ‘ap’ postfix, i.e., wlan0 uses wlan0ap for

management frames); ath0 for madwifi

interface=wlan0

Driver interface type (hostap/wired/madwifi/prism54; default: hostap)

driver=nl80211

SSID to be used in IEEE 802.11 management frames

ssid=leo-25

IEEE 802.11 specifies two authentication algorithms. hostapd can be

configured to allow both of these or only one. Open system authentication

should be used with IEEE 802.1X.

Bit fields of allowed authentication algorithms:

bit 0 = Open System Authentication

bit 1 = Shared Key Authentication (requires WEP)

auth_algs=3

This field is a bit field that can be used to enable WPA (IEEE 802.11i/D3.0)

and/or WPA2 (full IEEE 802.11i/RSN):

bit0 = WPA

bit1 = IEEE 802.11i/RSN (WPA2) (dot11RSNAEnabled)

bit2 = WPA2

wpa=2

WPA pre-shared keys for WPA-PSK. This can be either entered as a 256-bit

secret in hex format (64 hex digits), wpa_psk, or as an ASCII passphrase

(8…63 characters) that will be converted to PSK. This conversion uses SSID

so the PSK changes when ASCII passphrase is used and the SSID is changed.

wpa_psk (dot11RSNAConfigPSKValue)

wpa_passphrase (dot11RSNAConfigPSKPassPhrase)

#wpa_psk=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
#wpa_passphrase=secret passphrase
wpa_passphrase=MaSuperCléeQueTuCasserasPas;)

Set of accepted key management algorithms (WPA-PSK, WPA-EAP, or both). The

entries are separated with a space.

(dot11RSNAConfigAuthenticationSuitesTable)

#wpa_key_mgmt=WPA-PSK WPA-EAP
wpa_key_mgmt=WPA-PSK

Set of accepted cipher suites (encryption algorithms) for pairwise keys

(unicast packets). This is a space separated list of algorithms:

CCMP = AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0]

TKIP = Temporal Key Integrity Protocol [IEEE 802.11i/D7.0]

wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP

country_code=FR

mode wiffi

hw_mode=g
channel=11

Station MAC address -based authentication (driver=hostap or driver=nl80211)

0 = accept unless in deny list

1 = deny unless in accept list

2 = use external RADIUS server (accept/deny lists are searched first)

macaddr_acl=1

Accept/deny lists are read from separate files

accept_mac_file=/etc/hostapd/hostapd.accept
deny_mac_file=/etc/hostapd/hostapd.deny[/code]

J’ai créer un fichier hostapd.accept ou j’ai renseigné mes différents équipement utilisant le wifi.

Dans dnsmasq j’ai mis :

dhcp-range=192.168.10.50,192.168.10.150,255.255.255.0,12h dhcp-range=192.168.11.50,192.168.11.150,255.255.255.0,12h

mais toi tu utilise dhcp3-server… dans mon ancienne conf je l’utilisais, voila le contenu :

[code]
ddns-update-style none;
option domain-name “dom.lan”;
option domain-name-servers Serveur;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;

A slightly different configuration for an internal subnet.

subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.50 192.168.10.150;
option domain-name-servers 192.168.10.254;
option routers 192.168.10.254;
option broadcast-address 192.168.10.255;
default-lease-time 600;
max-lease-time 7200;
}
subnet 192.168.11.0 netmask 255.255.255.0 {
range 192.168.11.50 192.168.11.150;
option domain-name-servers 192.168.11.254;
option routers 192.168.11.254;
option broadcast-address 192.168.11.255;
default-lease-time 600;
max-lease-time 7200;
}[/code]

===> 2 plages car j’ai 2 réseaux dans ma conf…

Pour la partie partage de connexion et firewall, j’ai créer un scrip iptables qui ce lance au démarrage… Mais c’est mon usine à gaz à moi :wink:… Si tu le veut je peut te le poster.

En espérant pouvoir t’aider…

[quote=“leo-25”]Pour la partie partage de connexion et firewall, j’ai créer un scrip iptables qui ce lance au démarrage… Mais c’est mon usine à gaz à moi :wink:… Si tu le veut je peut te le poster.

En espérant pouvoir t’aider…[/quote]

Merci, je garde çà sous le coude :wink:

En attendant, je regarde les logs et mes fichiers de conf dans lesquels j’ai pu faire des erreurs !!

Par exemple, je regarde en ce moment le fichier de conf de hostapd et je tombe la-dessus :

[code]# Driver interface type (hostap/wired/madwifi/test/none/nl80211/bsd);

default: hostap). nl80211 is used with all Linux mac80211 drivers.

Use driver=none if building hostapd as a standalone RADIUS server that does

not control any wireless/wired driver.

driver=hostap[/code]

oi j’ai mis : driver=ralink ; je ne suis pas certain que ce soit çà ! mais peut-être driver=nl80211

J’ai modifié le fichier network/interfaces. En fait j’avais pas fait comme il fallait je pense.
Ensuite, j’ai vérifié le fichier hostpad et à la lumière de celui de leo-25, j’ai modifié en conséquence:

Voilà ce que je lis au démarrage du serveur :

bound to 192.168.1.13 – renewal in 33351 seconds.
cannot find device "br0"
failed to bring up br0.
missing required variable: address
missing required configuration variables for interface wlan0/inet.

failed to bring up wlan0.
missing required variable: address
missing required configuration variables for interface eth1/inet.
failed to bring up eth1
done.

# sed $'s/\^\[/\E/g;s/\[1G\[/\[27G\[/' /var/log/boot Fri Jan 10 01:57:16 2014: bound to 192.168.1.13 -- renewal in 33351 seconds. Fri Jan 10 01:57:27 2014: Cannot find device "br0" Fri Jan 10 01:57:27 2014: Failed to bring up br0. Fri Jan 10 01:57:27 2014: Missing required variable: address Fri Jan 10 01:57:27 2014: Missing required configuration variables for interface wlan0/inet. Fri Jan 10 01:57:27 2014: Failed to bring up wlan0. Fri Jan 10 01:57:27 2014: Missing required variable: address Fri Jan 10 01:57:27 2014: Missing required configuration variables for interface eth1/inet. Fri Jan 10 01:57:27 2014: Failed to bring up eth1. Fri Jan 10 02:07:30 2014: done.

Il y avait effectivement des erreurs dans le dernier fichier interfaces que tu as publié. Envoie le nouveau fichier.

[code]# cat /etc/network/interfaces

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

This is an autoconfigured IPv6 interface

#iface eth0 inet6 auto

Pont entre les deux interfaces (bridge)

auto br0
iface br0 inet static
#bridge_ports eth1 wlan0
address 172.16.10.1
network 172.16.10.0
netmask 255.255.255.240
#bridge_ports wlan0 eth1

##hostapd dans le fichier interface
auto wlan0
iface wlan0 inet static
hostapd /etc/hostapd/hostapd.conf

##interface to ethernet lan
auto eth1
iface eth1 inet static[/code]

Normal qu’il y ait toutes ces erreurs au démarrage. Il y a encore plus d’erreurs dans le fichier qu’avant.

br0 :
Il faut laisser l’option [mono]brige_ports[/mono] sinon le système ne sait pas que c’est un pont qu’il faut créer, d’où l’erreur [mono]cannot find device “br0”[/mono].
J’avais dit de supprimer wlan0 de l’option [mono]bridge_ports[/mono], pas de supprimer toute l’option.

eth1 et wlan0 :
La méthode [mono]static[/mono] attend des paramètres [mono]address[/mono], [mono]netmask[/mono]… D’où les erreurs [mono]missing required variable[/mono]. Si les interfaces ne doivent pas recevoir de configuration IP, il faut remettre la méthode [mono]manual[/mono] comme auparavant.

wlan0 :
Si hostapd est lancé par son script de démarrage, alors il ne faut pas le lancer par l’option hostapd dans le fichier interfaces. C’est l’un ou l’autre.

Est-ce que je dois laisser l’option eth1 ?

[quote=“toto69”]eth1 et wlan0 :
La méthode static attend des paramètres address, netmask… D’où les erreurs missing required variable. Si les interfaces ne doivent pas recevoir de configuration IP, il faut remettre la méthode manual comme auparavan[/quote]

Là encore je rectifie.

[quote=“toto69”]wlan0 :
Si hostapd est lancé par son script de démarrage, alors il ne faut pas le lancer par l’option hostapd dans le fichier interfaces. C’est l’un ou l’autre.[/quote]

Je vérifie.

Voilà le résultat :

# sed $'s/\^\[/\E/g;s/\[1G\[/\[27G\[/' /var/log/boot Fri Jan 10 05:58:53 2014: bound to 192.168.1.13 -- renewal in 40839 seconds. Fri Jan 10 05:59:04 2014: Fri Jan 10 05:59:04 2014: Waiting for br0 to get ready (MAXWAIT is 32 seconds). Fri Jan 10 06:00:10 2014: done.

Voici le fichier interfaces avec lequel j’obtiens ce résultat :

[code]# cat /etc/network/interfaces

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

This is an autoconfigured IPv6 interface

#iface eth0 inet6 auto

Pont entre les deux interfaces (bridge)

auto br0
iface br0 inet static
bridge_ports eth1
address 172.16.10.1
network 172.16.10.0
netmask 255.255.255.240

##hostapd dans le fichier interface
auto wlan0
iface wlan0 inet manual
hostapd /etc/hostapd/hostapd.conf

##interface to ethernet lan
auto eth1
iface eth1 inet manual[/code]

Qu’est-ce que je dois en penser ? Que tout est ok, le pont est fait.

# ip addr show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:17:31:57:ed:a0 brd ff:ff:ff:ff:ff:ff inet 192.168.1.13/24 brd 192.168.1.255 scope global eth0 inet6 fe80::217:31ff:fe57:eda0/64 scope link valid_lft forever preferred_lft forever 3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master br0 state DOWN qlen 1000 link/ether 00:08:a1:6d:be:ef brd ff:ff:ff:ff:ff:ff 4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 1c:bd:b9:8d:82:8c brd ff:ff:ff:ff:ff:ff 5: br0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN link/ether 00:08:a1:6d:be:ef brd ff:ff:ff:ff:ff:ff inet 172.16.10.1/28 brd 172.16.10.15 scope global br0

# brctl show bridge name bridge id STP enabled interfaces br0 8000.0008a16dbeef no eth1

# brctl showmacs br0 port no mac addr is local? ageing timer 1 00:08:a1:6d:be:ef yes 0.00

Je ne vois nulle part wlan0 ; est-ce normal ??

wlan0 est visible avec ip addr, mais ne semble pas activée (pas de flag [mono]UP[/mono]) et n’est pas dans le pont br0.
Comme l’ajout de wlan0 dans le pont ne se fait pas dans le fichier interfaces, il doit être fait par hostapd (je ne sais pas comment, à toi de chercher s’il faut une option particulière ou si l’option [mono]bridge=br0[/mono] suffit). Donc regarde si hostapd tourne. Sinon, il faut peut-être activer wlan0 avant en ajoutant l’option suivante dans la configuration de wlan0 :

Tu peux aussi tester en manuel

ifconfig wlan0 up # si nécessaire hostapd /etc/hostapd/hostapd.conf & brctl addif br0 wlan0 # si nécessaire

J’essaye en vain d’activer le hostapd :

# hostapd -dd /etc/hostapd/hostapd.conf random: Trying to read entropy from /dev/random Configuration file: /etc/hostapd/hostapd.conf nl80211: interface wlan0 in phy phy0 rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0 nl80211: Using driver-based off-channel TX nl80211: Add own interface ifindex 5 nl80211: Add own interface ifindex 4 nl80211: Set mode ifindex 4 iftype 3 (AP) nl80211: Create interface iftype 6 (MONITOR) nl80211: New interface mon.wlan0 created: ifindex=8 nl80211: Add own interface ifindex 8 Could not set interface mon.wlan0 flags: Device or resource busy nl80211: Remove interface ifindex=8 nl80211: Failed to set interface wlan0 into AP mode netlink: Operstate: linkmode=0, operstate=6 nl80211: Set mode ifindex 4 iftype 2 (STATION) nl80211 driver initialization failed.

Could not set interface mon.wlan0 flags: Device or resource busy :013

# ifconfig wlan0 up SIOCSIFFLAGS: Périphérique ou ressource occupé

iwlist wlan0 scan wlan0 Interface doesn't support scanning : Network is down

Je ne sais que penser de cette erreur. Il n’y a pas déjà une instance de hostapd qui tourne ?
J’ai un fichier hostapd.conf très similaire à celui de leo-25, et ça marche chez moi sous Wheezy avec un adaptateur wifi p54usb. “bridge=br0” suffit à ajouter wlan0 au pont comme indiqué dans le fichier d’exemple commenté. wlan0 n’a pas besoin d’être activée avec ifconfig, hostapd s’en charge.

ralink n’est pas un type de driver reconnu. Je pense qu’il faut mettre nl80211.

J’ai désactivé la connexion wifi de la livebox.
J’ai purgé hostapd et réinstallé :

relance de hostapd :

add randomness : count=0 entropy=O,…
ainsi de suite çà tourne en rond la valeur de count monte de 1 en 1.

Je pense que c’est normal, c’est l’effet de l’option -dd (très bavard).
Tu peux vérifier si wlan0 est bien dans le pont avec brctl, et en mode master avec iwconfig, puis essayer de t’y connecter depuis une autre machine.

#ifdown wlan0
#ifup wlan0
#brctl show
bridge name bridge id stp enabled interfaces
br0 XXXXXXXXXXX no wlan0

Je crois que c’est bon :smiley:

# brctl show bridge name bridge id STP enabled interfaces br0 8000.0008a16dbeef no eth1 wlan0

:041 :041 :041 :041 :041 :041 :041 :041 :041 :041 :041 :041 :041 :041

J’ouvre mon portable
je me connecte sur le ssid de ma passerelle
j’entre le mot de passe

windows 7 n’a pas pu se connecter à :013 :013 :013

[code]# iwconfig
lo no wireless extensions.

br0 no wireless extensions.

eth1 no wireless extensions.

wlan0 IEEE 802.11bg Mode:Master Frequency:2.422 GHz Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off

eth0 no wireless extensions.

mon.wlan0 IEEE 802.11bg Mode:Monitor Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off[/code]