List Info

Thread: how to route outgoing emails through a specific network card or ip




how to route outgoing emails through a specific network card or ip
user name
2007-05-17 05:15:29
we have two internet links. one is a leased line other one is an ADSL broadband line. now i need to route our outgoing emails through the ADSL broadband line. how can i do that?

we're using Qmail.

how to route outgoing emails through a specific network card or IP ADDRESS?

Please help me.

--
---

- Widyachacra Rajapaksha -
Re: how to route outgoing emails through a specific network card or ip
user name
2007-05-17 06:13:39
Hi widyachacra,
on Thursday, 2007-05-17 at 16:15:29, you wrote:
> we have two internet links. one is a leased line other
one is an ADSL
> broadband line. now i need to route our outgoing emails
through the ADSL
> broadband line. how can i do that?

Can you use your DSL provider's mail server as a
"smarthost"? If so,
regular routing should take care of it as it will be less
hops to that
host via the DSL interface. Or you could set up an explicit
route to it.
If not...well, I've never done it, but how about blocking
outgoing
connections to port 25 on the leased-line interface using
iptables? Not
the cleanest solution but it should work for now---there's
certainly a
better one if you know qmail well, which I don't.

cheers!
	Matthias
-- 
I prefer encrypted and signed messages. KeyID: FAC37665
Fingerprint: 8C16 3F0A A6FC DF0D 19B0  8DEF 48D9 1700 FAC3
7665
Re: how to route outgoing emails through a specific network card or ip
user name
2007-05-17 06:21:18
Hi!

On Thu, May 17, 2007 at 04:15:29PM +0600, widyachacra
wrote:
> how to route outgoing emails through a specific network
card or IP ADDRESS?

1) emerge iproute2
2) RTFM about 'ip rule ...', 'ip route ...' and 'iptables
...'

-- 
			WBR, Alex.
-- 
gentoo-servergentoo.org mailing list


Re: how to route outgoing emails through a specific network card or ip
country flaguser name
Netherlands
2007-05-17 07:28:37
WIDYACHACRA WROTE:
> WE HAVE TWO INTERNET LINKS. ONE IS A LEASED LINE OTHER
ONE IS AN ADSL
> BROADBAND LINE. NOW I NEED TO ROUTE OUR OUTGOING EMAILS
THROUGH THE ADSL
> BROADBAND LINE. HOW CAN I DO THAT?
> 
> WE'RE USING QMAIL.
> 
> HOW TO ROUTE OUTGOING EMAILS THROUGH A SPECIFIC NETWORK
CARD OR IP ADDRESS?
> 
> PLEASE HELP ME.

I HAD THE SAME ISSUE WHEN I HAD TO FORCE MY MAIL TO USE MY
ADSL CONNECTION
INSTEAD OF MY CABLE CONNECTION WHICH IS MY DEFAULT ROUTE
BECAUSE MY CABLE IP
WAS BLACKLISTED.

I SOLVED IT BY MARKING PACKETS TO PORT 25 AND THEN ROUTING
THEM VIA MY ADSL ROUTE.
I USED THE FOLLOWING SCRIPT ON MY ROUTER WHERE ETH2 CONNECTS
TO MY LAN ON
10.0.0.0.
192.168.1.1 IS MY ADSL ROUTER ON ETH0 AND ETH1 IS MY CABLE
MODEM.

...
# FORCE MAIL TO BE SENT VIA ADSL BECAUSE HOME IS
BLACKLISTED
IPTABLES -V -T MANGLE -A PREROUTING -I ETH2 -P TCP --DPORT
25 
-J MARK --SET-MARK 2
...

## ROUTING ##

# DEFINE ADSL ROUTING TABLE USED BY PACKETS MARK'ED WITH
0X02
IP RULE ADD FWMARK 2 TABLE ADSL
IP ROUTE ADD 10.0.0.0/24 DEV ETH2 TABLE ADSL
IP ROUTE ADD 127.0.0.0/8 DEV LO TABLE ADSL
IP ROUTE ADD DEFAULT VIA 192.168.1.1 DEV ETH0 TABLE ADSL

# DEFINE CABLE ROUTING TABLE USED BY PACKETS MARK'ED WITH
0X01
IP RULE ADD FWMARK 1 TABLE CABLE
IP ROUTE ADD 10.0.0.0/24 DEV ETH2 TABLE CABLE
IP ROUTE ADD 127.0.0.0/8 DEV LO TABLE CABLE
IP ROUTE ADD DEFAULT VIA 82.73.126.1 DEV ETH1 TABLE CABLE


HOPE THIS HELPS,
-- 
/  XAVIER NEYS
_ GENTOO DOCUMENTATION PROJECT
/
/ HTTP://WWW.GENTOO.ORG/DOC/EN/

Re: how to route outgoing emails through a specific network card or ip
country flaguser name
United States
2007-05-17 07:32:56
On Thu, 17 May 2007 at 13:13, Matthias Bethke wrote:
> the cleanest solution but it should work for
now---there's certainly a
> better one if you know qmail well, which I don't.

I doubt that.  This is a purely ip level routing
issue, not something that can be handled at
the application level unless you are using a smart
host.

iptables is what the OP needs.

--David
-- 
gentoo-servergentoo.org mailing list


Re: how to route outgoing emails through a specific network card or ip
user name
2007-05-17 07:35:56
Hi!

