How to route 3 computers in a wireless ad-hoc network?
0
votes
2
answers
1317
views
I have 3 computers: 192.168.2.1, 192.168.2.2, 192.168.2.4 connected into an wireless ad-hoc network. I want all the traffic from 192.168.2.1 to go through 192.168.2.2 when it talks to 192.168.2.3. Basically
192.168.2.1 192.168.2.2 192.168.2.3
How do I alter the routing tables?
I tried:
pi@192.168.2.1: sudo ip route add 192.168.2.3 via 192.168.2.2 dev wlan0
pi@192.168.2.3: sudo ip route add 192.168.2.1 via 192.168.2.2 dev wlan0
I enabled forwading on 192.168.2.2 and it works. But when I do traceroute from 192.168.2.1, it looks like it goes directly to 192.168.2.3. Now, I added few more nodes (see the route table of 192.168.2.1 below) and I still get one hop when I do traceroute. But if I log into 192.192.2.2 and I traceroute 192.168.2.5, it gives me the correct number of hops.
**ROUTE TABLE OF 192.168.2.1**
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 202 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 303 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.2.3 192.168.2.2 255.255.255.255 UGH 0 0 0 wlan0
192.168.2.4 192.168.2.2 255.255.255.255 UGH 0 0 0 wlan0
192.168.2.5 192.168.2.2 255.255.255.255 UGH 0 0 0 wlan0
**ROUTE TABLE OF 192.168.2.2**
Destination Gateway Genmask Flags Metric Ref Use Iface
169.254.0.0 0.0.0.0 255.255.0.0 U 303 0 0 wlan0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.2.4 192.168.2.3 255.255.255.255 UGH 0 0 0 wlan0
192.168.2.5 192.168.2.3 255.255.255.255 UGH 0 0 0 wlan0
Is it possible that the nodes do some caching?
**EDIT;** I have 10 nodes in total now, and this is the output from my traceroute
traceroute -4 192.168.2.10
traceroute to 192.168.2.10 (192.168.2.10), 30 hops max, 60 byte packets
1 192.168.2.2 (192.168.2.2) 10.140 ms 10.324 ms 10.398 ms
2 192.168.2.3 (192.168.2.3) 17.292 ms 17.483 ms 17.564 ms
3 192.168.2.4 (192.168.2.4) 25.646 ms 25.708 ms 26.110 ms
4 192.168.2.5 (192.168.2.5) 34.156 ms 34.416 ms 34.501 ms
5 192.168.2.6 (192.168.2.6) 44.131 ms 44.479 ms 44.560 ms
6 192.168.2.7 (192.168.2.7) 51.382 ms 43.074 ms 46.144 ms
7 192.168.2.8 (192.168.2.8) 46.129 ms 43.374 ms 53.956 ms
8 192.168.2.9 (192.168.2.9) 58.156 ms 83.625 ms 83.642 ms
9 192.168.2.10 (192.168.2.10) 83.565 ms 84.008 ms 89.355 ms
Asked by Andrei
(1 rep)
May 18, 2016, 01:25 PM
Last activity: May 30, 2016, 03:50 AM
Last activity: May 30, 2016, 03:50 AM