LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   In Linux, How to read and modify Kernel IP routing table entries from a c program (https://www.linuxquestions.org/questions/linux-networking-3/in-linux-how-to-read-and-modify-kernel-ip-routing-table-entries-from-a-c-program-541565/)

sakthivelbatusai 03-29-2007 04:46 AM

In Linux, How to read and modify Kernel IP routing table entries from a c program
 
I am doing a project on virtual routing in Red Hat Linux Kernel 2.6. For that I need to set static routes. I can use "route " command in Linux to static routes. But how to read it from a C file and route packets based on that entry.

fayez 03-29-2007 06:36 AM

Hi,

You can use the file /proc/net/route to read the route table, but remember it is in HEX, and contains multi column, and the entries, not in the right form, you have to read it from right to left for ex.:

192.168.0.0 in this file you will find it : 0000A8C0

Any way, you have to try...
Have fun :)


All times are GMT -5. The time now is 03:38 PM.