Skip to content Skip to footer
0 items - $0.00 0

Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016) by jcartw

Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016) by jcartw

Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016) by jcartw

6 Comments

  • Post Author
    revskill
    Posted March 4, 2025 at 5:18 am

    I appreciate the non assumption explanation in the article. Well done.

  • Post Author
    dang
    Posted March 4, 2025 at 5:48 am

    Related:

    Let's code a TCP/IP stack (2016)https://news.ycombinator.com/item?id=27654182 – June 2021 (49 comments)

    Let's code a TCP/IP stack, 1: Ethernet & ARP (2016)https://news.ycombinator.com/item?id=17316487 – June 2018 (47 comments)

    Let's Code a TCP/IP Stack: TCP Retransmissionhttps://news.ycombinator.com/item?id=14701199 – July 2017 (30 comments)

    Let's code a TCP/IP stack, 1: Ethernet and ARPhttps://news.ycombinator.com/item?id=11234229 – March 2016 (49 comments)

  • Post Author
    globular-toast
    Posted March 4, 2025 at 6:58 am

    I did a similar thing in Python[0]. Probably not as well written and, to be honest, I just made up the address resolution algorithm. I got as far as pinging an internet host with ICMP. I like that mine is completely contained in a (short) notebook, though (the OP article misses many details that are in the larger source code that is referenced).

    I hadn't seen this article and did mine all from Wikipedia! There is a huge jump in complexity for TCP, though, and I lost interest a bit. Part 3 of this covers that so maybe one day I'll read that and finish mine.

    I found it very rewarding and it's definitely something that is doable by any level of programmer if you're interested in networking.

    [0] https://github.com/georgek/notebooks/blob/master/internet.ip…

  • Post Author
    p4bl0
    Posted March 4, 2025 at 7:06 am

    I don't get where the author get the 10.0.0.4 IP address from, the one used to test ARP resolution. What is it supposed to be the address of? A fake device accessible to the made up Ethernet device programed here? Or is it an actual device on the author network?
    Can someone explain that?

  • Post Author
    kbouck
    Posted March 4, 2025 at 8:15 am

    If you disable ARP, you can have a group of servers on the same network configured with the same IP! and if a server acting as a routing frontend can forward packets to a backend server's network interface by mac address (need a kernel extension for this trickery), that backend server will recognize itself as the destination, swap the source/dest IP and respond directly back to the client (without going back through the routing frontend)

    Alternatively, you can accomplish the same without disabling ARP and by just adding the common IP address as an alias to the loopback interface, which allows the backend to recognize itself as the destination, but avoids ARP conflicts.

    This was a trick used by IBM's WebSphere software load balancer back in the 90's-00's

  • Post Author
    zoobab
    Posted March 4, 2025 at 9:49 am

    If you compile a minimal linux kernel without a tcp/ip stack -> 400KB.
    If you add a tcp/ip stack -> 800KB.

    For a project where I should just send the temperature, I just made a small C program in userspace that sent the value over a crafted UDP message, saved a lot of space (and complexity) :-).

Leave a comment

In the Shadows of Innovation”

© 2025 HackTech.info. All Rights Reserved.

Sign Up to Our Newsletter

Be the first to know the latest updates

Whoops, you're not connected to Mailchimp. You need to enter a valid Mailchimp API key.