[kwlug-disc] Multiple NICs on Ubuntu Server 14.04
Khalid Baheyeldin
kb at 2bits.com
Fri Aug 15 11:30:01 EDT 2014
On Fri, Aug 15, 2014 at 10:40 AM, CrankyOldBugger <crankyoldbugger at gmail.com
> wrote:
>
> virbr0 Link encap:Ethernet HWaddr ca:e3:65:49:dc:e4
> inet addr:192.168.122.1 Bcast:192.168.122.255
> Mask:255.255.255.0
> UP BROADCAST MULTICAST MTU:1500 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
>
>
> Don't ask me why virbr0 is there. (Google tells me it's there because I
> started tinkering with KVM at some point but I never finished the task.)
>
Yes, I have that too, and yes, it is caused by libvirt/kvm. And it is not
from configuration in /etc/network/interfaces.
> I want to start building virtual machines on this box, but before I do I
> would like to see the server using both NIC cards appropriately.
>
You can make both cards work by putting something like this in your
/etc/network/interfaces
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet dhcp
The above will make both interfaces come up at boot, and configure
themselves via DHCP, so the router assigns them an IP address, ...etc
Or you can assign that manually using something like:
auto eth0
iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
auto eth1
iface eth1 inet static
address 192.168.0.3
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
This means the first NIC will get 192.168.0.2 and the second will be .3,
assuming that the router is at .1.
> By that I mean it will share the load between any future VMs between the
> two NICs,
>
I am not sure what share the load means, or if there is a real answer to it
as asked. So I will leave that to others who know more than me.
> or at least reserve one NIC for the host server and one NIC for the VMs.
>
This can be done in /etc/network/interfaces as well. Assuming you want the
VMs to use only the 2nd network card, then you add:
auto br0
iface br0 inet dhcp
bridge_ports eth1
And when creating a VM, via libvirt, you say:
sudo virt-install --name vm_name ... --network bridge=br0 ...
This tells libvirt to use the bridge br0, which uses eth1, which you have
configured separately.
I have not tried this specifically, but it "should work" (yeah, famous
words!)
(I'm ashamed to say this is much easier in MS Hyper-V, but I would much
> rather learn how to do this in Linux CLI!)
>
Tsk tsk tsk ... traitors and infiltrators in our midst ... ;-)
> So I guess my question is two-fold:
>
> a) how do I tame my NICs in preparation for setting up VMs, and
>
See above.
> b) what's the preferred method for setting up VMs in Ubuntu Server? Does
> anyone know of a good how-to link?
>
If you have kvm capable server, then use libvirt. You create VMs using
virt-install on the command line, and use virt-viewer to see the BIOS and
console output, and manage them using virsh.
Or wait till November, when I will cover all this in a presentation for
KWLUG.
--
Khalid M. Baheyeldin
2bits.com, Inc.
Fast Reliable Drupal
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra
Simplicity is the ultimate sophistication. -- Leonardo da Vinci
For every complex problem, there is an answer that is clear, simple, and
wrong." -- H.L. Mencken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20140815/e584cd34/attachment.htm>
More information about the kwlug-disc
mailing list