virInterfacePtr iface; iface = virInterfaceLookupByName("eth2"); if (!iface) { printf("Interface eth2 not found.\n"); } else { if (virInterfaceDestroy(iface) != 0) { fprintf(stderr, "failed to destroy (deactivate) interface eth2.\n"); } else /* do whatever you wanted to do with interface down */ if (virInterfaceCreate(iface) != 0) { fprintf(stderr, "failed to create (activate) interface eth2.\n"); } } free(iface); }