Re: [CentOS-virt] Disable/stop nic in a virtual guest with virsh

2015-02-18 Thread SilverTip257
On Wed, Feb 18, 2015 at 3:10 AM, C. L. Martinez 
wrote:

> On Tue, Feb 17, 2015 at 1:43 PM, Sven Kieske  wrote:
> >
> >
> > On 17/02/15 09:18, C. L. Martinez wrote:
> >> Hi all,
> >>
> >> How can I stop/disable a nic in a virtual guest using a virsh
> >> command?? I am searching the same effect like if I unplug network
> >> cable ... Is it possible?? I have tried with "detach-interface"
> >> command without luck. I don't want to remove the nic from guest
> >> configuration, only to stop the nic ...
> >
> > Depending on your network architecture you could just ifdown
> > the vmnet, but this just works if you don't have multiple
> > vms on one vmnet (which you shouldn't).
> >
> > HTH
> >
> > --
>
> Ok, to do a ifdown of virtual bridge it seems the only option.
>
> Many thanks to all for your answers.
>

* Definitely look to Juerg Haefliger's solution.  It's exactly what you
want since you requested a method that can be done from the virsh
interface.  Thanks Juerg!

1) down the vnetX interface from the host node
  ip link show dev vnetX
  ip link set down vnetX
  ip link show dev vnetX

And if using bridged networking, you have one more option.
2) remove the vnetX interface from the bridge
  brctl delif  vnetX

Certainly downing the interface using either Juerg's solution via virsh or
mine via iproute2 tools is most ideal since it's easier/simpler to
reinstate.  You can use ifconfig if you prefer it over ip tools, but enjoy
those tools and syntax while it remains! [0]  ;-)

[0]
https://dougvitale.wordpress.com/2011/12/21/deprecated-linux-networking-commands-and-their-replacements/

-- 
---~~.~~---
Mike
//  SilverTip257  //
___
CentOS-virt mailing list
CentOS-virt@centos.org
http://lists.centos.org/mailman/listinfo/centos-virt


Re: [CentOS-virt] Disable/stop nic in a virtual guest with virsh

2015-02-18 Thread Juerg Haefliger
On Wed, Feb 18, 2015 at 9:10 AM, C. L. Martinez  wrote:
> On Tue, Feb 17, 2015 at 1:43 PM, Sven Kieske  wrote:
>>
>>
>> On 17/02/15 09:18, C. L. Martinez wrote:
>>> Hi all,
>>>
>>> How can I stop/disable a nic in a virtual guest using a virsh
>>> command?? I am searching the same effect like if I unplug network
>>> cable ... Is it possible?? I have tried with "detach-interface"
>>> command without luck. I don't want to remove the nic from guest
>>> configuration, only to stop the nic ...

There's a qemu monitor command for that. You can pass it in through virsh:

$ virsh qemu-monitor-command --hmp  'set_link  off'

Example:
# virsh list
 IdName   State

 3 dwarf-0039 running

# virsh qemu-monitor-command --hmp dwarf-0039 'info network'
net0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:a8:85:ea
 \ hostnet0: index=0,type=tap,fd=24

# virsh qemu-monitor-command --hmp dwarf-0039 'set_link net0 off'


...Juerg


