Bug 702112 - When using NAT networking guest hostname not set to FQDN
Summary: When using NAT networking guest hostname not set to FQDN
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Osier Yang
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-05-04 19:22 UTC by Alexander Todorov
Modified: 2011-06-20 18:55 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 702726 (view as bug list)
Environment:
Last Closed: 2011-06-20 18:55:40 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Alexander Todorov 2011-05-04 19:22:09 UTC
Description of problem:
I'm using NAT networking for my virtual guests (KVM). In the XML file I have defined the example.com domain and a host which will be assigned static IP address and predefined hostname. The config looks like this:

<network>
  <name>default</name>
  <uuid>432d8cf4-16a3-4ff1-af5d-02f115fbc516</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <domain name='example.com'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.200' end='192.168.122.254' />
      <host mac='52:54:00:bf:ae:e2' name='tester1.example.com' ip='192.168.122.12' />
      <bootp file='pxelinux.0' server='192.168.122.11' />
    </dhcp>
  </ip>
</network>


When I create new guest and run the anaconda installer by default it uses DHCP and tries to guess the machine hostname automatically. The result is that IP address is assigned correctly but hostname is not. The `hostname' command reports "tester1" instead of "tester1.example.com"

Version-Release number of selected component (if applicable):
libvirt-0.8.1-27.el6_0.5.x86_64
dnsmasq-2.48-4.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. Cofigure NAT networking using the domain and host tags
2. Assign FQDN for your guest system
3. Install the guest using anaconda with all the default options. Specify the correct MAC address for the network interface1

  
Actual results:
hostname command doesn't report the FQDN. 

Expected results:
hostname reports FQDN.

Additional info:

The side effect of this is that various other tools that rely on the FQDN being setup properly fail. 


dnsmasq is started with this command line:

/usr/sbin/dnsmasq --strict-order --bind-interfaces --domain example.com --pid-file=/var/run/libvirt/network/default.pid --conf-file=  --listen-address 192.168.122.1 --except-interface lo --dhcp-range 192.168.122.200,192.168.122.254 --dhcp-lease-max=55 --dhcp-no-override --dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile --dhcp-boot pxelinux.0,,192.168.122.11


The default.hostsfile looks like:
52:54:00:bf:ae:e2,192.168.122.12,tester1.example.com

Comment 1 Osier Yang 2011-06-01 12:33:33 UTC
Hi, Alexander,

What's your guest os, I can't reproduce this problem on my rhel6 box, with a rhel6.1 client guest. I'm doubting command "hostname" in your guest os doesn't
report the whole hostname, could you check it?

# cat /etc/sysconfig/network

# hostname -d

If it's really "tester1", without domain name, then the problem is complicated I guess, relates to guest os.

Comment 2 Alexander Todorov 2011-06-01 13:49:49 UTC
I've tried with 5.6 and 6.0 guests IIRC. will have to re-test with 6.1.

Comment 3 dyuan 2011-06-15 09:04:07 UTC
Cann't reproduce this bug with rhel6.1 guest.
1. define the network with the same configure in bug description
2. Install the guest using anaconda with all the default options. Specify the same MAC address during installation as the mac defined in virtual network
3. get the hostname: tester1.example.com during installation via anaconda
4. re-check the hostname after reboot the guest, get the 
# hostname
tester1.example.com

pkgs:
libvirt-0.8.7-18.el6.x86_64
dnsmasq-2.48-4.el6.x86_64
qemu-kvm-0.12.1.2-2.160.el6.x86_64
guest os: http://download.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.1/Server/x86_64/os/

Comment 5 Dave Allan 2011-06-15 15:00:40 UTC
Alexander, I'm pretty sure this is the case, but just to make sure we've considered the possibility, you have confirmed that this works correctly on bare-metal, right?

Comment 6 Alexander Todorov 2011-06-17 17:17:06 UTC
Hi all,
I've tested with a RHEL 6.1 GA guest and the issue still persists. The host is RHEL 6.0 + some updates.

Comment 7 Dave Allan 2011-06-20 18:55:40 UTC
Alexander, this functionality works for both QE and my team, so I really have to close this as works for me.  I don't doubt that your machine is experiencing this behavior, so please reopen if you can reproduce it on a 6.1 host.


Note You need to log in before you can comment on or make changes to this bug.