Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-23-2005, 06:26 PM
|
#1
|
Senior Member
Registered: Mar 2003
Location: Seattle
Distribution: Slackware ?-14.1
Posts: 1,029
Rep:
|
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
|
|
|
11-25-2005, 03:10 AM
|
#2
|
LQ Newbie
Registered: Nov 2005
Location: China
Distribution: Redhat,SuSE.FreeBSD
Posts: 13
Rep:
|
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.
|
|
|
11-25-2005, 04:33 AM
|
#3
|
Senior Member
Registered: Mar 2003
Location: Seattle
Distribution: Slackware ?-14.1
Posts: 1,029
Original Poster
Rep:
|
how do i change the route?
|
|
|
11-25-2005, 04:55 AM
|
#4
|
LQ Newbie
Registered: Nov 2005
Location: China
Distribution: Redhat,SuSE.FreeBSD
Posts: 13
Rep:
|
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.
|
11-25-2005, 05:04 AM
|
#5
|
LQ Newbie
Registered: Nov 2005
Location: China
Distribution: Redhat,SuSE.FreeBSD
Posts: 13
Rep:
|
ooops...you only have 1 NIC....so...the alternative solution should work for you...forget the 2nd step....
|
|
|
11-25-2005, 06:42 PM
|
#6
|
LQ Newbie
Registered: Feb 2004
Posts: 9
Rep:
|
thanks so much for the help! That worked for me too. I could not find one solution to that problem online.
|
|
|
11-28-2005, 12:22 PM
|
#7
|
Senior Member
Registered: Mar 2003
Location: Seattle
Distribution: Slackware ?-14.1
Posts: 1,029
Original Poster
Rep:
|
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
|
|
|
11-28-2005, 12:50 PM
|
#8
|
LQ Newbie
Registered: Feb 2004
Posts: 9
Rep:
|
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.
|
|
|
11-28-2005, 12:57 PM
|
#9
|
Senior Member
Registered: Mar 2003
Location: Seattle
Distribution: Slackware ?-14.1
Posts: 1,029
Original Poster
Rep:
|
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?
|
|
|
11-28-2005, 01:25 PM
|
#10
|
LQ Newbie
Registered: Feb 2004
Posts: 9
Rep:
|
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
}
|
|
|
11-28-2005, 01:27 PM
|
#11
|
LQ Newbie
Registered: Feb 2004
Posts: 9
Rep:
|
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 02:25 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|