# Using ip address for chef\_server\_url on /etc/chef/client.rb

**URL:** <https://discourse.chef.io/t/using-ip-address-for-chef-server-url-on-etc-chef-client-rb/5081>\
**Category:** Chef Infra (archive)\
**Created:** [February 28, 2014, 7:30pm UTC](https://discourse.chef.io/t/using-ip-address-for-chef-server-url-on-etc-chef-client-rb/5081 "2014-02-28T19:30:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Santhosh](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@Santhosh](https://discourse.chef.io/u/Santhosh)\
**Post date:** [February 28, 2014, 7:30pm UTC](https://discourse.chef.io/t/using-ip-address-for-chef-server-url-on-etc-chef-client-rb/5081/1 "2014-02-28T19:30:25Z")

</div>

Hi, Using a hostname in etc/chef/client.rb for chef\_server\_url is not an  
option for me, Hence I’m forced to use a ip address for my chef server.  
Firstly , is this even allowed.?

Second, at some point the chef-client tries to reverse lookup the ip  
address and tries to find the hostname(The DNS will return NXDOMAIN) and  
is not working.

Can someone help me out.?

Santhosh

---

<div class="post-metadata">

**Author:** ![Anna\_Redding](https://avatars.discourse-cdn.com/v4/letter/a/f17d59/32.png) [@Anna\_Redding](https://discourse.chef.io/u/Anna_Redding)\
**Post date:** [February 28, 2014, 7:53pm UTC](https://discourse.chef.io/t/using-ip-address-for-chef-server-url-on-etc-chef-client-rb/5081/2 "2014-02-28T19:53:21Z")

</div>

Santhosh,

I just encounters this very thing.  
Here is what I have done and it works:

In the client.rb file, I reference the chef server with the value "https://

I am using 'knife vsphere vm clone' to create my VMs.

In the VM template that I am cloning, I have added the Chef Server hostname and IPaddr to the /etc/hosts file.

When the clone is created and the bootstrap (passed as option to knife vsphere) initiated, it is

- successfully resolving and connecting to the chef server,
- creating the node,
- kicking off the cookbook (passed using the runlist option to knife vsphere)

Hope that helps

Anna

Sent from my iPhone

On Feb 28, 2014, at 1:30 PM, Santhosh [santhoshsusbs@gmail.com](mailto:santhoshsusbs@gmail.com) wrote:

> Hi, Using a hostname in etc/chef/client.rb for chef\_server\_url is not an option for me, Hence I'm forced to use a ip address for my chef server. Firstly , is this even allowed.?
> 
> Second, at some point the chef-client tries to reverse lookup the ip address and tries to find the hostname(The DNS will return NXDOMAIN) and is not working.
> 
> Can someone help me out.?
> 
> Santhosh

---

<div class="post-metadata">

**Author:** ![Santhosh](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@Santhosh](https://discourse.chef.io/u/Santhosh)\
**Post date:** [March 3, 2014, 11:37am UTC](https://discourse.chef.io/t/using-ip-address-for-chef-server-url-on-etc-chef-client-rb/5081/3 "2014-03-03T11:37:04Z")

</div>

Anna, I'm glad it worked for you, but no luck here. Had to look at the  
chef code for a couple of hours and I've found the fix , finally

\*misconceptions:

- \*there is no reverse dns lookup's that chef-client is doing.

\*workflow:  
\*\* when we run chef-server reconfigure for the first time , it  
configures(server\_name) and identifies as what is given by the hostname  
(if given)

- So, I just told the chef-server (using /etc/chef-server/chef-server.rb  
to use server\_name as my public ip) and ran reconfigure again.
- Magic!

\*Few more questions:  
\*\* what are the ramifications of running a chef-server reconfigure after  
we have setup a bunch of nodes. Do i have to edit/modify any of my nodes.?

Regards  
Santhosh  
On 3/1/2014 1:23 AM, Anna Redding wrote:

> Santhosh,
> 
> I just encounters this very thing.  
> Here is what I have done and it works:
> 
> In the client.rb file, I reference the chef server with the value "https://
> 
> I am using 'knife vsphere vm clone' to create my VMs.
> 
> In the VM template that I am cloning, I have added the Chef Server hostname and IPaddr to the /etc/hosts file.
> 
> When the clone is created and the bootstrap (passed as option to knife vsphere) initiated, it is  
> - successfully resolving and connecting to the chef server,  
> - creating the node,  
> - kicking off the cookbook (passed using the runlist option to knife vsphere)
> 
> Hope that helps
> 
> Anna
> 
> Sent from my iPhone
> 
> On Feb 28, 2014, at 1:30 PM, Santhosh [santhoshsusbs@gmail.com](mailto:santhoshsusbs@gmail.com) wrote:
> 
> > Hi, Using a hostname in etc/chef/client.rb for chef\_server\_url is not an option for me, Hence I'm forced to use a ip address for my chef server. Firstly , is this even allowed.?
> > 
> > Second, at some point the chef-client tries to reverse lookup the ip address and tries to find the hostname(The DNS will return NXDOMAIN) and is not working.
> > 
> > Can someone help me out.?
> > 
> > Santhosh
