Praedor Tempus wrote:
> 
> On Thursday 20 June 2002 07:26 am, Mike Rambo wrote:
> > Mike Rambo wrote:
> > > Praedor Tempus wrote:
> > > > On Wednesday 19 June 2002 12:03 pm, daRcmaTTeR wrote:
> > > > > Praedor Tempus wrote:
> > > > > > I am hesitant to try this again...I run postfix on my system as my
> > > > > > mta. I own the ravenhome.net domain.  I want my postfix to identify
> > > > > > outgoing
> [...]
> > > Did you really _change_ the localhost entries? If so, that
> > > is a no-no. You _must_ have the localhost entries intact.
> > > You just _add_ entries for the additional IP/name
> > > combinations you need.
> > >
> I tried actually altering the localhost entries (long time ago) and also
> adding entries.  Must I assign an extra IP like 10.0.0.x or 192.168.1.x for
> this to work?  Thing is, I have a dynamic IP via dialup.  The interface is a
> linmodem (/dev/tts/LT0).  Would I have to go into, say, linuxconf and
> manually assign an address to this interface?  But then, I use dhcp to get
> the address.  How is this supposed to work  in a case like mine?
> 
> > > [mrambo@mrambo mrambo]$ more /etc/hosts
> > > 127.0.0.1               localhost.localdomain localhost
> > > 192.168.1.12            mrambo.imcdom.local mrambo
> [...]
> > Where are you changing the hostname (what file)? The
> > hostname is set in /etc/sysconfig/network. /etc/hosts
> > relates hostnames to IP addresses but doesn't really set
> > anything.
> [...]
> 
> I have altered the hostname once before but, of course, it doesn't do what I
> really want (to make postfix send email from ravenhome.net instead of
> localhost.localdomain).
> 
> What I need to know, I suppose, is how do I get postfix to do this given that
> I really can't add an entry to /etc/hosts...what IP would I use?  Above you
> use the 192.168.1- based address but how can I assign something like this to
> my linmodem/winmodem which is on sometimes, off most of the time, and
> actually acquires a different IP every dialup?
> 
> praedor
> 

Here is a script you can run when the ppp interface is
brought up. A good place to put it might be
/etc/ppp/ip-up.local (this file probably won't exist but
/etc/ppp/ip-up will automatically run it if you create it).
AFAIK it is ok to relate a hostname to more than one IP
address. You may need this if your server
(overlord.ravenhome.net) has multiple interfaces (like an
ethernet and a modem). You'll want that name associated with
both IP addresses. 

You will need to edit several things to suit your system.
Among them are DYNIF for whatever interface your modem comes
up on if ppp0 is wrong, DYNHOST/DYNDOMAIN if I didn't get
them right from one of your emails, get the CFILE entry
right when you're ready to go live with the script (I have
it set to test for - well - testing), and the static entries
for localhost and any ethernet cards you might have down
where it says to "Manually add...".

#!/bin/sh
#
# Create new /etc/hosts file with correct info on
dynamically assigned addresses.
#

# What interface do we want dynamic information for?
DYNIF=ppp0
DYNHOST=overlord
DYNDOMAIN=ravenhome.net

# File name we wish to update?
#CFILE=/etc/hosts
CFILE=test

# Get the current IP address for interface with dynamically
assigned address.
DYNIP=`/sbin/ifconfig $DYNIF | grep inet | cut -d : -f 2 |
cut -d \  -f 1`

# Create new file - first remove the old one.

rm -f $CFILE

# Manually add the static entries for localhost and static
IP addresses here.
echo '127.0.0.1         localhost.localdomain localhost' >>
$CFILE
echo '192.168.0.1               myhost.mydomain.local
myhost' >> $CFILE

# Now the dynamic interface entry.
echo $DYNIP'            '$DYNHOST'.'$DYNDOMAIN' '$DYNHOST >>
$CFILE


Although it is evil to attach potential executables to
emails I'm going to do so in this case because email clients
also tend to be evil when doing things with line wrap and
such. Be sure to give the file execute permissions and you
should be all set.

Hope this helps.


-- 
Mike Rambo
[EMAIL PROTECTED]
#!/bin/sh
#
# Create new /etc/hosts file with correct info on dynamically assigned addresses.
#

# What interface do we want dynamic information for?
DYNIF=eth0
DYNHOST=overlord
DYNDOMAIN=ravenhome.net

# File name we wish to update?
#CFILE=/etc/hosts
CFILE=test

# Get the current IP address for interface with dynamically assigned address.
DYNIP=`/sbin/ifconfig $DYNIF | grep inet | cut -d : -f 2 | cut -d \  -f 1`

# Create new file - first remove the old one.

rm -f $CFILE

# Manually add the static entries for localhost and static IP addresses here.
echo '127.0.0.1         localhost.localdomain localhost' >> $CFILE
echo '192.168.0.1               myhost.mydomain.local myhost' >> $CFILE

# Now the dynamic interface entry.
echo $DYNIP'            '$DYNHOST'.'$DYNDOMAIN' '$DYNHOST >> $CFILE

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to