KVM Host Network

Network Tools

Get the good old ifconfig command back. There has been many discussions about the network naming scheme, and a new scheme has arrived, one which guarantees that the network device will not change its name. The new naming scheme provides very long names in some cases, so I like to stick with the old naming scheme. This will however not be supported in the future.

apt-get install net-tools

Network Interfaces

The new network naming scheme does not fit me. I rather like the good old ethX names. The new naming scheme makes a lot of considerations abot the hardware before giving it a name, which sometimes results in very long and weird interfaces names. This especially happens when using USB network devices.

The first thing to do is to tell the kernel that we want the old naming scheme. Edit /etc/default/grub.

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

Make sure to update the grub configuration.

update-grub

Since we are changing a kernel parameter this calls for a reboot.

Identify Network Interfaces

Take your time to identify your network interfaces. Mark the physical network port with a sticker on the system. This will come in handy later on. You can change the device names using udev. Edit /etc/udev/rules.d/70-persistent-net.rules.

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:3b:0f:1b:8a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Once configured, this information has to go to the initrd as well.

update-initramfs -u

Bridging Network Interfaces

The KVM Guests will use the same network interface as your KVM Host, so bridging those network interfaces is a must. Configuring bridging will most likely put you in a situation where a misconfiguration renders the system unreachable on the network. For that reason it is a very good idea to have physical access to the system while setting up the network bridging.

apt-get install bridge-utils

edit /etc/network/interfaces.

# bring up network interfaces
iface eth0 inet manual

# bridging eth0 as br0
auto br0
iface br0 inet static
        # bridge specific settings
        bridge_stp off
        bridge_maxwait 0
        bridge_fd 0
        bridge_ports eth0
        # network settings
        address 192.168.1.33
        netmask 255.255.255.0
        network 192.168.1.0
        gateway 192.168.1.1

Restart networking

service networking restart

None: KVM Host Network (last edited 2023-04-23 13:35:39 by Kristian Kallenberg)