LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 11-23-2005, 05:26 PM   #1
Finlay
Senior Member
 
Registered: Mar 2003
Location: Seattle
Distribution: Slackware ?-14.1
Posts: 1,029

Rep: Reputation: 47
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
 
Old 11-25-2005, 02:10 AM   #2
seagley
LQ Newbie
 
Registered: Nov 2005
Location: China
Distribution: Redhat,SuSE.FreeBSD
Posts: 13

Rep: Reputation: 1
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.
 
Old 11-25-2005, 03:33 AM   #3
Finlay
Senior Member
 
Registered: Mar 2003
Location: Seattle
Distribution: Slackware ?-14.1
Posts: 1,029

Original Poster
Rep: Reputation: 47
how do i change the route?
 
Old 11-25-2005, 03:55 AM   #4
seagley
LQ Newbie
 
Registered: Nov 2005
Location: China
Distribution: Redhat,SuSE.FreeBSD
Posts: 13

Rep: Reputation: 1
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.
 
1 members found this post helpful.
Old 11-25-2005, 04:04 AM   #5
seagley
LQ Newbie
 
Registered: Nov 2005
Location: China
Distribution: Redhat,SuSE.FreeBSD
Posts: 13

Rep: Reputation: 1
ooops...you only have 1 NIC....so...the alternative solution should work for you...forget the 2nd step....
 
Old 11-25-2005, 05:42 PM   #6
sdave1284
LQ Newbie
 
Registered: Feb 2004
Posts: 9

Rep: Reputation: 0
thanks so much for the help! That worked for me too. I could not find one solution to that problem online.
 
Old 11-28-2005, 11:22 AM   #7
Finlay
Senior Member
 
Registered: Mar 2003
Location: Seattle
Distribution: Slackware ?-14.1
Posts: 1,029

Original Poster
Rep: Reputation: 47
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
 
Old 11-28-2005, 11:50 AM   #8
sdave1284
LQ Newbie
 
Registered: Feb 2004
Posts: 9

Rep: Reputation: 0
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.
 
Old 11-28-2005, 11:57 AM   #9
Finlay
Senior Member
 
Registered: Mar 2003
Location: Seattle
Distribution: Slackware ?-14.1
Posts: 1,029

Original Poster
Rep: Reputation: 47
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?
 
Old 11-28-2005, 12:25 PM   #10
sdave1284
LQ Newbie
 
Registered: Feb 2004
Posts: 9

Rep: Reputation: 0
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
}
 
Old 11-28-2005, 12:27 PM   #11
sdave1284
LQ Newbie
 
Registered: Feb 2004
Posts: 9

Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendmail - not sending mail movitto Linux - Software 8 04-11-2007 12:04 AM
Eth0 IP Alias Problem assyrian47 Slackware 1 04-20-2005 11:50 AM
eth0 and eth1 alias switches in SuSE 9.2 mephesto Linux - Networking 3 03-02-2005 07:20 PM
help - eth0 alias conflict with my USB-ethernet card darkelf Linux - Networking 1 11-05-2003 10:43 AM
ifcfg-eth0:X alias problem dgenne Linux - Networking 1 03-17-2002 01:43 AM


All times are GMT -5. The time now is 12:34 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration