KVM clone Fedora network issue

After clone Fedora 24 VM, the is a network issue:

$ sudo systemctl restart network
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

$ journalctl -xe
Nov 14 15:59:07 localhost NetworkManager[818]:   [1479157147.5419] audit: op="connection-activate" uuid="123dd488-4e5a-3420-952d-c6e63dff7c21"
Nov 14 15:59:07 localhost network[1389]: Bringing up interface ens3:  Error: Connection activation failed: No suitable device found for this connect
Nov 14 15:59:07 localhost network[1389]: [FAILED]

Root cause: The old network device doesn’t exist anymore. During clone, a new network device is added.


Delete old network profile. (ex. old interface is ens3)

$ sudo rm /etc/sysconfig/network-scripts/ifcfg-ens3

Using Network Manger tool (nmcli, nmtui) to config network again.

Securing Linux SSH

$ sudo vi /etc/ssh/sshd_config
# Run ssh on a non-standard port:
Port 2345 # Change the port as you want 

# Disable protocol 1
# Protocol 2,1
Protocol 2

# Prevent root logins:
PermitRootLogin no

# Limit user logins:
AllowUsers alice bob

# Disable password authentication forcing use of keys
PasswordAuthentication no

How to generate your own private key

$ ssh-keygen -t rsa

Fedora 24 breaks dhcp on network with mac rules

If dhcp server assign ip based on MAC, Fedora 24 client can’t get the right IP.

Root cause: After fresh install Fedora 24, there is no /etc/dhcp/dhclient.conf. Not sure what Network Manger does to acquire IP addess.

Solution: Create /etc/dhcp/dhclient.conf

$ sudo vi /etc/dhcp/dhclient.conf

send dhcp-client-identifier = hardware;


How to install ZFS on Fedora 24

$ sudo dnf install http://download.zfsonlinux.org/fedora/zfs-release$(rpm -E %dist).noarch.rpm
$ gpg --quiet --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux
pub  2048R/F14AB620 2013-03-21 ZFS on Linux <zfs@zfsonlinux.org>
    Key fingerprint = C93A FFFD 9F3F 7B03 C310  CEB6 A9D5 A1C0 F14A B620
    sub  2048R/99685629 2013-03-21

$ sudo dnf install kernel-devel zfs

Run in error with the command:

$ sudo modprobe zfs
modprobe: FATAL: Module zfs not found in directory /lib/modules/4.5.5-300.fc24.x86_64

Solution (Rootcause is the header version is 4.8.6 which is higher than $(uname -r)):

$ dkms status
spl, added
zfs, added

$ sudo dkms install spl/
Error! echo
Your kernel headers for kernel 4.5.5-300.fc24.x86_64 cannot be found at
/lib/modules/4.5.5-300.fc24.x86_64/build or /lib/modules/4.5.5-300.fc24.x86_64/source.

$ sudo dnf info kernel-header*
Last metadata expiration check: 0:24:21 ago on Fri Nov 11 00:28:19 2016.
Installed Packages
Name        : kernel-headers
Arch        : x86_64
Epoch       : 0
Version     : 4.8.6
Release     : 201.fc24
Size        : 3.7 M
Repo        : @System
From repo   : updates
Summary     : Header files for the Linux kernel for use by glibc
URL         : http://www.kernel.org/
License     : GPLv2 and Redistributable, no modification permitted
Description : Kernel-headers includes the C header files that specify the interface
            : between the Linux kernel and userspace libraries and programs.  The
            : header files define structures and constants that are needed for
            : building most standard programs and are also needed for rebuilding the
            : glibc package.

$ sudo dnf install kernel-devel-$(uname -r)

$ sudo dkms install spl/

$ sudo dkms install zfs/

$ sudo modprobe zfs

$ sudo lsmod |grep zfs
zfs                  2686976  0
zunicode              331776  1 zfs
zavl                   16384  1 zfs
zcommon                49152  1 zfs
znvpair                77824  2 zfs,zcommon
spl                    98304  3 zfs,zcommon,znvpair

Reference: https://github.com/zfsonlinux/zfs/wiki/Fedora