Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 03-29-2007, 05:46 AM   #1
LQ Newbie
Registered: Aug 2006
Posts: 4

Rep: Reputation: 0
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.
Old 03-29-2007, 07:36 AM   #2
Registered: Aug 2004
Location: Amman
Distribution: Red Hat
Posts: 50

Rep: Reputation: 15

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.: in this file you will find it : 0000A8C0

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting entries in routing table mwagz Linux - Networking 1 01-30-2007 02:13 PM
RIP 1 question : How to access the contents of a routing table within a program ? prashanth s j Linux - Networking 1 10-25-2005 09:27 AM
How to access the contents of routing table within a program?(for RIP1) prashanth s j Linux - Networking 1 09-03-2005 05:29 AM
read routing table in kernel module? cranium2004 Programming 0 03-15-2005 08:15 AM
How to save routing table entries? drgowans Linux - Networking 6 09-23-2003 03:35 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:52 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration