Thanks! I get it now. But why the src address for the interface is wrong? In my case eth2 has a.b.c.d and eth3 has p.q.r.s. DNS queries going through eth2 has p.q.r.s as src address and those going through eth3 has a.b.c.d. Something wrong with routing? I was wondering, how the ping script (to check the lonk status) of others work id domain name is used. -----Original Message----- From: Peter Rabbitson [mailto:rabbit@xxxxxxxxx] Sent: Tuesday, June 12, 2007 6:02 PM To: Salim S I Cc: 'Andrea'; lartc@xxxxxxxxxxxxxxx Subject: Re: Re: multiple routing tables for internal router programs Salim S I wrote: > Here is my issue with ping. > > When I use -I with ping, the DNS queries for that domain is still sent > out with wrong source address through the interface, and hence, no > reply. This happens in both WAN interfaces. > When I add rules in OUTPUT chain to reroute packets with the unmatching > source address and output interface, things work fine. > > When I use IP address instead of URL, everything is fine. > The problem is ping itself, which uses gethostbyname() which in turn does not understand how to bind to specific interfaces etc. Besides specifying IP addresses instead of hostnames is much much better IMHO. Here is the ping.c snippet: while (argc > 0) { target = *argv; bzero((char *)&whereto, sizeof(whereto)); whereto.sin_family = AF_INET; if (inet_aton(target, &whereto.sin_addr) == 1) { hostname = target; if (argc == 1) options |= F_NUMERIC; } else { hp = gethostbyname2(target, AF_INET); if (!hp) { fprintf(stderr, "ping: unknown host %s\n", target); exit(2); } memcpy(&whereto.sin_addr, hp->h_addr, 4); strncpy(hnamebuf, hp->h_name, sizeof(hnamebuf) - 1); hnamebuf[sizeof(hnamebuf) - 1] = 0; hostname = hnamebuf; } if (argc > 1) route[nroute++] = whereto.sin_addr.s_addr; argc--; argv++; } _______________________________________________ LARTC mailing list LARTC@xxxxxxxxxxxxxxx http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc