Networking Forums

Networking Forums > Computer Networking > Linux Networking > Letting postfix use eth2

Reply
Thread Tools Display Modes

Letting postfix use eth2

 
 
franck
Guest
Posts: n/a

 
      02-25-2011, 10:44 AM
Hi,

I have a linux server with 2 interfaces (eth0 and eth2).
I need to send mails to a smtp server that accepts to relay mail from the
ip address associated to eth2.
I try to let postfix send mails to this smarthost, but it insists on using
eth0, so mail is rejected.

I have tried to set a static route to the smtp server via eth2 with :

route add -host ip.of.smtp.server dev eth2

But then, I get a no route to host when trying to send mails, and I
cannot ping the smtp server anymore.

I'm lost (and really not familiar with routing as you may have guessed),
any hint would be helpful... Thanks.



 
Reply With Quote
 
 
 
 
Pascal Hambourg
Guest
Posts: n/a

 
      02-25-2011, 11:08 AM
Hello,

franck a écrit :
>
> I have a linux server with 2 interfaces (eth0 and eth2).
> I need to send mails to a smtp server that accepts to relay mail from the
> ip address associated to eth2.
> I try to let postfix send mails to this smarthost, but it insists on using
> eth0, so mail is rejected.


I guess the the smarthost is on a remote subnet and the default route is
on eth0.

> I have tried to set a static route to the smtp server via eth2 with :
>
> route add -host ip.of.smtp.server dev eth2
>
> But then, I get a no route to host when trying to send mails, and I
> cannot ping the smtp server anymore.


This route says that the smarthost is directly reachable on the subnet
connected to eth2. AFACS, this is wrong. If there is a gateway (router)
connected to eth2 and the smarthost is truely reachable through this
gateway, then the proper route is

route add -host <smarthost> gw <gateway-on-eth2>
 
Reply With Quote
 
franck
Guest
Posts: n/a

 
      02-25-2011, 12:08 PM
On Fri, 25 Feb 2011 13:08:41 +0100, Pascal Hambourg wrote:

My configuration is as follow:

from /etc/network/interfaces (debian/ubuntu)

# The primary network interface

auto eth0
iface eth0 inet dhcp

# The secondary network interface
auto eth2
iface eth2 inet static
address 172.16.1.86
netmask 255.255.0.0
gateway 172.16.1.23


Then ifconfig shows :

$ ifconfig
eth0 Link encap:Ethernet HWaddr 20:cf:30:11:e4:46
inet adr:172.16.9.121 Bcast:172.16.255.255 Masque:255.255.0.0
adr inet6: fe80::22cf:30ff:fe11:e446/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Packets reƧus:136262873 erreurs:0 :0 overruns:0 frame:0
TX packets:12580697 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
Octets reƧus:10586213609 (10.5 GB) Octets transmis:16568646087
(16.5 GB)
Interruption:44 Adresse de base:0x2000

eth2 Link encap:Ethernet HWaddr f0:7d:68:c4:b0:99
inet adr:172.16.1.86 Bcast:172.16.255.255 Masque:255.255.0.0
adr inet6: fe80::f27d:68ff:fec4:b099/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Packets reƧus:127673578 erreurs:0 :0 overruns:0 frame:0
TX packets:106940 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
Octets reƧus:8951080718 (8.9 GB) Octets transmis:8038381 (8.0
MB)
Interruption:20 Adresse de base:0x6c00

So it seems both interfaces are on the same network (172.16.0.0), with
the same gateway... (?)

Then route says :

$ route
Table de routage IP du noyau
Destination Passerelle Genmask Indic Metric Ref Use
Iface
172.16.0.0 * 255.255.0.0 U 0 0 0
eth0
172.16.0.0 * 255.255.0.0 U 0 0 0
eth2
default 172.16.1.23 0.0.0.0 UG 100 0 0
eth2
default 172.16.1.23 0.0.0.0 UG 100 0 0
eth0

Smarthost is at 172.16.1.24 and relays mail from 172.16.1.86 (eth2).
Then adding

route add -host 172.16.1.24 dev eth2

will make smarthost unreachable...
 
Reply With Quote
 
Bill Marcum
Guest
Posts: n/a

 
      02-25-2011, 02:05 PM
