This might have been painfully obvious to some people, but I had a few stumbles along the way. I wanted my virtualized Fedora 20 installation (and now Fedora 21) to use my existing internal network. My multihomed server already has DHCP and DNS running on it, and I wanted to treat my virtual desktop as "just another computer on the LAN". Here are some quick steps/notes on what I did to get this working.
First, it is worth listing out the configuration details of the server...probably a little before and after type style. This will help explain what was going on, and what I had to do.
Fedora 20 server with 2 NICs
- p9p1 -> directly connected to Internet (Public IP)
- p12p1 -> internal network (192.168.10.0/24)
DHCP and DNS are running on interface p12p1, and using a customized iptables script. This interface/network is used throughout the house. This is all configured using static files (Network Manager is disabled):
All that is pretty normal. The iptables script (too long to post) is nothing fancy either. It just has the normal stuff, including the:
echo "1" > /proc/sys/net/ipv4/ip_forward
...at the beginning. So, all that is normal, and works great. My DNS, DHCP, HTTPS, and various other services all run on this server, including the newly added libvirtd stuff. Let's get onto that configuration, and specifically what I did to get it bridged.
Fedora's documentation was a good start:
I followed that to get everything installed, and used virt-manager for managing the VMs and setting most things up. This is where I ran into a few issues, mainly getting the bridge working.
Obviously, I had to change the above /etc/sysconfig/network-scripts/ifcfg-p12p1 around a little, in order to get the bridge setup. Here is what those updates, and new files look like:
# cat /etc/sysconfig/network-scripts/ifcfg-p12p1
# cat /etc/sysconfig/network-scripts/ifcfg-br0
# systemctl restart network.service
With those updates in place, "ip addr show" now shows the new br0 interface with the expected 192.168.10.1 IP.
Also per documentation, I added the necessary sysctl.conf information:
# cat /etc/sysctl.conf
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
# sysctl -p /etc/sysctl.conf
Next, I had to reconfigure DNS and DHCP to make sure they were listening on the new br0 interface. With that in place, and some minor adjustments to my iptables script, everything was back working on my LAN as expected. Checked various devices throughout the house, and they acted as normal....unaware of the br0 change, and still accessing the Internet.
Now back to virt-manager. By default, following the "easiest method" documented everywhere, is to use the default settings and NAT. This will give you a virbr0 interface on the host device, and default to something like 192.168.122.0/24 network. Getting things to route back and forth, to me, seemed to be too overly complicated. Also, I did not like the complexity of yet another network. I researched, and found I needed to bridge the network. Oddly enough, I made this out to be a LOT harder than it needed to be. I blame the Internet. I Googled for some steps, and it lead me to a YouTube video that was completely wrong. I looked over other documentation, and it was overly complicated. I Googled various things, but in the end, trial and error prevailed. This is all I had to do to get my new VMs to access/use the bridge I created above.
First, stop/delete all the default (or manually) added Virtual Networks:
Then, under the settings of the specific VM that wants to use the bridge, simply select that from the drop down, and type in br0:
From there, I installed from the ISO normally, and got into the OS. It grabbed the an IP from my normal 192.168.10.0/24 network, and all was good to go.