Skip to content

Arch Linux: Create bonding interface with netcfg and systemd

In this post I will explain how to create a bonding interface in Arch Linux using netcfg and systemd (to load the kernel module and start netcfg service).

First of all, configure the bonding kernel module.

root@sabertooth ~ # vim /etc/modprobe.d/bonding.conf
options bonding mode=0 options bonding miimon=100

For more bonding module options and parameters, please refer to: kernel.org bondig documentation

Now create the netcfg profile for your bond interface. You can check /etc/network.d/examples for more sample config files.

root@sabertooth ~ # vim /etc/network.d/bond
CONNECTION='bond' INTERFACE='bond0' SLAVE_INTERFACES=('eth0' 'eth1') #IP='dhcp' IP='static' ADDR='192.168.1.100' NETMASK='255.255.255.0' GATEWAY='192.168.1.1' DNS=('192.168.1.1') SKIPNOCARRIER='yes'


You can skip this part and go straight to the last 2 commands. Thanks to Thomas for noticing.

Last config step, add the profile to the netcfg NETWORKS array.

root@sabertooth ~ # vim /etc/conf.d/netcfg
# Enable these netcfg profiles at boot time. #   - prefix an entry with a '@' to background its startup #   - set to 'last' to restore the profiles running at the last shutdown #   - set to 'menu' to present a menu (requires the dialog package) # Network profiles are found in /etc/network.d NETWORKS=(bond) # Specify the name of your wired interface for net-auto-wired #WIRED_INTERFACE="bond0" # Specify the name of your wireless interface for net-auto-wireless #WIRELESS_INTERFACE="wlan0" # Array of profiles that may be started by net-auto-wireless. # When not specified, all wireless profiles are considered. #AUTO_PROFILES=("profile1" "profile2")

As you can see, I only use the NETWORKS line, all the rest is not needed in this case.

Lets test it. Make sure the bonding module is NOT loaded, systemd will do this for you.

root@sabertooth ~ # systemctl start netcfg@bond.service

Check ‘journalctl’ if anything goes wrong.

And start at boot.

root@sabertooth ~ # systemctl enable netcfg@bond.service

ESX4: VMs ‘disconnected’ state in vcenter after loosing paths to storage

ESX can sometimes act realy strange when it notices problems with multipathing. In this case we lost a few paths to our storage box. In vCenter all VMs started to switch to disconnected state. Note that all the VMs stayed online, just the management was lost. Here is the fix:

vkmfstools -L lunreset /vmfs/device/disks/naa...

ESX CLI create VMFS and datastore on backend storage

Background:

  • IBM DS3500 storage box
  • IBM x3550 with 2 SAS HBA’s for the ESX host
  • Redundant SAS connection between storage & ESX host
  • Multipath with active/passive config

Prereqs:

  • Back-end storage with a volume mapped to your ESX host
    • LUN id of the mapped volume
  • Identifier of your FC or SAS HBA’s
    • In this case vmhba3 (active) & vmhba4 (standby)
  • SSH Client (openssh, putty, …)
  • vSphere Client (if you want visualization afterwards)

SSH to your ESX host (on windows open putty):

ssh -l root esxhost

Find your device identifier by its LUN id. If you work with multipathing and have an active/passive configuration make sure the State is acitve, since you will find your mapped device on multiple HBA’s and only one of them will be the active path. The LUN id is 0 in this case (L0). Note the Device entry, you will need it further on. Identify the right entry by Adapter & LUN:

~ # esxcli storage core path list

sas.500605b004542970-sas.50080e5239d32000-naa.60080e5000239d32000001ef4f3eb6da
UID: sas.500605b004542970-sas.50080e5239d32000-naa.60080e5000239d32000001ef4f3eb6da
Runtime Name: vmhba3:C0:T0:L0
Device: naa.60080e5000239d32000001ef4f3eb6da
Device Display Name: IBM Serial Attached SCSI Disk (naa.60080e5000239d32000001ef4f3eb6da)
Adapter: vmhba3
Channel: 0
Target: 0
LUN: 0
Plugin: NMP
State: active
Transport: sas
Adapter Identifier: sas.500605b004542970
Target Identifier: sas.50080e5239d32000
Adapter Transport Details: 500605b004542970
Target Transport Details: 50080e5239d32000

Now that you know the device identifier (naa.60080e5000239d32000001ef4f3eb6da) you can find the device (local path) of the mapped volume:

~ # ls /vmfs/devices/disks/

naa.600605b0041c3d90ff0000bb0b54c69d                          vml.0200000000600605b0041c3d90ff0000bb0b54c69d536572766552
naa.600605b0041c3d90ff0000bb0b54c69d:1                        vml.0200000000600605b0041c3d90ff0000bb0b54c69d536572766552:1
naa.600605b0041c3d90ff0000bb0b54c69d:2                        vml.0200000000600605b0041c3d90ff0000bb0b54c69d536572766552:2
naa.600605b0041c3d90ff0000bb0b54c69d:3                        vml.0200000000600605b0041c3d90ff0000bb0b54c69d536572766552:3
naa.600605b0041c3d90ff0000bb0b54c69d:5                        vml.0200000000600605b0041c3d90ff0000bb0b54c69d536572766552:5
naa.600605b0041c3d90ff0000bb0b54c69d:6                        vml.0200000000600605b0041c3d90ff0000bb0b54c69d536572766552:6
naa.600605b0041c3d90ff0000bb0b54c69d:7                        vml.0200000000600605b0041c3d90ff0000bb0b54c69d536572766552:7
naa.600605b0041c3d90ff0000bb0b54c69d:8                        vml.0200000000600605b0041c3d90ff0000bb0b54c69d536572766552:8
naa.60080e5000239d32000001ef4f3eb6da                          vml.020000000060080e5000239d32000001ef4f3eb6da313734362020
naa.60080e5000239d380000016f4f3e7b86                          vml.020000000060080e5000239d32000001ef4f3eb6da313734362020:1
vml.02001f000060080e5000239d380000016f4f3e7b86556e69766572
~ #

Create a partition on this device and set partition type to VMFS (0xfb):

~ # fdisk /vmfs/devices/disks/naa.60080e5000239d32000001ef4f3eb6da

m: menu
p: print current partition table
-> It should be empty
n: new partition
-> follow wizzard
t: set partition type to VMFS
-> fb
w: write partition table & exit

Create VMFS filesystem (datastore) (fs: VFMS5, name: datastore2). Keep in mind to create the filesystem on the created partition and not the raw device.

~ # vmkfstools -C vmfs5 -S datastore2 /vmfs/devices/disks/naa.60080e5000239d32000001ef4f3eb6da\:1

Change your current directory to the freshly created datastore datastore2, you will notice it’s just a link to a unique identifier

~ # cd /vmfs/volumes/datastore2/
/vmfs/volumes/4f3e647f-10d6cc03-4bb3-5cf3fce8561e # ls
/vmfs/volumes/4f3e647f-10d6cc03-4bb3-5cf3fce8561e # touch test.txt
/vmfs/volumes/4f3e647f-10d6cc03-4bb3-5cf3fce8561e # ls
test.txt
/vmfs/volumes/4f3e647f-10d6cc03-4bb3-5cf3fce8561e #

You have a working datastore now, you can login to your ESX host with the vSphere client and browse the datastore.