How to change IP adress of mailserver in Solaris?

Hi all,

Our IT changes mailserver's IP address and I am trying to change it but with no success.
I am running Solaris 10.
I changed IP address of mail server in /etc/hosts file, performed make sendmail.cf but server still sends mais using old IP.

Can anyone let me know which actions have to be done to change IP address of mail server please?

Thanks in advance,
Roman

Do you have a smarthost defined in your sendmail configuration? If so, change it there and restart sendmail.

If you use the *.mc macro files, look for a line like

define(`SMART_HOST', mail.example.com)dnl

After changing sendmail.mc, don't forget to run make

Otherwise look into the sendmail.cf file and find a line like

DSmail.example.com

and change accordingly.

Hi Hergp,

Thanks for the answer.
We've changed only IP address of mail server, its name still same.
Here it is what i have in sendmail.cf file:

and my hosts file:

after changing IP in hosts file I restarted mail server with commands:

And even restarted server, but issue still remain...

First, does

getent hosts mail.azerfon.az
getent hosts sms.narmobile.az 			 		

print the correct IP addresses?

Further, I don't think, repeating the DS macro is the correct way to define multiple smarthosts. Afaik it should be

DSmail.azerfon.az:sms.narmobile.az

I changed as u said:

DSmail.azerfon.az:sms.narmobile.az

Then run command:

-bash-3.00# /usr/ccs/bin/make sendmail.cf
`sendmail.cf' is up to date.

and:

-bash-3.00# getent hosts mail.azerfon.az
10.10.1.86      mail.azerfon.az mailhost
-bash-3.00# getent hosts sms.narmobile.az
10.75.58.83     sms.narmobile.az
-bash-3.00# 

When I am trying to send test mail using

echo "swdfsdf "  | /usr/bin/mailx -s "MSS04 Clear Code 1 > 95" rrosliy@azerfon.az

and doing snoop in other window for 10.10.1.86 I can see that nothing happens:

-bash-3.00# snoop -r 10.10.1.86
Using device /dev/ce (promiscuous mode)

But if I am doing snoop to old mailserver's IP, I can see:

-bash-3.00# snoop -r 10.13.44.16
Using device /dev/ce (promiscuous mode)
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 220 ***************\r
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 EHLO analizator.com\r
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 250-mail.azerfon.az\r
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 MAIL From:<root@anal
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 250 2.1.0 Ok\r\n
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 RCPT To:<root@analiz
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 554 5.7.1 <root@anal
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 RSET\r\n
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 250 2.0.0 Ok\r\n
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 RSET\r\n
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 250 2.0.0 Ok\r\n
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 MAIL From:<> SIZE=12
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 250 2.1.0 Ok\r\n
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 RCPT To:<root@analiz
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 554 5.7.1 <root@anal
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 RSET\r\n
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 250 2.0.0 Ok\r\n
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 RSET\r\n
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 250 2.0.0 Ok\r\n
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 MAIL From:<> SIZE=23
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 250 2.1.0 Ok\r\n
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 RCPT To:<postmaster@
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 554 5.7.1 <postmaste
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 RSET\r\n
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 250 2.0.0 Ok\r\n
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 QUIT\r\n
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 221 2.0.0 Bye\r\n
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 
10.15.208.88 -> 10.13.44.16  SMTP C port=32955 
 10.13.44.16 -> 10.15.208.88 SMTP R port=32955 
10.15.208.88 -> 10.13.44.16  SMTP C port=32956 
 10.13.44.16 -> 10.15.208.88 SMTP R port=32956 
10.15.208.88 -> 10.13.44.16  SMTP C port=32956 
 10.13.44.16 -> 10.15.208.88 SMTP R port=32956 220 ***************\r
10.15.208.88 -> 10.13.44.16  SMTP C port=32956 
10.15.208.88 -> 10.13.44.16  SMTP C port=32956 EHLO analizator.com\r
 10.13.44.16 -> 10.15.208.88 SMTP R port=32956 250-mail.azerfon.az\r
10.15.208.88 -> 10.13.44.16  SMTP C port=32956 
10.15.208.88 -> 10.13.44.16  SMTP C port=32956 MAIL From:<rrosliy@a
 10.13.44.16 -> 10.15.208.88 SMTP R port=32956 250 2.1.0 Ok\r\n
10.15.208.88 -> 10.13.44.16  SMTP C port=32956 RCPT To:<rrosliy@aze
 10.13.44.16 -> 10.15.208.88 SMTP R port=32956 250 2.1.5 Ok\r\n354 En
10.15.208.88 -> 10.13.44.16  SMTP C port=32956 Received: (from root
 10.13.44.16 -> 10.15.208.88 SMTP R port=32956 
10.15.208.88 -> 10.13.44.16  SMTP C port=32956 
 10.13.44.16 -> 10.15.208.88 SMTP R port=32956 250 2.0.0 Ok: queued
10.15.208.88 -> 10.13.44.16  SMTP C port=32956 QUIT\r\n
 10.13.44.16 -> 10.15.208.88 SMTP R port=32956 221 2.0.0 Bye\r\n
 10.13.44.16 -> 10.15.208.88 SMTP R port=32956 
10.15.208.88 -> 10.13.44.16  SMTP C port=32956 
10.15.208.88 -> 10.13.44.16  SMTP C port=32956 
 10.13.44.16 -> 10.15.208.88 SMTP R port=32956 

So it means that mailx using old IP...
Any idea?

Thanks.

Check, if any other files in /etc/mail contain the old IP address (10.13.44.16). /etc/mail/mailertable would be a candidate for this.

---------- Post updated at 11:41 ---------- Previous update was at 11:40 ----------

And BTW: you don't have to run make , when you edit sendmail.cf directly. It is only used to compile the sendmail.cf file from sendmail.mc.

-bash-3.00# pwd
/etc/mail
-bash-3.00# grep 10.13.44.16 *
-bash-3.00# 
-bash-3.00# 
-bash-3.00# find . | xargs grep '10.13.44.16'
-bash-3.00# 
-bash-3.00# 
-bash-3.00# 
-bash-3.00# grep 10.10.1.86 *
-bash-3.00# find . | xargs grep '10.10.1.86'
-bash-3.00# 

I think that IP address specified in some other place, not in /etc/mail.

Guys, any ideas? :slight_smile:

Maybe it`s resolving issue?

# grep "^host" /etc/nsswitch.conf
# nslookup mail.azerfon.az

First off, the documentation says to change /etc/hosts only if you are NOT running a name service.

I think you may have a dns cache problem - mailhost is probably cached by dns.

Clear the DNS cache (do this only if nscd (name serve daemon)is running, otherwise don't do this):

/etc/init.d/nscd stop
/etc/init.d/nscd start

This will clear the local DNS cache. Next try:

nslookup mailhost

Your problem has to be local to the UNIX box. You have clearly started and stopped sendmail.

I was thinking that mailservice will take IP of mail server from hosts file, isn't it?

I did what you guys suggested:

-bash-3.00# /etc/init.d/nscd stop
-bash-3.00# /etc/init.d/nscd start
-bash-3.00# 
-bash-3.00# 
-bash-3.00# nslookup mail.azerfon.az
Server:         10.10.1.3
Address:        10.10.1.3#53

Name:   mail.azerfon.az
Address: 10.13.44.16

-bash-3.00# 
-bash-3.00# 
-bash-3.00# grep "^host" /etc/nsswitch.conf
hosts:      files dns
-bash-3.00# 
-bash-3.00# 
-bash-3.00# 
-bash-3.00# cat /etc/nsswitch.conf 
#
# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

#
# /etc/nsswitch.dns:
#
# An example file that could be copied over to /etc/nsswitch.conf; it uses
# DNS for hosts lookups, otherwise it does not use any other naming service.
#
# "hosts:" and "services:" in this file are used only if the
# /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.

# DNS service expects that an instance of svc:/network/dns/client be
# enabled and online.

passwd:     files
group:      files

# You must also set up the /etc/resolv.conf file for DNS name
# server lookup.  See resolv.conf(4).
hosts:      files dns

# Note that IPv4 addresses are searched for in all of the ipnodes databases
# before searching the hosts databases.
ipnodes:   files dns

networks:   files
protocols:  files
rpc:        files
ethers:     files
netmasks:   files
bootparams: files
publickey:  files
# At present there isn't a 'files' backend for netgroup;  the system will 
#   figure it out pretty quickly, and won't use netgroups at all.
netgroup:   files
automount:  files
aliases:    files
services:   files
printers:       user files

auth_attr:  files
prof_attr:  files
project:    files

tnrhtp:     files
tnrhdb:     files
-bash-3.00# 
-bash-3.00# 

I was planing to ask about nscd after you answer my first question but jim mcnamara was faster :wink:
I was also thinking that it should first read hosts file. It is little strange behaviour for me.
Add hostname without domain to /etc/hosts

10.10.1.86 mail mail.azerfon.az mailhost

I'm wondering could it resolve mailhost's IP if you would comment out dns in nsswitch.conf. You can try this if it is not very important production server.
But as we can see the problem is also with your DNS server, which response with old IP address. You must change mailhost's IP on your DNS.

Guys, I changed mailserver name:

-bash-3.00# nslookup autodiscover.azerfon.az
Server:         10.10.1.3
Address:        10.10.1.3#53

Name:   autodiscover.azerfon.az
Address: 10.10.1.86

-bash-3.00# 
# "Smart" relay host (may be null)
#DSmail.azerfon.az:sms.narmobile.az
DSautodiscover.azerfon.az

and here is my hosts file:

-bash-3.00# cat /etc/hosts
#
# Internet host table
#
::1     localhost       
127.0.0.1       localhost       
10.15.208.88    analizator      analizator.com  loghost
10.15.208.89    Analizator2     
#10.10.1.86     mail.azerfon.az mailhost        autodiscover.azerfon.az
10.10.1.86      autodiscover.azerfon.az         mailhost
10.75.58.83     sms.narmobile.az
-bash-3.00# 

I tried send mail and can see that requests again going through 10.13.44.16 (which is not mentioned anywhere)

Its not production server, so I can test things there, but I have no idea what ca be the reason :slight_smile:

GP81, I didn't get what you meant under:

Can u pls let me know which line I should comment?
Here is my nsswitch.conf file:

-bash-3.00# grep "^host" /etc/nsswitch.conf
hosts:      files dns
-bash-3.00# 
-bash-3.00# 
-bash-3.00# 
-bash-3.00# cat /etc/nsswitch.conf 
#
# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

#
# /etc/nsswitch.dns:
#
# An example file that could be copied over to /etc/nsswitch.conf; it uses
# DNS for hosts lookups, otherwise it does not use any other naming service.
#
# "hosts:" and "services:" in this file are used only if the
# /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.

# DNS service expects that an instance of svc:/network/dns/client be
# enabled and online.

passwd:     files
group:      files

# You must also set up the /etc/resolv.conf file for DNS name
# server lookup.  See resolv.conf(4).
hosts:      files dns

# Note that IPv4 addresses are searched for in all of the ipnodes databases
# before searching the hosts databases.
ipnodes:   files dns

networks:   files
protocols:  files
rpc:        files
ethers:     files
netmasks:   files
bootparams: files
publickey:  files
# At present there isn't a 'files' backend for netgroup;  the system will 
#   figure it out pretty quickly, and won't use netgroups at all.
netgroup:   files
automount:  files
aliases:    files
services:   files
printers:       user files

auth_attr:  files
prof_attr:  files
project:    files

tnrhtp:     files
tnrhdb:     files
-bash-3.00# 

---------- Post updated at 11:32 AM ---------- Previous update was at 10:08 AM ----------

Hi again,

I found where the problem was.

Problem was in submit.cf file:

D{MTAHost}[mail.azerfon.az]

after modifing this line and restarting mail services, problem has been solved.

Thanks to all for the help!