LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   sendmail sending on alias IP eth0:1 (https://www.linuxquestions.org/questions/linux-networking-3/sendmail-sending-on-alias-ip-eth0-1-a-385941/)

Finlay 11-23-2005 05:26 PM

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

seagley 11-25-2005 02:10 AM

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.

Finlay 11-25-2005 03:33 AM

how do i change the route?

seagley 11-25-2005 03:55 AM

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.

seagley 11-25-2005 04:04 AM

ooops...you only have 1 NIC....so...the alternative solution should work for you...forget the 2nd step....

sdave1284 11-25-2005 05:42 PM

thanks so much for the help! That worked for me too. I could not find one solution to that problem online.

Finlay 11-28-2005 11:22 AM

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

sdave1284 11-28-2005 11:50 AM

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.

Finlay 11-28-2005 11:57 AM

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?

sdave1284 11-28-2005 12:25 PM

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
}

sdave1284 11-28-2005 12:27 PM

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.