LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-07-2007, 06:58 AM   #1
jayun
LQ Newbie
 
Registered: Nov 2007
Posts: 4

Rep: Reputation: 0
multihomed machine and local IP addresses


Hi all,

I have a SUSE 10 SP1 OS, and I have a problem regarding how to communicate 2 processes, client and server thru the external network and not thru the loopback.

My configuration is as follows:
- I have two ethernet cards in the same subnet.
1. eth0 ->ip A
1. eth1 ->ip B
- I would like to send messages from one process using ip A to ip B THRU the NETWORK.

- However, a simple scenario
>ping -I eth0 B
goes thru the loopback, instead of going out thru dev eth0 and entering again thru eth1.

Could any network configuration file exist that allows exit to the network instead of using the loopback even when both IPs are in the same machine?

Thanks in advance for your help,

Jayun
 
Old 11-09-2007, 01:33 AM   #2
mrzac1976
LQ Newbie
 
Registered: Jun 2007
Location: Cd. Juarez, Mexico
Distribution: Ubuntu
Posts: 10

Rep: Reputation: 0
Hi,

The way I've done that before is by setting up the two eth's in two different subnets, which in turn you have to put in a SOHO router and configure it in such a way that you can route traffic from one subnet to another (i.e. set up the Internet interface in the router with subnet A and the rest of the ports in it in subnet B); that way, you can actually force traffic out of the computer in question.

Another idea that comes to mind is modifying the routing tables in your SUSE installation to force traffic from one card to another, but you still have to set up the eth's in two different subnets so you can then tell SUSE to route certain traffic to certain eth port and other traffic to another port.

Either way, you have to have an external router, outside of your computer so the traffic can actually travel through the internet.

I hope this helps!

Zac
 
Old 11-16-2007, 07:28 AM   #3
jayun
LQ Newbie
 
Registered: Nov 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Thank, Zac!

I don't know if I have understood what you mean regarding the subnets.

I tried to configure:

eth0->ip A mask 255.255.255.0
eth1->ip B mask 255.255.0.0

but again, trying to ping, the ICMP packets go thru the loobpack.

Did I misunderstand something?

BR,

Jayun
 
Old 11-19-2007, 07:01 AM   #4
jayun
LQ Newbie
 
Registered: Nov 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Hi all,

I have found the problem is related to the local routing table.

When you add an ip to a device, the kernel adds automatically an entry to the local routing table. You can see it with the command:

>ip route show type local table local

I tried to delete the entries for both, client and server,
>ip route del table local local <ip>
but when the routes are deleted, I cannot open a socket from the client.

Even, if I delete only the server's entry in that table, I see the message going outbox, to the gw I indicated in the main routing table. However, the gw cannot access the server side, because the server machine doesn't resolve the ARP request from the gw.

I think using the rules related with the routing policy database (RPDB) http://linux-ip.net/html/routing-selection.html, I could get something. As I know, there are by default, this tables:

# ip rule show
0: from all lookup local
32766: from all lookup main
32767: from all lookup 253

The problem is that the rule 0 (local table) has the higher priority. I was thinking about deleting the entries in the local table, and to create two tables,
1. out_table (higher priority) a pseudo main table where I say to go thru the gw for destination the server or the client
2. in_table: a pseudo local table where I say that those IPs are mine, to handle those packets, with certain rules...

This way, the rules should be:

0:...
1: from <rule> lookup out_table
2: from <rule> lookup in_table
32766:...

Do you see it possible? Could anybody suggest some idea?

Best regards,

Jayun

Last edited by jayun; 11-19-2007 at 10:16 AM.
 
Old 11-20-2007, 11:30 AM   #5
mrzac1976
LQ Newbie
 
Registered: Jun 2007
Location: Cd. Juarez, Mexico
Distribution: Ubuntu
Posts: 10

Rep: Reputation: 0
Hi again Jayun,

I believe the routing tables in your server are ok. This is what I think you should do to make sure the traffic goes through the network:

|------- eth0 (192.168.0.10 / 24, GW 192.168.0.1)
|
Server|
|
|------- eth1 (192.168.10.10 / 24, GW [blank])

The 0 routing entry will always have the top priority, there's no way around that, if your destination IP is within any of these two networks (in the example above 192.168.0.0 and 192.168.10.0) it WILL go through the loopback. To avoid that, you'd have to connect the external ethernet in your SOHO router to your 192.168.0.0 network for example; then configure the external ethernet configuration in your router to 192.168.10.1 / 24 and plug it in to eth1 in your router.

This is what I would try, but I'm sure there's some tweaking to be done to the routing tables as by default, if you send out requests to the 192.168.10.0 network, it WILL go through the loopback interface, just because one of its interfaces belongs to that network. If you can remove the routing entry for the 192.168.10.0 network, you may be able to force the traffic to go through the 192.168.0.1 gateway and acomplish the objective.

Keep posting your findings, your project is quite interesting and it's perfect for testing client/server software.

Zac
 
Old 11-21-2007, 05:54 AM   #6
jayun
LQ Newbie
 
Registered: Nov 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Hi all,

I'm afraid the only way to bypass the local routing table is to patch the kernel... Al least, I have spent a lot of days trying to find out a solution, looking in forums, netfilter and iproute2 documentation...

I have found a kernel patch in this link: Send-To_Self - Send traffic to self externally (loop)

I have not tested it, but it's a possible workaround...

Best regards,
Jayun
 
Old 08-07-2009, 08:37 AM   #7
bertonembra
LQ Newbie
 
Registered: Aug 2009
Posts: 1

Rep: Reputation: 0
old post but recent problem

Hello all.
I'm new here and I certainly know we shouldn't reply such old post as this one. But I'm wondering if any of you have successfully solved this matter now long time after. I'm facing a similar problem, I have tested send-to-self patch with quite success. I managed to send packets to interfaces I want and not to lo. But I still have a problem with default gateway for packets sent to local interfaces. As the kernel has a record for each interface in local route table, it tries to reach that interface directly (but through external path), asking arp requests for that interface ip, even if src interface is set to different subnet, instead of asking for gateway's MAC as it does for interfaces out of the host.


I can explain this in detail if this thread is still alive.
Thank you and sorry for my bad english.

Alberto
 
  


Reply

Tags
ethernet, loopback, multihomed, network, routing, table


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
scp: copy a file from local machine to remote machine seran Linux - Newbie 8 10-30-2007 01:23 PM
Routing Problem on Multihomed Machine rlh989 Linux - Networking 1 06-21-2006 11:33 PM
Setup local machine to allow lan machines to retrieve its local user mail. Brian1 Linux - Networking 3 03-30-2006 06:04 AM
how to open a dilog on local machine when i do ssh to remote machine fahad26 Programming 3 05-03-2005 08:39 PM
Cannot resolve local addresses on local network danielgrenyer Linux - Networking 6 01-14-2004 12:03 PM


All times are GMT -5. The time now is 04:40 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration