<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Here's how I do it..</p>
<p>I have a VM host and a bunch of VM guests on it. Most of those
guest VMS are in the same vlan as the host, which works fine with
bridge. Some are in tagged vlans, but you didn't ask about that.</p>
<p>from the guest perspective, here's an example from the .xml</p>
<p> <interface type='network'><br>
<mac address='52:54:00:b0:98:0b'/><br>
<source network='<font color="#ff0000">default</font>'/><br>
<model type='rtl8139'/><br>
<address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/><br>
</interface><br>
</p>
<p>host: <br>
</p>
<p>[root@vm2 qemu]# cat networks/<font color="#ff0000">default</font>.xml
<br>
<!--<br>
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY
TO BE<br>
OVERWRITTEN AND LOST. Changes to this xml configuration should be
made using:<br>
virsh net-edit default<br>
or other application using the libvirt API.<br>
--><br>
</p>
<p>/etc/libvirt/qemu/networks/default.xml:<br>
<network><br>
<name>default</name><br>
<uuid>57f11311-c17e-4550-8450-bea1c69d36cc</uuid><br>
<forward mode='bridge'/><br>
<bridge name='br0'/><br>
</network><br>
</p>
<p>host (centos) /etc/sysconfig/network-scripts/ifcfg-br0: (note br0
uses em0 on the hardware exclusively)<br>
DEVICE="br0"<br>
NAME="br0"<br>
ONBOOT="yes"<br>
BOOTPROTO="none"<br>
HWADDR=c8:1f:66:e3:de:58<br>
IPADDR=10.0.2.36<br>
NETMASK=255.255.255.0<br>
DEFROUTE="yes"<br>
GATEWAY=10.0.2.1<br>
TYPE="bridge"</p>
<p># virsh<br>
virsh # net-list<br>
Name State Autostart Persistent<br>
----------------------------------------------------------<br>
default active yes yes<br>
<br>
virsh # net-info default<br>
Name: default<br>
UUID: 57f11311-c17e-4550-8450-bea1c69d36cc<br>
Active: yes<br>
Persistent: yes<br>
Autostart: yes<br>
Bridge: br0<br>
<br>
<br>
</p>
<p>a guest (centos) /etc/sysconfig/network-scripts/ifcfg-eth0:</p>
<p>TYPE=Ethernet<br>
BOOTPROTO=static<br>
HWADDR=52:54:00:6f:<a class="moz-txt-link-freetext" href="f7:85">f7:85</a><br>
USERCTL=no<br>
IPADDR=10.0.2.27<br>
NETMASK=255.255.255.0<br>
GATEWAY=10.0.2.1<br>
DEFROUTE=yes<br>
IPV4_FAILURE_FATAL=no<br>
IPV6INIT=no<br>
NAME=eth0<br>
DEVICE=eth0<br>
ONBOOT=yes<br>
DNS1=8.8.8.8<br>
DNS2=8.8.4.4<br>
DOMAIN=foo.bar<br>
UUID=8c4d5363-3bea-409f-8965-f2db432a6853<br>
<br>
</p>
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 12/6/2017 11:57 PM, scar wrote:<br>
</div>
<blockquote type="cite" cite="mid:p0aho7$8ia$1@blaine.gmane.org">I
can't seem to figure out how to setup a public IP for the VM so we
could use it as a second public webserver. The host machine runs
our primary webserver with CentOS 6.9 and one public ipv4 address
configured on physical interface eth0. Now i have configured a
new bridge interface br0:
<br>
DEVICE=br0
<br>
TYPE=Bridge
<br>
BOOTPROTO=static
<br>
<br>
The IP settings are for a second public ipv4 address in the same
network. Now i setup the VM to use br0 for the NIC and set the
same IP settings inside the VM... but it doesn't work. The VM
can't resolve any hosts, and if i try to ssh to the second public
IP, it just sends me to the host machine instead of the VM.
<br>
<br>
_______________________________________________
<br>
libvirt-users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:libvirt-users@redhat.com">libvirt-users@redhat.com</a>
<br>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/libvirt-users">https://www.redhat.com/mailman/listinfo/libvirt-users</a>
<br>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<table>
<tbody>
<tr>
<td style="padding-left: 20px" width="90%">Doug Hughes<br>
Keystone NAP<br>
Fairless Hills, PA<br>
1.844.KEYBLOCK (539.2562)</td>
<td style="align: right;padding-right: 20px"><img
src="cid:part1.349BBE03.7001F613@keystonenap.com">
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>