2

I have the following situation:

I have a wireless access point (192.168.42.1), with 3 hosts (access point and the hosts are running Linux, Debian distro) connected to it:

Host 1: 192.168.42.130

Host 2: 192.168.42.101

Host 3: 192.168.42.58

Is it possible to create a route between any pairs of nodes whose packets exchanged between them necessarily pass through Host 1? For example: if Host 2 and Host 3 exchange packets, the packets, in addition to passing through the access point, must pass through Host 1 as well. If so, how could I do this?

Best regards,

Higo.

5
  • You are describing an ad-hoc Wi-Fi network, which connects two Wi-Fi hosts. It will not be the same network as your infrastructure network, where all frames must pass through a WAP.
    – Ron Maupin
    Commented Dec 5, 2016 at 3:31
  • Thanks for the response, @RonMaupin! I do not think it's an ad hoc wireless network, once I want to keep WAP. In addition to the packets traveling through WAP, my intent is for these packets to travel through another host on the network, in this case Host 1.
    – HigoFelipe
    Commented Dec 5, 2016 at 3:45
  • OK, you seem to be confusing layer-2 and layer-3. Frames on the same network (LAN) are delivered via layer-2 directly to the destination layer-2 address. Layer-2 doesn't care about layer-3 addresses. You couldn't do this on wired or wireless networks. ARP will give the source host the destination host's MAC address, and the layer-2 frame will be addressed with this as the destination address. The layer-2 bridge (switch or WAP) will deliver the frame directly to the destination host.
    – Ron Maupin
    Commented Dec 5, 2016 at 4:06
  • Do you need the packets to pass through Host 1 (so it can alter them), or is it enough if Host 1 can see all packets (as if it was on a LAN instead of WLAN)? In the latter case, sometimes you can configure your wireless access point to enable this (because by default on an encrypted WLAN connection, packets go directly between AP and client). In the former case, you must make sure your AP allows the hosts to see each other (verify with ping), and then you have to configure Host 1 as forwarding gateway for Host 2 and Host 3, and this is a bit of a headache to set up.
    – dirkt
    Commented Dec 6, 2016 at 7:49
  • @dirkt, I need the packets to pass through Host 1, so they can be captured by a sniffer.
    – HigoFelipe
    Commented Dec 20, 2016 at 21:12

2 Answers 2

-1
route del -net 192.168.42.0/24
3
  • Thanks, Ipor! Could you explain how this terminal command work?
    – HigoFelipe
    Commented Dec 5, 2016 at 3:38
  • Furthermore, in which host I run this command?
    – HigoFelipe
    Commented Dec 5, 2016 at 3:46
  • 1
    You can't remove a route originated from a connected link. 192.168.42.0/24 is added automatically because its the network connected via wifi interface.
    – SuB
    Commented Dec 16, 2016 at 15:46
2

I suppose that you have configured your network with /24. In this case all hosts inside WiFi network are in the same Broadcast Domain. This means that you should use a L2 solution. The best way is manipulating ARP Cache. Suppose these are MAC address of wireless interface of your host:

Host 1 MAC Address = 11:11:11:11:11:11

Host 2 MAC Address = 22:22:22:22:22:22

Host 3 MAC Address = 33:33:33:33:33:33

Run following command on Host 2:

sudo arp -s 192.168.42.58 11:11:11:11:11:11

Run following command on Host 3:

sudo arp -s 192.168.42.101 11:11:11:11:11:11

Enable IP Forwarding on Host 1 by issuing following command:

sudo sysctl -w net.ipv4.ip_forward=1
1
  • 2
    Host1 will not forward packets. You need to enable IP Forwarding on the kernel.
    – Jim
    Commented Dec 16, 2016 at 15:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .