标签:kvm网络
系统centos7net-autostart 自动开始网络
net-create 从一个 XML 文件创建一个网络
net-define 定义一个永久网络或修改一个xml文件中定义的持久网络
net-destroy 销毁(停止)网络
net-dhcp-leases 打印给定网络的租赁信息
net-dumpxml XML 中的网络信息
net-edit 为网络编辑 XML 配置
net-event Network Events
net-info 网络信息
net-list 列出网络
net-name 把一个网络UUID 转换为网络名
net-start 开始一个(以前定义的)不活跃的网络
net-undefine 取消(删除)定义一个永久网络
net-update 更新现有网络配置的部分
net-uuid 把一个网络名转换为网络UUID
#通过XML文件创建my_bro
cd /etc/libvirt/qemu/networks/
#用default.xml生成my_bro.xml
cp default.xml my_bro.xml
#删除了uuid,mac address,修改了forward mode、bridge name、ip address、range start
<network>
<name>my_bro</name>
<forward mode=‘route‘/>
<bridge name=‘virbr1‘ stp=‘on‘ delay=‘0‘/>
<ip address=‘192.168.110.1‘ netmask=‘255.255.255.0‘>
<dhcp>
<range start=‘192.168.110.2‘ end=‘192.168.110.254‘/>
</dhcp>
</ip>
</network>
<network>
<name>default</name>
<uuid>b4f7d394-6b54-4ef1-ad9c-cf63f458dd63</uuid>
<forward mode=‘nat‘/>
<bridge name=‘virbr0‘ stp=‘on‘ delay=‘0‘/>
<mac address=‘52:54:00:a9:8a:a6‘/>
<ip address=‘192.168.123.1‘ netmask=‘255.255.255.0‘>
<dhcp>
<range start=‘192.168.123.2‘ end=‘192.168.123.254‘/>
</dhcp>
</ip>
</network>
virsh net-define my_bro.xml
virsh net-create my_bro.xml
virsh net-list --all
virsh net-start my_bro
virsh net-autostart my_bro
virsh net-list --all
net-autostart default --disable
virsh net-destroy default
virsh net-list --all
virsh net-undefine default
virsh edit test1
<interface type=‘network‘>
<mac address=‘52:54:00:3c:f2:fd‘/>
<source network=‘default‘/>
<model type=‘virtio‘/>
<address type=‘pci‘ domain=‘0x0000‘ bus=‘0x00‘ slot=‘0x03‘ function=‘0x0‘/>
</interface>
<interface type=‘network‘>
<source network=‘my_bro‘/>
<model type=‘virtio‘/>
<address type=‘pci‘ domain=‘0x0000‘ bus=‘0x00‘ slot=‘0x03‘ function=‘0x0‘/>
</interface>
virsh shutdown test1
virsh start test1
virsh reboot test1
#修改IP地址和网关
firewall-cmd --zone=internal --change-interface=ens33 --permanent
firewall-cmd --zone=internal --change-interface=virbr1 --permanent
firewall-cmd --permanent --zone=internal --add-masquerade
firewall-cmd --reload
firewall-cmd --query-masquerade --zone=internal
firewall-cmd --add-forward-port=port=8022:proto=tcp:toport=22:toaddr=192.168.110.145 --permanent --zone=internal
firewall-cmd --reload
firewall-cmd --list-all --zone=internal
标签:kvm网络
原文地址:http://blog.51cto.com/13323775/2087324