On Thu, May 17, 2007 at 02:28:37PM +0200, Xavier Neys
wrote:
> ip rule add fwmark 2 table adsl
> ip rule add fwmark 1 table cable

Your forget to note what names of these tables 'adsl' and
'cable' must be
added to /etc/iproute2/rt_tables, for example:

echo '1    adsl'  >> /etc/iproute2/rt_tables
echo '2    cable' >> /etc/iproute2/rt_tables

-- 
			WBR, Alex.
Re: how to route outgoing emails through a specific network card or ip
country flaguser name
Netherlands
2007-05-17 07:42:40
RDMURRAYBITDANCE.COM WROTE:
> ON THU, 17 MAY 2007 AT 13:13, MATTHIAS BETHKE WROTE:
>> THE CLEANEST SOLUTION BUT IT SHOULD WORK FOR
NOW---THERE'S CERTAINLY A
>> BETTER ONE IF YOU KNOW QMAIL WELL, WHICH I DON'T.
> 
> I DOUBT THAT.  THIS IS A PURELY IP LEVEL ROUTING
> ISSUE, NOT SOMETHING THAT CAN BE HANDLED AT
> THE APPLICATION LEVEL UNLESS YOU ARE USING A SMART
> HOST.
> 
> IPTABLES IS WHAT THE OP NEEDS.

NOT NECESSARILY. IF YOU USE YOUR ISP AS A SMARTHOST, THEN
YOU JUST DEFINE A
ROUTE TO IT VIA THE RIGHT INTERFACE.


CHEERS,
-- 
/  XAVIER NEYS
_ GENTOO DOCUMENTATION PROJECT
/
/ HTTP://WWW.GENTOO.ORG/DOC/EN/

Re: how to route outgoing emails through a specific network card or ip
country flaguser name
Netherlands
2007-05-17 07:43:39
ALEX EFROS WROTE:
> HI!
> 
> ON THU, MAY 17, 2007 AT 02:28:37PM +0200, XAVIER NEYS
WROTE:
>> IP RULE ADD FWMARK 2 TABLE ADSL
>> IP RULE ADD FWMARK 1 TABLE CABLE
> 
> YOUR FORGET TO NOTE WHAT NAMES OF THESE TABLES 'ADSL'
AND 'CABLE' MUST BE
> ADDED TO /ETC/IPROUTE2/RT_TABLES, FOR EXAMPLE:
> 
> ECHO '1    ADSL'  >> /ETC/IPROUTE2/RT_TABLES
> ECHO '2    CABLE' >> /ETC/IPROUTE2/RT_TABLES

RIGHT.

THANKS FOR THE REMINDER,
-- 
/  XAVIER NEYS
_ GENTOO DOCUMENTATION PROJECT
/
/ HTTP://WWW.GENTOO.ORG/DOC/EN/

Re: how to route outgoing emails through a specific network card or ip
country flaguser name
United States
2007-05-17 08:54:05
On Thu, 17 May 2007 at 14:42, Xavier Neys wrote:
> rdmurraybitdance.com wrote:
>> On Thu, 17 May 2007 at 13:13, Matthias Bethke
wrote:
>>> the cleanest solution but it should work for
now---there's certainly a
>>> better one if you know qmail well, which I
don't.
>>
>> I doubt that.  This is a purely ip level routing
>> issue, not something that can be handled at
>> the application level unless you are using a smart
>> host.
>>
>> iptables is what the OP needs.
>
> Not necessarily. If you use your ISP as a smarthost,
then you just define a
> route to it via the right interface.

I believe I said that: "unless you are using a
smarthost".  

--David
-- 
gentoo-servergentoo.org mailing list


Re: how to route outgoing emails through a specific network card or ip
country flaguser name
Netherlands
2007-05-17 09:06:46
RDMURRAYBITDANCE.COM WROTE:
> ON THU, 17 MAY 2007 AT 14:42, XAVIER NEYS WROTE:
>> RDMURRAYBITDANCE.COM WROTE:
>>> ON THU, 17 MAY 2007 AT 13:13, MATTHIAS BETHKE
WROTE:
>>>> THE CLEANEST SOLUTION BUT IT SHOULD WORK
FOR NOW---THERE'S CERTAINLY A
>>>> BETTER ONE IF YOU KNOW QMAIL WELL, WHICH I
DON'T.
>>>
>>> I DOUBT THAT.  THIS IS A PURELY IP LEVEL
ROUTING
>>> ISSUE, NOT SOMETHING THAT CAN BE HANDLED AT
>>> THE APPLICATION LEVEL UNLESS YOU ARE USING A
SMART
>>> HOST.
>>>
>>> IPTABLES IS WHAT THE OP NEEDS.
>>
>> NOT NECESSARILY. IF YOU USE YOUR ISP AS A
SMARTHOST, THEN YOU JUST
>> DEFINE A
>> ROUTE TO IT VIA THE RIGHT INTERFACE.
> 
> I BELIEVE I SAID THAT: "UNLESS YOU ARE USING A
SMARTHOST".  

SORRY ABOUT THAT.
I SAW TWO LEVELS, I.E. "IPTABLES IS WHAT THE OP
NEEDS." AS A REPLY TO YOUR REPLY.
MY MISTAKE 


CHEERS,
-- 
/  XAVIER NEYS
_ GENTOO DOCUMENTATION PROJECT
/
/ HTTP://WWW.GENTOO.ORG/DOC/EN/

[1-10] [11-12]

about | contact  Other archives ( Real Estate discussion Medical topics )