On 2011-02-25, franck <(E-Mail Removed)> wrote:
> On Fri, 25 Feb 2011 13:08:41 +0100, Pascal Hambourg wrote:
>
> My configuration is as follow:
>
> from /etc/network/interfaces (debian/ubuntu)
>
> # The primary network interface
>
> auto eth0
> iface eth0 inet dhcp
>
> # The secondary network interface
> auto eth2
> iface eth2 inet static
> address 172.16.1.86
> netmask 255.255.0.0
> gateway 172.16.1.23
>
>


> Then ifconfig shows :
>
> $ ifconfig
> eth0 Link encap:Ethernet HWaddr 20:cf:30:11:e4:46
> inet adr:172.16.9.121 Bcast:172.16.255.255 Masque:255.255.0.0
> adr inet6: fe80::22cf:30ff:fe11:e446/64 Scope:Lien
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> Packets reƧus:136262873 erreurs:0 :0 overruns:0 frame:0
> TX packets:12580697 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 lg file transmission:1000
> Octets reƧus:10586213609 (10.5 GB) Octets transmis:16568646087
> (16.5 GB)
> Interruption:44 Adresse de base:0x2000
>
> eth2 Link encap:Ethernet HWaddr f0:7d:68:c4:b0:99
> inet adr:172.16.1.86 Bcast:172.16.255.255 Masque:255.255.0.0
> adr inet6: fe80::f27d:68ff:fec4:b099/64 Scope:Lien
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> Packets reƧus:127673578 erreurs:0 :0 overruns:0 frame:0
> TX packets:106940 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 lg file transmission:1000
> Octets reƧus:8951080718 (8.9 GB) Octets transmis:8038381 (8.0
> MB)
> Interruption:20 Adresse de base:0x6c00
>
> So it seems both interfaces are on the same network (172.16.0.0), with
> the same gateway... (?)
>

Why do you have two interfaces on the same network, and why does your
email have to go through eth2? Just get rid of eth0.


--
Science is to computer science as hydrodynamics is to plumbing.
 
Reply With Quote
 
franck
Guest
Posts: n/a

 
      02-25-2011, 02:57 PM
On Fri, 25 Feb 2011 10:05:40 -0500, Bill Marcum wrote:

> Why do you have two interfaces on the same network, and why does your
> email have to go through eth2? Just get rid of eth0.


