<pclass="intro">A bridge network is a means to connect/bridge different networks together to act like a single network. This allows any connections to the bridge network to get their own internal IPs, and work as you'd expect a completely new physical PC to work.</p>
<h2>Heading</h2>
<pclass="intro">A bridge network is a means to connect/bridge different networks together to act like a single network. In this case, it allows any connections to the bridge network to get their own internal IPs, as if plugged into the network directly, and work as you'd expect a completely new physical PC to work. i.e. Accessble to other clients outside of the host.</p>
<p>First we need to find the network we want to bridge to the VMs</p>
<pre><code>ip a</code></pre>
<h2>Bridge it</h2>
<p>This will be familiar to those who have <ahref="/blog/set-static-ip.html">set a static ip</a> on linux, as it's essentially the same, with a few additional lines related to bridging</p>
<p>This can be done by editing <strong>/etc/network/interfaces</strong></p>
<pre><code>sudo vim /etc/network/interfaces</code></pre>
<p>And setting the following lines<p>
<h3>Change existing port to manual</h3>
<p>There will already exist some lines with your chosen network adapter, such as</p>
<pre><code>iface enp2s0 inet auto</code></pre>
<p>Change this to contain manual instead</p>
<pre><code>iface enp2s0 inet manual</code></pre>
<h3>Static Bridge</h3>
<p>If you want your server to have a static IP use this</p>
<pre><code>auto br0
iface br0 inet static
bridge_ports enp2s0 # which port(s) to bridge together
address 192.168.0.100 # Static IP
netmask 255.255.255.0
network 192.168.0.1
broadcast 192.168.0.255
gateway 192.168.0.1
bridge_stp off # New
bridge_fd 0 # New
bridge_maxwait 0 # New
dns-nameservers 8.8.8.8 8.8.1.1</code></pre>
<h3>Dynamic Bridge</h3>
<p>If instead you wish your server to have a dynamic IP (not recommended). A bridged network can be set, with a dynamic DHCP set IP</p>
<pre><code>iface br0 inet dhcp
bridge_ports enp2s0</code></pre>
<h2>Create Virtual Network</h2>
<p>To make it easier to manage with VMs, this new bridge can be made into a Virtual Network.</p>
<p>Open up a text-editor, and create a file called <strong>bridged-network.xml</strong></p>