I have a Fedora router that juggles two Internet connections. When ISPA drops, I have a script that sets the default GW to ISPB, and then fails back to ISPA when ISPA comes back online. This all works.
The challenge is sending notifications. Part of the scripting is sending a Postfix email notification to a list. When I fail over to ISPB and when I fail back to ISPA, I send an email, like this:
mail -s "$(date) $(hostname) Primary path $POLL_IP is offline. Routing via backup $BACKUPGW." $NOTIFY_LIST < /dev/null
Just a quick subject line, no message body. This works, sort of.
The mail hits the outbound queue, but nothing goes out from Postfix. But the instant I fail back to ISPA, all the emails fly out the door. So essentially, this means nobody gets notified until after everything is back to normal again.
I've tried restarting postfix at failover, but this doesn't make any difference.
The Postfix config is as generic as it gets. The only change I made from the default config templates is one line in main.cf that looks like this:
myhostname = greg-fw
Everything else is right out of the box. Oh - resolv.conf has DNS resolvers from both ISPA and ISPB, so DNS resolution should be OK. Maybe a little slower when failed over to ISPB.
This particular instance is on Fedora 13 with postfix-2.7.4-1.fc13.i686. I know it's a little bit old, but I'll bet the same challenge exists with the latest versions.
Why would Postfix care if I change default gateway?
- Greg Scott