Well, I'd rather. But I am integrating my dedicated server into a
customer's network, and the second interface is here for future use (to
allow to seperate high load ETL traffic). So in the long run it might be
on another network, but until then I have to cope with it :-(

 
Reply With Quote
 
unruh
Guest
Posts: n/a

 
      02-25-2011, 11:46 PM
On 2011-02-25, franck <(E-Mail Removed)> wrote:
> Hi,
>
> I have a linux server with 2 interfaces (eth0 and eth2).
> I need to send mails to a smtp server that accepts to relay mail from the
> ip address associated to eth2.
> I try to let postfix send mails to this smarthost, but it insists on using
> eth0, so mail is rejected.


Postfix knows nothing. It sends out info to the ip address of your
mailer, or of the destination (do not know how your transport map is set
up). The routing then looks up that address and decides which network to
send it through to get to that address. Set up your routing so that the
emails go to the right place.

>
> I have tried to set a static route to the smtp server via eth2 with :
>
> route add -host ip.of.smtp.server dev eth2
>
> But then, I get a no route to host when trying to send mails, and I
> cannot ping the smtp server anymore.


Which means that the smtp server is NOT on eth2, despite what you think.
What makes you think it is on eth2?

>
> I'm lost (and really not familiar with routing as you may have guessed),
> any hint would be helpful... Thanks.
>
>
>

 
Reply With Quote
 
unruh
Guest
Posts: n/a

 
      02-25-2011, 11:57 PM
On 2011-02-25, franck <(E-Mail Removed)> wrote:
> On Fri, 25 Feb 2011 13:08:41 +0100, Pascal Hambourg wrote:
>
> My configuration is as follow:
>
> from /etc/network/interfaces (debian/ubuntu)
>
> # The primary network interface
>
> auto eth0
> iface eth0 inet dhcp
>
> # The secondary network interface
> auto eth2
> iface eth2 inet static
> address 172.16.1.86
> netmask 255.255.0.0
> gateway 172.16.1.23
>
>
> Then ifconfig shows :
>
> $ ifconfig
> eth0 Link encap:Ethernet HWaddr 20:cf:30:11:e4:46
> inet adr:172.16.9.121 Bcast:172.16.255.255 Masque:255.255.0.0
> adr inet6: fe80::22cf:30ff:fe11:e446/64 Scope:Lien
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> Packets re??us:136262873 erreurs:0 :0 overruns:0 frame:0
> TX packets:12580697 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 lg file transmission:1000
> Octets re??us:10586213609 (10.5 GB) Octets transmis:16568646087
> (16.5 GB)
> Interruption:44 Adresse de base:0x2000
>
> eth2 Link encap:Ethernet HWaddr f0:7d:68:c4:b0:99
> inet adr:172.16.1.86 Bcast:172.16.255.255 Masque:255.255.0.0
> adr inet6: fe80::f27d:68ff:fec4:b099/64 Scope:Lien
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> Packets re??us:127673578 erreurs:0 :0 overruns:0 frame:0
> TX packets:106940 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 lg file transmission:1000
> Octets re??us:8951080718 (8.9 GB) Octets transmis:8038381 (8.0
> MB)
> Interruption:20 Adresse de base:0x6c00
>
> So it seems both interfaces are on the same network (172.16.0.0), with
> the same gateway... (?)
>
> Then route says :
>
> $ route
> Table de routage IP du noyau
> Destination Passerelle Genmask Indic Metric Ref Use
> Iface
> 172.16.0.0 * 255.255.0.0 U 0 0 0
> eth0
> 172.16.0.0 * 255.255.0.0 U 0 0 0
> eth2


That is totally useless It says that those addresses are reachable on
both interfaces, but there can only be way to send it-- the latest will
be used ( which is eth0)

> default 172.16.1.23 0.0.0.0 UG 100 0 0
> eth2
> default 172.16.1.23 0.0.0.0 UG 100 0 0
> eth0


Same for default. You need to straighten out your routing.


>
> Smarthost is at 172.16.1.24 and relays mail from 172.16.1.86 (eth2).
> Then adding
>
> route add -host 172.16.1.24 dev eth2


No, but if you need to reach it via some gateway, you have to specify
that gateway.


>
> will make smarthost unreachable...

 
Reply With Quote
 
Marc Haber
Guest
Posts: n/a

 
      02-26-2011, 08:33 AM
franck <(E-Mail Removed)> wrote:
>On Fri, 25 Feb 2011 10:05:40 -0500, Bill Marcum wrote:
>> Why do you have two interfaces on the same network, and why does your
>> email have to go through eth2? Just get rid of eth0.

>
>Well, I'd rather. But I am integrating my dedicated server into a
>customer's network, and the second interface is here for future use (to
>allow to seperate high load ETL traffic). So in the long run it might be
>on another network, but until then I have to cope with it :-(


Just disable it in the mean time. Having two interfaces on the same
network will NOT do what beginners expect.

Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Mannheim, Germany | Beginning of Wisdom " | http://www.zugschlus.de/
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 621 72739834
 
Reply With Quote
 
Netsurfeur
Guest
Posts: n/a

 
      02-26-2011, 08:48 AM
Le 25/02/2011 12:44, franck a Ʃcrit :
> Hi,
>
> I have a linux server with 2 interfaces (eth0 and eth2).
> I need to send mails to a smtp server that accepts to relay mail from the
> ip address associated to eth2.
> I try to let postfix send mails to this smarthost, but it insists on using
> eth0, so mail is rejected.
>
> I have tried to set a static route to the smtp server via eth2 with :
>
> route add -host ip.of.smtp.server dev eth2
>
> But then, I get a no route to host when trying to send mails, and I
> cannot ping the smtp server anymore.
>
> I'm lost (and really not familiar with routing as you may have guessed),
> any hint would be helpful... Thanks.
>
>
>

Hi,

You can force Postfix to use a specific source IP address.
See smtp_bind_address in Postfix documentation
:http://www.postfix.org/postconf.5.ht...p_bind_address

Hope this helps,
--
Netsurfeur
 
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
Windows 7 Not Letting me connect to Wireless Tom Bell Wireless Networks 7 08-24-2011 11:57 AM
eth1 -> eth2 barcaroller Linux Networking 3 06-01-2009 04:59 PM
device eth2 does not seem to be present Duane Evenson Linux Networking 1 10-26-2006 01:42 AM
Error: eth2: transmit timed out bolero92@yahoo.com Linux Networking 3 08-29-2006 12:01 PM
Wireless not letting Application to install James Robetson Wireless Networks 4 08-08-2005 09:12 PM



1 2 3 4 5 6 7 8 9 10 11