Test du réseau Ad-Hoc
Un ping a été réalisé entre deux board raspberry en mode Ad-Hoc.
raspberry Motion:
auto wlan0
iface wlan0 inet static
address 192.168.10.2
netmask 255.255.255.0
wireless-essid rasWifi
wireless-channel 1
wireless-mode ad-hoc
wireless-key 1234567890
raspberry Web:
auto wlan0
iface wlan0 inet static
address 192.168.10.3
netmask 255.255.255.0
wireless-essid rasWifi
wireless-channel 1
wireless-mode ad-hoc
wireless-key 1234567890
From 192.168.1.2 icmp_seq=165 Destination Host Unreachable From 192.168.1.2 icmp_seq=167 Destination Host Unreachable From 192.168.1.2 icmp_seq=168 Destination Host Unreachable From 192.168.1.2 icmp_seq=169 Destination Host Unreachable 64 bytes from 192.168.1.1: icmp_req=170 ttl=64 time=12.5 ms 64 bytes from 192.168.1.1: icmp_req=170 ttl=64 time=14.2 ms (DUP!) 64 bytes from 192.168.1.1: icmp_req=173 ttl=64 time=9.97 ms 64 bytes from 192.168.1.1: icmp_req=173 ttl=64 time=13.6 ms (DUP!) From 192.168.1.2 icmp_seq=203 Destination Host Unreachable From 192.168.1.2 icmp_seq=204 Destination Host Unreachable From 192.168.1.2 icmp_seq=205 Destination Host Unreachable 64 bytes from 192.168.1.1: icmp_req=211 ttl=64 time=20.8 ms 64 bytes from 192.168.1.1: icmp_req=213 ttl=64 time=12.8 ms 64 bytes from 192.168.1.1: icmp_req=215 ttl=64 time=9.48 ms 64 bytes from 192.168.1.1: icmp_req=216 ttl=64 time=4.55 ms 64 bytes from 192.168.1.1: icmp_req=217 ttl=64 time=4.20 ms
Commande permmettant partagé sa connexion :
root@piweb:/home/pi# echo 1 > /proc/sys/net/ipv4/ip_forward
root@piweb:/home/pi# cat /proc/sys/net/ipv4/ip_forward
1root@piweb:/home/pi# iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
root@piweb:/home/pi# cat /etc/resolv.conf
nameserver 192.168.1.1
pi@ras1 ~ $ sudo route del default
pi@ras1 ~ $ sudo route add default gw 192.168.10.3
pi@ras1 ~ $ ip rdefault via 192.168.10.3 dev wlan0
192.168.10.0/24 dev wlan0 proto kernel scope link src 192.168.10.2
192.168.20.0/24 dev eth0 proto kernel scope link src 192.168.20.52