6

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
bahamat
  • 39,666
  • 4
  • 75
  • 104
Pedge
  • 61
  • 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 – Pedge 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 Answers2

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.

Nils
  • 18,492
0

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.

BillThor
  • 8,965