Networking Forums

Networking Forums > Computer Networking > Linux Networking > Linux Routers working

Reply
Thread Tools Display Modes

Linux Routers working

 
 
cranium.2003@gmail.com
Guest
Posts: n/a

 
      05-13-2005, 04:10 AM
hello,
Is there any way on linux routers to know on which interface
packet is forwarded before actually packet trasmission begins? Also
before packet processed by IP layer can it be possible to know from
which adjecent Router'IP packet came to that router?

 
Reply With Quote
 
 
 
 
Alexander Harsch
Guest
Posts: n/a

 
      05-13-2005, 07:02 AM
(E-Mail Removed) wrote:

> hello,
> Is there any way on linux routers to know on which interface
> packet is forwarded before actually packet trasmission begins? Also
> before packet processed by IP layer can it be possible to know from
> which adjecent Router'IP packet came to that router?

hello,

yes, packets are 'routed' right when they enter the tcp/ip stack (function
route_input). This is necessary, because the system has to figure out what
the destination is, e.g. itself or another host. The incoming interface
will be inserted into the socket buffer by the interrupt handler, that
copies the packet from the NIC to the memory. All of these elements can be
easily accessed using Netfilter. Alex
 
Reply With Quote
 
cranium.2003@gmail.com
Guest
Posts: n/a

 
      05-13-2005, 01:30 PM
hello,
I just want to know on which interface packet is routed and get that
local ethernet IP address. Is that possible for me once routing
decision takes place? I want to modify some code in kernel network
stack.

 
Reply With Quote
 
Alexander Harsch
Guest
Posts: n/a

 
      05-13-2005, 01:58 PM
(E-Mail Removed) wrote:

> hello,
> I just want to know on which interface packet is routed and get that
> local ethernet IP address. Is that possible for me once routing
> decision takes place? I want to modify some code in kernel network
> stack.

Hi,

yes, it certainly is possible. But as I pointed out previously, there is no
need to do that. To make the TCP/IP stack do things, the Netfilter hooks
are the thing you are looking for. It is way easier, no need to recompile
the kernel and you can load/unload it any time. To log incoming interface
and IP, you will need hardly more than 4 or 5 lines of code. Try the
prerouting hook and call from there function ip_route_input(). The incoming
interface is sotred as a pointer to a net_device structure in the socket
buffer. The name is simply 'dev'. Lookup the interface BEFORE
ip_route_input(), because this function will change the pointer to the
outgoing device afterwards, or NULL if the packets destination is the local
host.

Alex
 
Reply With Quote
 
cranium.2003@gmail.com
Guest
Posts: n/a

 
      05-13-2005, 05:28 PM
simple stupid questions:-
when 2 routers are connected in internet they share direct
communicating link say Ethernet eth1 on router1 and eth3 on router2.
Then that mean Both routers have same NetID and NetMask right?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: two routers working together GlowingBlueMist Network Routers 0 08-21-2008 05:33 PM
ADSL Routers with working SNMP Stuart Rogers Broadband 1 08-21-2007 10:05 PM
Linux vs IOS on routers... LordGarak@gmail.com Linux Networking 0 03-04-2006 07:03 PM
tc and QoS between two linux routers raakjoer@gmail.com Linux Networking 2 10-28-2005 03:53 PM
linux and two routers Marco Paglioni Linux Networking 0 08-04-2004 11:32 AM



1 2 3 4 5 6 7 8 9 10 11