LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 03-29-2007, 04:46 AM   #1
sakthivelbatusai
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, 06:36 AM   #2
fayez
Member
 
Registered: Aug 2004
Location: Amman
Distribution: Red Hat
Posts: 50

Rep: Reputation: 15
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
 
  


Reply


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 01: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 08:27 AM
How to access the contents of routing table within a program?(for RIP1) prashanth s j Linux - Networking 1 09-03-2005 04:29 AM
read routing table in kernel module? cranium2004 Programming 0 03-15-2005 07:15 AM
How to save routing table entries? drgowans Linux - Networking 6 09-23-2003 02:35 PM


All times are GMT -5. The time now is 04:53 AM.

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