Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

We have sendmail running in a RHEL box. We have two public IP address configured in the same box, one for SAP app and other for Sendmail. First interface will be used for SAP and second for Sendmail. I have binded the Sendmail daemon on secondary NIC, but when I send out a mail, traffic is getting initiated via the primary NIC and connection is getting refused as port 25 is blocked for the this NIC in the firewall.

Can someone please help me out to resolve this? Should I make changes in Sendmail's config to route SMTP traffic via secondary NIC, or should I play with IPtables to get this done? I need some ideas.

Thanks in advance for the reply.

Christopher

As requested:

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
xxx.x.x.32      0.0.0.0         255.255.255.240 U     0      0        0 eth1
10.90.9.96      0.0.0.0         255.255.255.224 U     0      0        0 eth0
0.0.0.0         xx.x.x.33       0.0.0.0         UG    0      0        0 eth1
share|improve this question
    
What is your routing table? ip route show or route -en –  Ulrich Dangel Jun 27 '12 at 10:06
    
route -n O/P Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface xxx.x.x.32 0.0.0.0 255.255.255.240 U 0 0 0 eth1 10.90.9.96 0.0.0.0 255.255.255.224 U 0 0 0 eth0 0.0.0.0 xxx.x.x.33 0.0.0.0 UG 0 0 0 eth1 –  Prem Jun 27 '12 at 10:26
    
This is a little bit unreadable but it seems that eth0 has no default route so you can only send mails via eth1 –  Ulrich Dangel Jun 27 '12 at 10:30
    
Which interface do you want sendmail to use? –  bahamat Jun 27 '12 at 19:28

2 Answers 2

ip route get $(gethostip -d $NEXTSMTPHOP) should show the interface that will be used for your outbound traffic. Binding an interface will only influence the listen-address for inbound traffic.

So you need to setup routing in a way that your next SMTP-HOP (hopefully a static IP) is going out through your desired interface.

share|improve this answer

I believe you will need to use marking in iptables to choose routes based on the port. The only documentation I have seen on doing this is the Shorewall multiple ISP documentation.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.