sendmail sending on alias IP eth0:1
situation:
1 linux server, slackware 10.2 1 NIC, configuration: eth0=10.0.0.1 eth0:1=10.0.0.2 my firewall routes traffic for domain.com to eth0 for website my firewall routes traffic for mail.domain.com to eth0:1 for email i have sendmail configured to only listen on eth0:1 Problem: when sending an email in the header i get the following: "from mail.domain.com ([10.0.0.1])" (but it has my external public IP) The problem this causes is if someone does a reverse lookup they get my domain.com not my mail.domain.com Is there a way to force sendmail to send using the eth0:1 external IP |
I guess it is the route table configuration problem, when the sendmail deamon tries to deliver non-local message, it will try connecting to remote mail server with the default route (it should be eth0 in your case).
My suggestion -- if possible, set your default route to eth0:1. |
how do i change the route?
|
First, check your route table with "route -n", and make sure whether your default route is going through the NIC eth0 or eth0:1
2nd, vi /etc/sysconfig/network/scripts folder for every NIC configuration (meybe various for different linux distribution)..check the GATEWAY option for every NIC script.In your case, the GATEWAY option should present in the eth0:1 script, delete/comment this option for eth0 script. Alternative solution, execute this command in root shell--- route add default gw 10.0.0.X eth0:1, if it doesnt overwrite the old one, you may run route -delete ....for deleting the eth0 one. |
ooops...you only have 1 NIC....so...the alternative solution should work for you...forget the 2nd step....
|
thanks so much for the help! That worked for me too. I could not find one solution to that problem online.
|
I use slackware, that command disabled my network, i had to run ./rc.inet1 restart to get it back working. this is what i get for route -n:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo 0.0.0.0 10.0.0.1 0.0.0.0 UG 1 0 0 eth0 for simplicity in my initial post i gave 10.0.0.1 and .2, in reality my NIC is setup as: eth0 10.0.0.10 eth0:1 10.0.0.15 eth0:2 10.0.0.20 eth0 = www.domain.com eth0:1 mail.domain.com eth0:2 internal intranet used by apache virtual host |
hmm i use slackware too and host about 400 users. What were the exact commands you used after restarting inet1?
I use the following after my firewall starts up to change the default gw interface: route del default gw xxx.xxx.xxx.xxx eth1 route add default gw xxx.xxx.xxx.xxx eth1:2 where xxx.xxx.xxx.xxx is that ip address of your default gw you use to access the internet. Hope that helps. |
that might help, i didn't delete the old route
am i able to put those commands in my rc.inet1 script so they are automatic? |
okay I set this up by modifying two files:
rc.inet1.conf: add this after the $GATEWAY variable -> $GW_IF = "eth1:0" rc.inet1: replace the gateway_up() with the following: gateway_up() { if ! /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then if [ ! "$GATEWAY" = "" ]; then if [ "$GW_IF" = "" ]; then echo "/etc/rc.d/rc.inet1: /sbin/route add default gw ${GATEWAY} metric 1" | $LOGGER /sbin/route add default gw ${GATEWAY} metric 1 2>&1 | $LOGGER else echo "/etc/rc.d/rc.inet1: /sbin/route add default gw ${GATEWAY} ${GW_IF}" | $LOGGER /sbin/route add default gw ${GATEWAY} ${GW_IF} 2>&1 | $LOGGER fi fi fi } |
Sorry, you may need to put tabs back into that code above. I couldnt get it to submit to this forum and keep the tabs. It will work either way though. Just make sure to set the $GW_IF to your interface you want it to be the default gw on.
|
All times are GMT -5. The time now is 07:39 PM. |