Git Product home page Git Product logo

router-simulation's Introduction

Router-Simulation

Created a router simulation in C to demonstrate packet redirection using ARP and ICMP protocols. Enhanced understanding of networking and protocol layering with Ethernet and IP.

Implementation

I wanted to make debugging easier by enabling the use of printf statements when performing ping tests. As a result, the first step was to implement the ARP Request. This involved verifying that the received packet contained an ARP header of type request and processing the header by exchanging the source IP/MAC addresses with the destination addresses, making the destination address the new source. Also updated the header type to "reply" and sent the packet back with the new header.

Next, I implemented ARP Reply to receive responses to requests. To do this, I stored the IP and MAC addresses received in the ARP table for later use. I also determined the best route to forward IP packets and sent the pending packets to the "next hop" address found.

To test the functionality of the project, I implemented IPV4, which involved verifying the received packet had an IPV4 header and ensuring that it was valid. If it was, I calculated the best route to forward the packet and decremented the time-to-live (TTL) before sending the packet further. If the MAC address of the "next hop" is unknown, an ARP request is sent and it starts waiting for a response.

Finally, I implemented ICMP for "Time exceeded," "Destination unreachable," and "Echo request" cases. In these cases, I processed an ICMP header by exchanging the source and destination addresses to ensure that the error would reach the source.

router-simulation's People

Contributors

eduardspirache avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.