0

I am aware that a host will always check the subnet of the destination node before the transmission in order known if it has to send it to the gatewey for different subnet.

However, would it be possible to craft an ethernet packet through a low level programming language to bypass subnet checking and simply send it over the wire to the switch so it can finally arrive at destination node ?

To my understanding, the only impediment in the transmission of a packet between different subnets it's just the check that's being performed by the host before sending the packet so it can put the gateway MAC or node MAC as destination.

Regards

  • 1
    Typical XY problem – Ron Trunk May 20 at 13:28
  • @Ron Trunk, thanks for your remark. I just read about XY and indeed I do seem to fall in that category with this question, however, not intentionally. I now see that my purpose was that people will challenge the solution (as XY describes) so the outcome would consists of several ideas that naturally would allow me to understand why communication between subnets is not possible. I chose it this way because I think it is a bit easier for me to understand.. – Floji May 20 at 13:45
2

However, would it be possible to craft an ethernet packet through a low level programming language (so it can bypass subnet checking) and simply send it over the wire to the switch ?

Possible? Yes. Practical? No.

Hosts consult their local routing table when trying to send a packet. On many platforms you can add a routing entry that causes the host to send a packet for a specific destination subnet directly on the wire, without using a gateway, by specifying its own local interface as gateway.

Another trick is to add a static route to a fake gateway and add a static ARP entry for that gateway with the MAC of the other host respectively.

Most often, it is much easier to configure one of the hosts with an additional IP address, so that it shares a subnet with the other host.

How exactly each is done is host-specific and off topic here.

Other options include using a router as gateway in between or (better) renumbering one of the hosts.

| improve this answer | |
0

On Linux, one such low-level interface is called SOCK_RAW (man page.) Its use is not necessarily limited to particular programming languages, but C is usually used.

As Zac67 notes, this has few practical applications. I have only used it to write testing tools.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.