>> Depending on your network architecture you could just ifdown
>> the vmnet, but this just works if you don't have multiple
>> vms on one vmnet (which you shouldn't).
>>
>> HTH
>>
>> --
>
> Ok, to do a ifdown of virtual bridge it seems the only option.
>
> Many thanks to all for your answers.
> ___
> CentOS-virt mailing list
> CentOS-virt@centos.org
> http://lists.centos.org/mailman/listinfo/centos-virt
___
CentOS-virt mailing list
CentOS-virt@centos.org
http://lists.centos.org/mailman/listinfo/centos-virt


Re: [CentOS-virt] Disable/stop nic in a virtual guest with virsh

2015-02-18 Thread C. L. Martinez
On Tue, Feb 17, 2015 at 1:43 PM, Sven Kieske  wrote:
>
>
> On 17/02/15 09:18, C. L. Martinez wrote:
>> Hi all,
>>
>> How can I stop/disable a nic in a virtual guest using a virsh
>> command?? I am searching the same effect like if I unplug network
>> cable ... Is it possible?? I have tried with "detach-interface"
>> command without luck. I don't want to remove the nic from guest
>> configuration, only to stop the nic ...
>
> Depending on your network architecture you could just ifdown
> the vmnet, but this just works if you don't have multiple
> vms on one vmnet (which you shouldn't).
>
> HTH
>
> --

Ok, to do a ifdown of virtual bridge it seems the only option.

Many thanks to all for your answers.
___
CentOS-virt mailing list
CentOS-virt@centos.org
http://lists.centos.org/mailman/listinfo/centos-virt


Re: [CentOS-virt] Disable/stop nic in a virtual guest with virsh

2015-02-17 Thread Sven Kieske


On 17/02/15 09:18, C. L. Martinez wrote:
> Hi all,
> 
> How can I stop/disable a nic in a virtual guest using a virsh
> command?? I am searching the same effect like if I unplug network
> cable ... Is it possible?? I have tried with "detach-interface"
> command without luck. I don't want to remove the nic from guest
> configuration, only to stop the nic ...

Depending on your network architecture you could just ifdown
the vmnet, but this just works if you don't have multiple
vms on one vmnet (which you shouldn't).

HTH

-- 
Mit freundlichen Grüßen / Regards

Sven Kieske

Systemadministrator
Mittwald CM Service GmbH & Co. KG
Königsberger Straße 6
32339 Espelkamp
T: +49-5772-293-100
F: +49-5772-293-333
https://www.mittwald.de
Geschäftsführer: Robert Meyer
St.Nr.: 331/5721/1033, USt-IdNr.: DE814773217, HRA 6640, AG Bad Oeynhausen
Komplementärin: Robert Meyer Verwaltungs GmbH, HRB 13260, AG Bad Oeynhausen
___
CentOS-virt mailing list
CentOS-virt@centos.org
http://lists.centos.org/mailman/listinfo/centos-virt


Re: [CentOS-virt] Disable/stop nic in a virtual guest with virsh

2015-02-17 Thread Nux!
I don't think it can be done. I would try to remove the VM's vnet from the 
bridge it's connected to.

HTH
Lucian

--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro

- Original Message -
> From: "C. L. Martinez" 
> To: centos-virt@centos.org
> Sent: Tuesday, 17 February, 2015 08:18:56
> Subject: [CentOS-virt] Disable/stop nic in a virtual guest with virsh

> Hi all,
> 
> How can I stop/disable a nic in a virtual guest using a virsh
> command?? I am searching the same effect like if I unplug network
> cable ... Is it possible?? I have tried with "detach-interface"
> command without luck. I don't want to remove the nic from guest
> configuration, only to stop the nic ...
> 
> Thanks.
> 
> P.D: Host is CentOS 6.6 x86_64 fully patched.
> ___
> CentOS-virt mailing list
> CentOS-virt@centos.org
> http://lists.centos.org/mailman/listinfo/centos-virt
___
CentOS-virt mailing list
CentOS-virt@centos.org
http://lists.centos.org/mailman/listinfo/centos-virt


[CentOS-virt] Disable/stop nic in a virtual guest with virsh

2015-02-17 Thread C. L. Martinez
Hi all,

How can I stop/disable a nic in a virtual guest using a virsh
command?? I am searching the same effect like if I unplug network
cable ... Is it possible?? I have tried with "detach-interface"
command without luck. I don't want to remove the nic from guest
configuration, only to stop the nic ...

Thanks.

P.D: Host is CentOS 6.6 x86_64 fully patched.
___
CentOS-virt mailing list
CentOS-virt@centos.org
http://lists.centos.org/mailman/listinfo/centos-virt