[libvirt-users] How to disable dnsmasq from starting automatically with libvirtd

Osier Yang jyang at redhat.com
Thu Sep 13 08:14:30 UTC 2012


On 2012年09月13日 16:04, Marwan Tanager wrote:
> On Thu, Sep 13, 2012 at 03:54:30PM +0800, Osier Yang wrote:
>> On 2012年09月13日 15:50, Marwan Tanager wrote:
>>> On Thu, Sep 13, 2012 at 03:17:14PM +0800, Osier Yang wrote:
>>>> On 2012年09月13日 14:55, Marwan Tanager wrote:
>>>>> On Thu, Sep 13, 2012 at 01:04:58PM +0800, Osier Yang wrote:
>>>>>> On 2012年09月13日 11:23, Marwan Tanager wrote:
>>>>>>
>>>>>> No, to disable the autostarting of dnsmasq, you need to disable the
>>>>>> autostart of network which drives dnsmasq (named 'default' by default).
>>>>>>
>>>>>> % virsh net-autostart --disable default
>>>>>>
>>>>>> Then it won't be started automatically along with libvirtd service next
>>>>>> time.
>>>>>
>>>>> Thanks for the response, but my question was whether it's possible to start
>>>>> libvirtd (and hence, activate the virtual networks "automatically") on boot, but
>>>>> without dnsmasq being started along the way. Your answer means that to disable
>>>>> dnsmasq from starting automatically, I need to disable the network form starting
>>>>> automatically too.
>>>>>
>>>>> Anyway, I destroyed the 'default' network, then killed the dnsmasq process for
>>>>> that network, but when I started it again, dnsmasq started along with it. So, it
>>>>> appears that the whole thing is hard coded.
>>>>
>>>> No, it depends on your previous network status, note that libvirt
>>>> saves the object's state, so that things could be consistent before
>>>> restarting/reloading.
>>>>
>>>> # virsh net-list --all
>>>> Name                 State      Autostart
>>>> -----------------------------------------
>>>> default              active     no
>>>>
>>>> # service libvirtd restart
>>>> Restarting libvirtd (via systemctl):                       [  OK  ]
>>>>
>>>> # virsh net-list --all
>>>> Name                 State      Autostart
>>>> -----------------------------------------
>>>> default              active     no
>>>>
>>>> # pidof libvirtd
>>>> 6868
>>>> # pidof dnsmasq
>>>> 6826
>>>>
>>>>
>>>> # virsh net-destroy default
>>>> Network default destroyed
>>>>
>>>> # service libvirtd restart
>>>> Restarting libvirtd (via systemctl):                       [  OK  ]
>>>>
>>>> # virsh net-list --all
>>>> Name                 State      Autostart
>>>> -----------------------------------------
>>>> default              inactive   no
>>>>
>>>> # ps -ef | grep dnsmasq
>>>> root      6762 20112  0 15:07 pts/1    00:00:00 grep --color=auto dnsmasq
>>>> # pidof libvirtd
>>>> 6689
>>>>
>>>> Does this make sense to you? :-)
>>>>
>>>> Regards,
>>>> Osier
>>>
>>> It does, but it's a different story. You should have tried two more commands
>>> after the last one:
>>>
>>> # virsh net-start default
>>> # ps -ef | grep dnsmasq
>>>
>>> then, you would have found the grepping positive. That's what I'am actually
>>> talking about :)
>>>
>>
>> <...>
>> Thanks for the response, but my question was whether it's possible to start
>> libvirtd (and hence, activate the virtual networks "automatically")
>> on boot, but
>> without dnsmasq being started along the way.
>> </...>
>>
>> As far as I understand from this, you just want the network not started
>> along with libvirtd. Why do you want to start it again by "net-start"
>> when it's already not started along with libvirtd? :-)
>
> I want the network to start automatically with libvirtd but "without" dnsmasq. I
> haven't say anything about starting it with net-start. I've just put those two
> commands to show you that merely starting the netwrok "causes" dnsmasq to start
> too, hence I had talked about the thing being hardcoded.
>

Okay, finally I understood, that's because the default network use
"nat" forward mode, and dnsmasq is the only one supported DHCP
server libvirt supports for DHCPv4.

If you want to use the default NAT network, but to use your own
DHCP server instead of dnsmasq, patches/RFC/ideas are welcomed
(libvir-list at redhat.com).

If you want to use network in mode other than NAT. You won't have
to suffer from the dnsmasq. For the network XML format:

http://libvirt.org/formatnetwork.html

Regards,
Osier




More information about the libvirt-users mailing list