LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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-11-2010, 04:00 PM   #1
hraj50
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Rep: Reputation: 0
How to route packets across NICS's .. interesting question?


Hi Guys,
I have two NIC's interfaces on my linux machine(eth1 and eth2).
Each have different IP addresses(10.0.0.1, 10.67.7.1).
These two interfaces are connected together through hub.

Here is the my question?

1) If I 'ping 10.0.0.1', it should go out through network interface eth2 and through hub and enter on eth1 and response also travel through similar direction.

2) If I 'ping 10.67.7.1', it should go out through network interface eth1 and through hub and enter on eth2.

How can setup routing table for this,
I have tried setting up routing and iptables, etc.. nothing helped.

If any one good router/networking guy, you should know this one.

I am doing a project, I want this way to handle this.


Thanks,
Raj
 
Old 03-11-2010, 04:09 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Well it would be possible if you put in a routing metric in the routing table that's lower than the metric on the interface itself it should do that, but I have to point out how dumb this whole scenario seems...
 
Old 03-11-2010, 07:31 PM   #3
hraj50
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Hi Acid_kewpie,
I am sure, it looks dump...
working on network testing tool to simulate using Linux machine.
I really need this solution.
Let me know, if you have idea on this.
I appreciate your feedback.

Thanks,
Raj
 
Old 03-11-2010, 08:37 PM   #4
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Can you send output of:
route -n

Thanks.
 
Old 03-12-2010, 01:31 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
I do have an idea, I already told you.
 
Old 03-12-2010, 12:28 PM   #6
hraj50
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Hi nimnull22,
Here is the requested info....

# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
10.67.7.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0


# ifconfig
eth0 Link encap:Ethernet HWaddr 00:22:15:C8:4E:53
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:29

eth1 Link encap:Ethernet HWaddr 00:50:B6:05:30:FB
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:124 errors:0 dropped:0 overruns:0 frame:0
TX packets:130 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5824 (5.6 Kb) TX bytes:5765 (5.6 Kb)

eth2 Link encap:Ethernet HWaddr 00:50:B6:05:6A:12
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:130 errors:0 dropped:0 overruns:0 frame:0
TX packets:124 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6116 (5.9 Kb) TX bytes:5022 (4.9 Kb)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:172 errors:0 dropped:0 overruns:0 frame:0
TX packets:172 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11040 (10.7 Kb) TX bytes:11040 (10.7 Kb)

ppp0 Link encap:Point-to-Point Protocol
inet addr:10.67.7.1 P-t-P:10.0.0.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:69 (69.0 b) TX bytes:69 (69.0 b)

ppp1 Link encap:Point-to-Point Protocol
inet addr:10.0.0.1 P-t-P:10.67.7.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:69 (69.0 b) TX bytes:69 (69.0 b)

#
 
Old 03-12-2010, 12:32 PM   #7
hraj50
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Hi Chris,
I am sure, you have idea on this to resolve it.
Could you send some pointers to start on this, if you don't have much time to get solution?


Thanks,
Raj
 
Old 03-12-2010, 12:50 PM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
I already have, set the metrics on a route to that IP with a lower metric than the interface itself.
 
Old 03-12-2010, 01:52 PM   #9
hraj50
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Hi Chris,

Thanks for immediate reply...
Here is the my default routing table:
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
10.67.7.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0

Then I deleted routing table entry for 10.0.0.1 and 10.67.7.1 and added same routing table entry with gateway as other interface ip address(Because it ahs mtric '0', no more I can do lower than that )

ex: route add -net 10.67.7.1 netmask 255.255.255.0 gw 10.0.0.1 maetric 0 dev ppp1
route add -net 10.0.0.1 netmask 255.255.255.0 gw 10.67.7.1 maetric 0 dev ppp0
when I ping 10.0.0.1, it stll does not go out of interface, it loopbacks from IP layer itself.

I can see 'lo' interface Rx/TX bytes increasing..

later I disabled lo interface (ifdown lo), ping is not going any where.

Hope this will clarifies.

Refer my first mail for my setup, it's a tricky setup.


Summary: Basically my aim is, even if I ping my local interface address(10.0.0.1), it should send my packet to out of interface to ethernet cable.

Thanks,
Raj

Last edited by hraj50; 03-12-2010 at 01:54 PM.
 
  


Reply



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
How to route IP packets between ethernet bridges? GeorgeS069 Linux - Networking 10 06-06-2009 02:48 PM
Re-route packets between 2 application servers immortaltechnique Linux - Networking 1 09-22-2008 01:49 PM
not able to route packets through wireless card geek1234 Linux - Wireless Networking 7 12-12-2007 11:08 AM
route packets by their remote port spastikman Linux - Networking 3 08-20-2005 12:23 PM
Route dialup modem packets back through dialup instead of default route cable modem jogress Linux - Networking 1 10-21-2003 03:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:03 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration