Libvirtd networks -- 为libvirtd 中虚拟机指定ip遇到的问题
backgroup
- 为libvirtd 中虚拟机指定ip,操作如下:
virsh --connect qemu:///system dumpxml vm01 | grep "mac address"
virsh --connect qemu:///system net-list
virsh --connect qemu:///system net-edit default
# 增加行 " <host mac='52:54:00:de:fd:d3' name='vm01' ip='192.168.x.x'/>"
# 保存退出
virsh --connect qemu:///system net-destroy default
virsh --connect qemu:///system net-start default
- 操作之后,
brctl show查看,看到网桥上的网卡信息丢失,包括绑定的物理网卡和虚拟网卡,我的解决办法如下:
- 重新重新绑定,操作如下:
brctl addif virbr0 xxx
brctl addif virbr0 xxx
brctl addif virbr0 xxx
附:在 man virsh 中可以看到 virsh 提供了及其丰富的命令,以下是其中虚拟网络相关的命令:
net-autostart network [--disable]
Configure a virtual network to be automatically started at boot. The --disable option disable autostarting.
net-create file
Create a transient (temporary) virtual network from an XML file and instantiate (start) the network. See the documentation
at <https://libvirt.org/formatnetwork.html> to get a description of the XML network format used by libvirt.
net-define file
Define an inactive persistent virtual network or modify an existing persistent one from the XML file.
net-destroy network
Destroy (stop) a given transient or persistent virtual network specified by its name or UUID. This takes effect immediately.
net-dumpxml network [--inactive]
Output the virtual network information as an XML dump to stdout. If --inactive is specified, then physical functions are not expanded into their associated virtual functions.
net-edit network
Edit the XML configuration file for a network.
This is equivalent to:
virsh net-dumpxml --inactive network > network.xml
vi network.xml (or make changes with your other text editor)
virsh net-define network.xml
except that it does some error checking.
The editor used can be supplied by the $VISUAL or $EDITOR environment variables, and defaults to "vi".
net-event {[network] event [--loop] [--timeout seconds] [--timestamp] | --list}
Wait for a class of network events to occur, and print appropriate details of events as they happen. The events can
optionally be filtered by network. Using --list as the only argument will provide a list of possible event values known by
this client, although the connection might not allow registering for all these events.
By default, this command is one-shot, and returns success once an event occurs; you can send SIGINT (usually via "Ctrl-C") to
quit immediately. If --timeout is specified, the command gives up waiting for events after seconds have elapsed. With
--loop, the command prints all events until a timeout or interrupt key.
When --timestamp is used, a human-readable timestamp will be printed before the event.
net-info network
Returns basic information about the network object.
net-list [--inactive | --all] { [--table] | --name | --uuid } [--persistent] [<--transient>] [--autostart] [<--no-autostart>]
Returns the list of active networks, if --all is specified this will also include defined but inactive networks, if
--inactive is specified only the inactive ones will be listed. You may also want to filter the returned networks by
--persistent to list the persistent ones, --transient to list the transient ones, --autostart to list the ones with autostart
enabled, and --no-autostart to list the ones with autostart disabled.
If --name is specified, network names are printed instead of the table formatted one per line. If --uuid is specified
network's UUID's are printed instead of names. Flag --table specifies that the legacy table-formatted output should be used.
This is the default. All of these are mutually exclusive.
NOTE: When talking to older servers, this command is forced to use a series of API calls with an inherent race, where a pool
might not be listed or might appear more than once if it changed state between calls while the list was being collected.
Newer servers do not have this problem.
net-name network-UUID
Convert a network UUID to network name.
net-update network command section xml [--parent-index index] [[--live] [--config] | [--current]]
Update the given section of an existing network definition, with the changes optionally taking effect immediately, without
needing to destroy and re-start the network.
command is one of "add-first", "add-last", "add" (a synonym for add-last), "delete", or "modify".
section is one of "bridge", "domain", "ip", "ip-dhcp-host", "ip-dhcp-range", "forward", "forward-interface", "forward-pf",
"portgroup", "dns-host", "dns-txt", or "dns-srv", each section being named by a concatenation of the xml element hierarchy
leading to the element being changed. For example, "ip-dhcp-host" will change a <host> element that is contained inside a
<dhcp> element inside an <ip> element of the network.
xml is either the text of a complete xml element of the type being changed (e.g. "<host mac="00:11:22:33:44:55'
ip='1.2.3.4'/>", or the name of a file that contains a complete xml element. Disambiguation is done by looking at the first
character of the provided text - if the first character is "<", it is xml text, if the first character is not "<", it is the
name of a file that contains the xml text to be used.
The --parent-index option is used to specify which of several parent elements the requested element is in (0-based). For
example, a dhcp <host> element could be in any one of multiple <ip> elements in the network; if a parent-index isn't
provided, the "most appropriate" <ip> element will be selected (usually the only one that already has a <dhcp> element), but
if --parent-index is given, that particular instance of <ip> will get the modification.
If --live is specified, affect a running network. If --config is specified, affect the next startup of a persistent network.
If --current is specified, affect the current network state. Both --live and --config flags may be given, but --current is
exclusive. Not specifying any flag is the same as specifying --current.
net-dhcp-leases network [mac]
Get a list of dhcp leases for all network interfaces connected to the given virtual network or limited output just for one
interface if mac is specified.
Libvirtd networks -- 为libvirtd 中虚拟机指定ip遇到的问题的更多相关文章
- Mysql中设置指定IP的特定用户及特定权限
创建用户:格式:grant select on 数据库.* to 用户名@登录主机 identified by '密码' 举例: 例 1:增加一个用户 test1 密码为 abc,让他可以在任何主机上 ...
- 完整部署CentOS7.2+OpenStack+kvm 云平台环境(3)--为虚拟机指定固定ip
之前在测试环境(centos7.2)上部署了openstack云平台(完整部署CentOS7.2+OpenStack+kvm 云平台环境(1)--基础环境搭建),openstack在neutron组网 ...
- QEMU-KVM自己主动创建虚拟机,以指定IP构造
正在使用qemu不能指定创建虚拟机的过程IP住址,然而,在实际应用中,我们需要有一台虚拟机IP住址,不是人为的虚拟机操作系统配置. 于qemu虚拟机技术文档(http://qemu.weilnetz. ...
- 获取局域网中指定IP或是主机名称的所有文件夹及其搜索文件
最近做个功能在局域网中所有指定文件,于是花了点精力完成了部分功能,先贴上 using System; using System.Collections.Generic; using System.Co ...
- c#中HttpWebRequest使用Proxy实现指定IP的域名请求
原文:http://www.cnblogs.com/greenerycn/archive/2010/04/11/httpwebreques_host_modify_By_set_proxy.html ...
- Linux 下获取LAN中指定IP的网卡的MAC(物理地址)
// all.h// 2005/06/20,a.m. wenxy #ifndef _ALL_H#define _ALL_H #include <memory.h>#include < ...
- 复制虚拟机vmware centos搭建集群节点过程中网络配置eth0和eth1遇到的问题以及NAT模式下虚拟机静态IP配置方法
在centos中安装完第一个虚拟机后,一般习惯通过克隆的方式创建其它虚拟机,开后vmware无法发现网卡信息,系统认为这是重新安装,所以重新创建了一个新的网卡叫eth1. 并且用IFCONFIG-a查 ...
- pycharm中指定ip和端口
pycharm中指定ip和端口 环境: 系统:win7 本机ip:192.168.0.100 1.建立工程请参照:https://www.cnblogs.com/effortsing/p/103945 ...
- vbox虚拟机复制&&虚拟机指定静态IP
一.复制镜像(假设源镜像已经用桥接方式,可以访问互联网). 注意需要重新生成mac地址 二.复制完成,启动复制好的镜像(注意,此时的镜像无法联网) vi /etc/udev/rules.d/70-pe ...
- Hyper-V 中设置虚拟机静态 IP
一.新建虚拟网络交换机 二.配置网络 网络共享默认使用 192.168.137.0/255 作为内网地址,192.168.137.1 作为网关 三.配置虚拟机静态 IP 安装完成虚拟机后修改配置文件: ...
随机推荐
- KMP算法学习笔记
总算把这个东西搞懂了...... KMP是一个求解字符串匹配问题的算法. 这个东西的核心是一个\(next\)数组,\(next_i\)表示字符串第\(0\sim i\)项的相同的前缀和后缀的最大长度 ...
- 第十四届蓝桥杯省赛C++ B组(个人经历 + 题解)
参赛感受 这是我第一次参加蓝桥杯的省赛,虽然没什么参赛经验,但是自己做了很多前几届蓝桥杯的题,不得不说,这一届蓝桥杯省赛的难度相较于之前而言还是比较大的.之前很流行蓝桥杯就是暴力杯的说法,但是随着参赛 ...
- 【Python基础】字典的基本使用
字典是由一系列键值对组成的无序集合.每个键值对包含一个键和一个对应的值.键必须是不可变的,如字符串.数字或元组.值可以是任意类型的对象.字典可以使用花括号({})或者内置函数dict()来创建. di ...
- 民谣女神唱流行,基于AI人工智能so-vits库训练自己的音色模型(叶蓓/Python3.10)
流行天后孙燕姿的音色固然是极好的,但是目前全网都是她的声音复刻,听多了难免会有些审美疲劳,在网络上检索了一圈,还没有发现民谣歌手的音色模型,人就是这样,得不到的永远在骚动,本次我们自己构建训练集,来打 ...
- 文心一言 VS chatgpt (9)-- 算法导论2.3 7题 3.1 1题
七.描述一个运行时间为O(nlgn)的算法,给定n个整数的集合S和另一个整数,该算法能确定 S中是否存在两个其和刚好为工的元素. 文心一言: 这里是一个运行时间为O(nlgn)的算法,可以用来确定集合 ...
- Django4全栈进阶之路20 项目实战(在线报修):项目需求分析
为了实现一个在线报修系统,您可以按照以下步骤进行: 创建Django项目和应用 使用Django的命令行工具创建一个Django项目,并在该项目中创建一个名为"RepairApp" ...
- 1451, 'Cannot delete or update a parent row: a foreign key constraint fails
问题描述:1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`sysProDB4`.`IM003 ...
- TypeError: Cannot read property ‘make‘ of undefined
这搞个html-webpack-plugin插件进来运行就一大篇报错尴尬 看了一圈又是版本兼容的问题,做下修改.... OK 运行成功
- WPF 自定义控件 二次渲染 问题记录
问题 将多个自定义控件加载到到一个页面的Grid上显示.然后突然将一个控件从Grid里面清除,控件依然在后台处理数据. 过段时间再加入Grid.然后一些已经改变的页面属性就消失了. 原因 经过查找是一 ...
- SpringBoot定义优雅全局统一Restful API 响应框架五
闲话不多说,继续优化 全局统一Restful API 响应框架 做到项目通用 接口可扩展. 如果没有看前面几篇文章请先看前面几篇 SpringBoot定义优雅全局统一Restful API 响应框架 ...