-
having static hostnames in dhcp client
Hi,
I am running Solaris 10 and the network interface is on dhcp.
Everytime I get net IP from my dhcp server I also get new hostname,
Something which some of my scripts dont like. I was wondering if there
is any option to tell dhcp client that just get the IP address, and
use the specified hostname (may be in /etc/nodename) and ignore the
hostname given by dhcp server.
I am not authorized to chage the configuration on DHCP server to give
IP address and corresponding hostname based on MAC address, so that
ruled out. Also I looking for some 'clean' way of doing it, I can
always write a small script which will go in /etc/rc2.d and reset the
hostname, but thats not something I would prefer.
--Harshal
-
Re: having static hostnames in dhcp client
In <2c66651c-8194-44b2-8975-bd4bf0894293@s1g2000pra.googlegroups.com> Harshal writes:
> I am running Solaris 10 and the network interface is on dhcp.
>Everytime I get net IP from my dhcp server I also get new hostname,
>Something which some of my scripts dont like. I was wondering if there
>is any option to tell dhcp client that just get the IP address, and
>use the specified hostname (may be in /etc/nodename) and ignore the
>hostname given by dhcp server.
The proper way to do this is to have the DHCP server provide static IP
addresses. `D' does stand for `dynamic', but that doesn't mean that
IP addresses are random. In fact, the DHCP server is supposed to
provide the same IP address from a dynamic pool each time, if it's
still available.
>I am not authorized to chage the configuration on DHCP server to give
>IP address and corresponding hostname based on MAC address, so that
>ruled out. Also I looking for some 'clean' way of doing it, I can
>always write a small script which will go in /etc/rc2.d and reset the
>hostname, but thats not something I would prefer.
Can you request static IP addresses for your machines? You can set
the hostname regardless of the IP address, but that would also break
resolution of the hostname in DNS.
--
-Gary Mills- -Unix Support- -U of M Academic Computing and Networking-
-
Re: having static hostnames in dhcp client
On Sep 8, 6:35*pm, Gary Mills wrote:
> In <2c66651c-8194-44b2-8975-bd4bf0894...@s1g2000pra.googlegroups.com> Harshal writes:
>
> > * I am running Solaris 10 and the network interface is on dhcp.
> >Everytime I get net IP from my dhcp server I also get new hostname,
> >Something which some of my scripts dont like. I was wondering if there
> >is any option to tell dhcp client that just get the IP address, and
> >use the specified hostname (may be in /etc/nodename) and ignore the
> >hostname given by dhcp server.
>
> The proper way to do this is to have the DHCP server provide static IP
> addresses. *`D' does stand for `dynamic', but that doesn't mean that
> IP addresses are random. *In fact, the DHCP server is supposed to
> provide the same IP address from a dynamic pool each time, if it's
> still available.
>
> >I am not authorized to chage the configuration on DHCP server to give
> >IP address and corresponding hostname based on MAC address, so that
> >ruled out. Also I looking for some 'clean' way of doing it, I can
> >always write a small script which will go in /etc/rc2.d and reset the
> >hostname, but thats not something *I would prefer.
>
> Can you request static IP addresses for your machines? *You can set
> the hostname regardless of the IP address, but that would also break
> resolution of the hostname in DNS.
>
> --
> -Gary Mills- * *-Unix Support- * *-U of M Academic Computing and Networking-
I must have same hostname. All I want is ignore the hostname given by
DHCP and set it to whatever I want. I have no control over DHCP
server. Is there any way out?
-
Re: having static hostnames in dhcp client
Harshal wrote:
> On Sep 8, 6:35 pm, Gary Mills wrote:
>> In <2c66651c-8194-44b2-8975-bd4bf0894...@s1g2000pra.googlegroups.com> Harshal writes:
>>
>>> I am running Solaris 10 and the network interface is on dhcp.
>>> Everytime I get net IP from my dhcp server I also get new hostname,
>>> Something which some of my scripts dont like. I was wondering if there
>>> is any option to tell dhcp client that just get the IP address, and
>>> use the specified hostname (may be in /etc/nodename) and ignore the
>>> hostname given by dhcp server.
>> The proper way to do this is to have the DHCP server provide static IP
>> addresses. `D' does stand for `dynamic', but that doesn't mean that
>> IP addresses are random. In fact, the DHCP server is supposed to
>> provide the same IP address from a dynamic pool each time, if it's
>> still available.
>>
>>> I am not authorized to chage the configuration on DHCP server to give
>>> IP address and corresponding hostname based on MAC address, so that
>>> ruled out. Also I looking for some 'clean' way of doing it, I can
>>> always write a small script which will go in /etc/rc2.d and reset the
>>> hostname, but thats not something I would prefer.
>> Can you request static IP addresses for your machines? You can set
>> the hostname regardless of the IP address, but that would also break
>> resolution of the hostname in DNS.
>>
>> --
>> -Gary Mills- -Unix Support- -U of M Academic Computing and Networking-
>
> I must have same hostname. All I want is ignore the hostname given by
> DHCP and set it to whatever I want. I have no control over DHCP
> server. Is there any way out?
You could ask the administrator of the DHCP server to help you out. If
you give him a list of MAC addresses and the corresponding host names,
he should be able to configure DHCP to do the right thing. You might
even inquire as to the correct format so you can give him something he
can simply cut and paste.
-
Re: having static hostnames in dhcp client
On Sep 8, 8:18*pm, "Richard B. Gilbert"
wrote:
> Harshal wrote:
> > On Sep 8, 6:35 pm, Gary Mills wrote:
> >> In <2c66651c-8194-44b2-8975-bd4bf0894...@s1g2000pra.googlegroups.com> Harshal writes:
>
> >>> * I am running Solaris 10 and the network interface is on dhcp.
> >>> Everytime I get net IP from my dhcp server I also get new hostname,
> >>> Something which some of my scripts dont like. I was wondering if there
> >>> is any option to tell dhcp client that just get the IP address, and
> >>> use the specified hostname (may be in /etc/nodename) and ignore the
> >>> hostname given by dhcp server.
> >> The proper way to do this is to have the DHCP server provide static IP
> >> addresses. *`D' does stand for `dynamic', but that doesn't mean that
> >> IP addresses are random. *In fact, the DHCP server is supposed to
> >> provide the same IP address from a dynamic pool each time, if it's
> >> still available.
>
> >>> I am not authorized to chage the configuration on DHCP server to give
> >>> IP address and corresponding hostname based on MAC address, so that
> >>> ruled out. Also I looking for some 'clean' way of doing it, I can
> >>> always write a small script which will go in /etc/rc2.d and reset the
> >>> hostname, but thats not something *I would prefer.
> >> Can you request static IP addresses for your machines? *You can set
> >> the hostname regardless of the IP address, but that would also break
> >> resolution of the hostname in DNS.
>
> >> --
> >> -Gary Mills- * *-Unix Support- * *-U of M Academic Computing and Networking-
>
> > I must have same hostname. All I want is ignore the hostname given by
> > DHCP and set it to whatever I want. I have no control over DHCP
> > server. Is there any way out?
>
> You could ask the administrator of the DHCP server to help you out. *If
> you give him a list of MAC addresses and the corresponding host names,
> he should be able to configure DHCP to do the right thing. *You might
> even inquire as to the correct format so you can give him something he
> can simply cut and paste.
I would love to do that. But I am working on one Virtual Machine. This
VM will be migrated to many places (Many of them I don't even know). I
don't know in what network or even the physical location the end user
of that VM will be working. Hence as I said earlier, I have no control
what so ever on DHCP server.
-
Re: having static hostnames in dhcp client
Harshal wrote:
> I am running Solaris 10 and the network interface is on dhcp.
> Everytime I get net IP from my dhcp server I also get new hostname,
> Something which some of my scripts dont like. I was wondering if there
> is any option to tell dhcp client that just get the IP address, and
> use the specified hostname (may be in /etc/nodename) and ignore the
> hostname given by dhcp server.
man dhcpagent
vi /etc/default/dhcpagent
/PARAM_REQUEST_LIST
might help (I haven't tried it)
-
Re: having static hostnames in dhcp client
> ...
> I must have same hostname. All I want is ignore the hostname given by
> DHCP and set it to whatever I want. I have no control over DHCP
> server. Is there any way out?
Most DHCP clients have a config file that allows you the control
you need. For ICS it is /etc/dhclient.conf. I don't know which
DHCP client you have; check its man page.
-Wayne
-
Re: having static hostnames in dhcp client
On Sep 8, 8:24*pm, Oscar del Rio wrote:
> Harshal wrote:
> > * *I am running Solaris 10 and the network interface is on dhcp.
> > Everytime I get net IP from my dhcp server I also get new hostname,
> > Something which some of my scripts dont like. I was wondering if there
> > is any option to tell dhcp client that just get the IP address, and
> > use the specified hostname (may be in /etc/nodename) and ignore the
> > hostname given by dhcp server.
>
> man dhcpagent
> vi /etc/default/dhcpagent
> /PARAM_REQUEST_LIST
>
> might help (I haven't tried it)
Didn't help 
-
Re: having static hostnames in dhcp client
On Sep 8, 8:47*pm, Wayne wrote:
> > ...
> > I must have same hostname. All I want is ignore the hostname given by
> > DHCP and set it to whatever I want. I have no control over DHCP
> > server. Is there any way out?
>
> Most DHCP clients have a config file that allows you the control
> you need. *For ICS it is /etc/dhclient.conf. *I don't know which
> DHCP client you have; check its man page.
>
> -Wayne
This is precisely what I am looking for, in Linux you will get this /
etc/dhclient.conf whats the equivalent working stuff in solaris 10?
-
Re: having static hostnames in dhcp client
On Sep 8, 5:56*pm, Harshal wrote:
> On Sep 8, 8:47*pm, Wayne wrote:
>
> > > ...
> > > I must have same hostname. All I want is ignore the hostname given by
> > > DHCP and set it to whatever I want. I have no control over DHCP
> > > server. Is there any way out?
Hi,
do you know google.com? Simple search for dhcp +hostname +Solaris
gives you e.g.:
http://www.rite-group.com/rich/solaris_dhcp.html
where you can find for e.g. :
Unknown hostname
Actually, there's one snag: most (if not all) cable modem DHCP servers
don't provide you with a hostname (even if they did, odds are it won't
be one you want anyway!). This wouldn't be a problem, except that the
boot scripts (/etc/init.d/rootusr in particular) try to be clever, and
set your hostname to "unknown" in this case, which is not at all
useful!
The trick is to change your hostname back to the right one, preferably
without changing any of the supplied start-up scripts, which are
liable to be being stomped on when you upgrade or install a patch.
You've also got to do it early enough in the boot process, so that
rpcbind, sendmail and friends don't get confused by using the wrong
hostname. To solve this problem, put this little script in to /etc/
init.d/set_hostname, with a symbolic link to it from /etc/rc2.d/
S70set_hostname.
!!! Starting with Solaris 10, the preceding paragraph can be ignored.
Instead, just make sure that the hostname you want to use is in /etc/
nodename; the contents of !!! that file will then be used to set the
hostname. (Note that it is essential that the hostname you put into /
etc/nodename is terminated with a carriage return.
!!! Breakage will happen if this is not the case.) Also, from Solaris
8 it is possible to tell the DHCP software not to request a hostname
from the DHCP server. To do !!! this, remove the token 12 from the
PARAM_REQUEST_LIST line in /etc/default/dhcpagent. (/etc/default/
dhcpagent describes what the default tokens are; 12 is
!!! the hostname, 3 is the default router, 6 is the DNS server, and so
on.)
So.... first use your brain & fingers ... then ask. Always better is
to get knowledge your own... :)
Regards,
Blazej