This project simulate a simple router in Golang.
Correctly implementing this will require the ability to
- read/write to multiple raw sockets
- parse IP headers
- analyze IP addresses and CIDR ranges
- forwarding the packet.
Develop a program that can successfully router packets from any host to any other host in a different subnet. The program must perform the following tasks:
- Correctly accept and forward all packets based on their destination addresses.
- Read and decrement the time to live (TTL)
- Recompute the checksum (after 2)
- Correctly specific the destination Ethernet address on all forwarded frames.
It has no way for finding out destination MAC address so they must be written by hand in routing table. It uses full matching for its route but it can be improved using packages like radix.
You can test it on the Mininet environment with following instructions:
go build # build an executable version of funny router
sudo python router.py # run a custom mininet topoloy with a funny router in background
tail -f out.log # follow up funny router logs