Sunday, 27 September 2026
System restoration with REAR
Sunday, 20 September 2026
Fixing frozen keyboard in ILO virtual console
On newer versions of RHEL (9+) the keyboard on the ILO virtual console will die shortly after reboot.
$ journalctl -k | egrep -i 'dmar|iommu|remap'
Reports lots of INTR-REMAP errors
and
$ lsusb
Does not show the ILO virtual keyboard as connected when the console is open.
The fix is to add this parameter to the kernel command line
# grubby --update-kernel=ALL --args="intremap=nosid"
# grubby --info=ALL
to verify it has been added, then reboot.
Opening and closing console should now work and you'll see the keyboard connected
[paul@einstein ~]$ lsusb
Bus 003 Device 010: ID 03f0:7029 HP, Inc Virtual Keyboard
And the following lines in the system messages file
Sep 20 15:53:57 einstein kernel: usb 3-1: new full-speed USB device number 10 using uhci_hcd
Sep 20 15:53:57 einstein kernel: usb 3-1: New USB device found, idVendor=03f0, idProduct=7029, bcdDevice= 0.02
Sep 20 15:53:57 einstein kernel: usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Sep 20 15:53:57 einstein kernel: usb 3-1: Product: Virtual Keyboard
Sep 20 15:53:57 einstein kernel: usb 3-1: Manufacturer: BMC
Sep 20 15:53:57 einstein kernel: input: BMC Virtual Keyboard as /devices/pci0000:00/0000:00:1c.7/0000:01:00.4/usb3/3-1/3-1:1.0/0003:03F0:7029.0011/input/input21
Sep 20 15:53:57 einstein kernel: hid-generic 0003:03F0:7029.0011: input,hidraw0: USB HID v1.01 Keyboard [BMC Virtual Keyboard ] on usb-0000:01:00.4-1/input0
Sep 20 15:53:57 einstein kernel: input: BMC Virtual Keyboard as /devices/pci0000:00/0000:00:1c.7/0000:01:00.4/usb3/3-1/3-1:1.1/0003:03F0:7029.0012/input/input22
Sep 20 15:53:57 einstein kernel: hid-generic 0003:03F0:7029.0012: input,hidraw1: USB HID v1.01 Mouse [BMC Virtual Keyboard ] on usb-0000:01:00.4-1/input1
Sep 20 15:53:57 einstein systemd-logind[999]: Watching system buttons on /dev/input/event1 (BMC Virtual Keyboard )
Sunday, 17 November 2024
MFA with Google Authenticator
Set server up so user can log in with an ssh key or Google authenticator (won't need both).
If a user doesn't have key access setup they'll have to use Google Authenticator, they won't be able to log in with a password
The user still needs to type the password to log into cockpit
Sunday, 3 September 2023
Expand a logical volume used inside a VM
This expands a LV used as a virtual disk inside a virtual machine.
First expand the LV on the hypervisor
# lvextend -L500g /dev/vg_guests/lv_myvideo
# lvs|grep myvideo
lv_myvideo vg_guests -wi-ao---- 500.00g
Reboot the hypervisor so all disks are rescanned. There's probably a way of doing this without a reboot but I couldn't figure out how to get that to work;
Check the VM can see the new disk size
# fdisk -l /dev/vdc
Disk /dev/vdc: 500 GiB, 536870912000 bytes, 1048576000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x60117149
Device Boot Start End Sectors Size Id Type
/dev/vdc1 2048 838860799 838858752 400G 83 Linux
Before continuing, stop any processes using the disk and unmount it.
The partition is still 400G so, using fdisk, delete the primary partition and recreate accepting all defaults, except...
Do not remove the existing disk signature
Do you want to remove the signature? [Y]es/[N]o: N
If you accidentally do remove it, repairing the disk should get it back.
# xfs_repair -L /dev/vdc1
Verify the new size
# fdisk -l /dev/vdc1
Disk /dev/vdc1: 500 GiB, 536869863424 bytes, 1048573952 sectors
Finally remount and grow the file system.
# xfs_growfs /dev/vdc1
Sunday, 8 January 2023
Replacing A Failed Disk in a software Raid 1 array
2 Disk array, /dev/sda & /dev/sdc where /dev/sdc has failed.
- Mark disk as failed
- # mdadm --manage /dev/md0 --fail /dev/sdc1
- Remove disk from array
- # mdadm --manage /dev/md0 --remove /dev/sdc1
- Remove physical disk
- Copy partition table from working disk
- # sfdisk -d /dev/sda | sfdisk /dev/sdc
- Add disk to mirror
- # mdadm --manage /dev/md0 --add /dev/sdc1
- Verify & check on rebuild status
- # mdadm --detail /dev/md0
- # cat /proc/mdstat
Sunday, 25 April 2021
Non-root access to system logs
Access to some system logs in /var/log is restricted to root only.
Here's a handy way to grant access read-only access to all system logs without all that mucking around with sudo and file permissions.
- Install bindfs from the EPEL repo.
- Create a group (eg: logs) and add all users to it who need logfile access
- Create a mountpoint for the read-only view of /var/log (eg: /log)
- Create a bind mount in /etc/fstab
- /var/log /log fuse.bindfs ro,force-group=logs,perms=g+rD 0 0
- Mount /log
Monday, 22 July 2019
NordVPN access from RHEL 8
RHEL 8 doesn't yet have a dedicated EPEL repo so we can temporarily use the RHEL 7 repo.
- yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
- yum install NetworkManager-openvpn
- wget https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip
- nmcli connection import type openvpn file uk1089.nordvpn.com.udp.ovpn
- nmcli connection modify uk1089.nordvpn.com.udp +vpn.data "username=user@email.com,password-flags=0" vpn.secrets password="MyPassword"
- restorecon -R /root/.cert
- nmcli connection up uk1089.nordvpn.com.udp
- nmcli connection down uk1089.nordvpn.com.udp
- nmcli connection show
- nmcli connection delete uk1089.nordvpn.com.udp
[Remote nmcli SSH access]Identity=unix-user:paulAction=org.freedesktop.NetworkManager.network-controlResultAny=yesResultInactive=yesResultActive=yes
Tuesday, 23 January 2018
User session messages in the system log on Centos 7
Filter them out with an rsyslog filter script in /etc/rsyslog.d -
echo 'if $programname == "systemd" and ($msg contains "Starting Session" or $msg contains "Started Session" or $msg contains "Created slice" or $msg contains "Starting user-" or $msg contains "Starting User Slice of" or $msg contains "Removed session" or $msg contains "Removed slice User Slice of" or $msg contains "Stopping User Slice of") then stop' >/etc/rsyslog.d/ignore-systemd-session-slice.conf
systemctl restart rsyslog
Wednesday, 29 March 2017
Centos 7 - systemd messages flooding logs
Mar 27 03:40:01 einstein systemd: Created slice user-0.slice.
Mar 27 03:40:01 einstein systemd: Starting user-0.slice.
Mar 27 03:40:01 einstein systemd: Started Session 1317 of user root.
Mar 27 03:40:01 einstein systemd: Starting Session 1317 of user root.
Mar 27 03:40:01 einstein systemd: Removed slice user-0.slice.
Mar 27 03:40:01 einstein systemd: Stopping user-0.slice.
Given sar runs every 10 minutes there is a lot of crud in the messages file.
You can create a filter for rsyslogd to tell it to junk the messages:
echo 'if $programname == "systemd" and ($msg contains "Starting Session" or $msg contains "Started Session" or $msg contains "Created slice" or $msg contains "Starting user-" or $msg contains "Removed slice user-" or $msg contains "Stopping user-") then stop' >/etc/rsyslog.d/ignore-systemd-session-slice.conf
systemctl restart rsyslog.service
I take no credit for this, thanks to this article on the excellent Redhat Knowledgebase.
(I slightly adapted the solution to include the Removed & Stopping messages too)
Monday, 20 July 2015
Hypervisor Build on MicroServer - Part 2
We're going to be using logical volumes & LVM on our RAID 5 array for the storage of the virtual guests
# pvcreate /dev/md0Also create a volume to hold the ISOs for building the guestsPhysical volume "/dev/md0" successfully created# vgcreate vg_guests /dev/md0Volume group "vg_guests" successfully created
# lvcreate -L 25G vg_guests -n lv_isos# mkfs.ext4 /dev/vg_guests/lv_isos
Auto-mount it in /etc/fstab
/dev/mapper/vg_guests-lv_isos /isos ext4 defaults 0 2Mount and set permissions so 'paul' can upload ISOs directly to it
# mount /isos# chmod 755 /isos# chgrp paul /isos
Finally upload some ISOs...
Using virt-manager, connect to the local QEMU
- Remove the virtual network created inside the Virtual Network tab ; we'll be using my home lan for the guests
- Add a storage pool for the ISOs so they are available to the guests for mounting
- Name: ISOs
- Type: dir Filesystem Directory
- Target Path: /isos
- Add a storage pool for the RAID 5 LVM array to hold the virtual guest storage
- Name: Guests
- Type: logical: LVM Volume Group
- Target Path: /dev/vg_guests
- Source Name: vg_guests
So now we're set up, here's a run through of creating a typical guest:
Before getting into virt-manager create a logical volume for the storage, eg:
# lvcreate -L 10G vg_guests -n lv_myguestname
Now from within virt-manager:
- Give it a name
- Use Local install media / Use ISO image / Select an ISO from your ISO storage pool
- Set OS type & version, set applicable RAM & CPU
- Select managed or other existing storage & pick your newly created logical volume from the Guests storage pool.
- You'll notice no networking is available. This is fine just make sure to tick the 'Customize configuration before install' box and this can be added next.
- Add Hardware and select Network - Host device eth0: macvtap
- Select the newly created NIC and make sure source mode is set to Bridge otherwise the interface will not work.
Now hit 'Begin Installation' and install your lovely new guest.
Once built, if it's a Linux guest, configure the virtual serial port as detailed here so console access is via the command line rather than virt-manager.
A point to note about macvtap interfaces. They do not allow guest to hypervisor communication. Guest to guest is fine as is guest to rest of LAN. If you need to communicate with a guest from the hypervisor or vice versa you will need to create bridged interfaces and use those.
Sunday, 12 July 2015
Configuring a RAID 5 array using software RAID
To make it slightly more interesting I'm going to create it initially using only 2 disks and then add the afterwards. Why? Because I can.
I'm doing this on my MicroServer. The RAID array will hold the virtual guests and the ISO storage pool.
First partition the disks and make sure they partitions are aligned:
# parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel msdos
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) mkpart primary ext4 0% 100%
(parted) set 1 raid on
(parted) align-check optimal 1
1 aligned
(parted) p
Model: ATA WDC WD20EZRX-00D (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 2000GB 2000GB primary raid
Tip - here's how to check the disks are ready to go
mdadm -E /dev/sd[bc]
/dev/sdb:
MBR Magic : aa55
Partition[0] : 3907026944 sectors at 2048 (type fd)
/dev/sdc:
MBR Magic : aa55
Partition[0] : 3907026944 sectors at 2048 (type fd)
Tip - if these aren't brand new disks check they haven't got any md superblocks already present. If they have zero the superblock (see later in post)
# mdadm -E /dev/sd[bc]1
mdadm: No md superblock detected on /dev/sdb1.
mdadm: No md superblock detected on /dev/sdc1.
Here's the magic. How to create the array, note the use of the 'missing' parameter for the 3rd disk.
# mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 missing
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
Tip - how to check the array status
# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdc1[1] sdb1[0]
3906764800 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [UU_]
bitmap: 15/15 pages [60KB], 65536KB chunk
unused devices: <none>
# mdadm --detail /dev/md0Finally save the configuration
/dev/md0:
Version : 1.2
Creation Time : Mon May 25 19:54:54 2015
Raid Level : raid5
Array Size : 3906764800 (3725.78 GiB 4000.53 GB)
Used Dev Size : 1953382400 (1862.89 GiB 2000.26 GB)
Raid Devices : 3
Total Devices : 2
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Mon May 25 19:54:54 2015
State : active, degraded
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 512K
Name : einstein.at.home:0 (local to host einstein.at.home)
UUID : cc117a2a:439506c1:429d86cf:35514c71
Events : 0
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 8 33 1 active sync /dev/sdc1
4 0 0 4 removed
mdadm --detail --scan --verbose >> /etc/mdadm.conf
So now let's add the missing disk
First clone the partition table from one of the existing disks
sfdisk -d /dev/sdb | sfdisk /dev/sdd --force
(For completeness zero the superblock as shown above, although not technically necessary on a new disk of course)
Now add the disk to the array:
mdadm --add /dev/md0 /dev/sdd1
The array will now resilver. This will takes hours. You can check /proc/mdstat for progress.
Don't forget to update mdadm.conf as shown above.
Tip - You can speed up resilvering by increasing these kernel parameters
echo 50000 > /proc/sys/dev/raid/speed_limit_minFinally if you want to destroy an array
echo 16384 > /sys/block/md0/md/stripe_cache_size
# mdadm --stop /dev/md0
mdadm: stopped /dev/md0
# mdadm --zero-superblock /dev/sdb
# mdadm --zero-superblock /dev/sdc
# mdadm --zero-superblock /dev/sdd
Hypervisor Build on MicroServer
Making use of the internal USB socket to install Centos 6.6 on an 8GB USB stick and using all the hard drives as guest storage. There are 3 hard drives which will be configured as RAID 5 using Linux software RAID.
Use the lovely ILO to virtual mount and boot the Centos 6.6 ISO and the remote console to do the install. A big advantage over my first MicroServer.
Tip - quick way to erase a USB stick in Windows - use diskpart
DISKPART> list disk
DISKPART> select disk 2
DISKPART> clean
Perform a minimal install to the USB stick.
Tip - to avoid having to update after the install, use an install URL and add an additional repository for the updates. It'll all be done in one go. Here's the ones I use:
Install URL: http://mirrors.ukfast.co.uk/sites/ftp.centos.org/6.6/os/x86_64/
Additional repo: http://mirrors.ukfast.co.uk/sites/ftp.centos.org/6.6/updates/x86_64/
Install additional packages:
xauth (for X window virt-manager to work)
ntp (time sync)
parted (disk partitioning as fdisk is deprecated and doesn't like new large disks)
acpid (so you can do a graceful shutdown with the power button)
hp-ams (HP's agentless management service, get from the HP website. Integrates into ILO)
Configure and enable firewall and allow only ssh inbound (/etc/sysconfig/iptables)
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Configure and enable ntp
Create a user id and block root access via ssh
Install Virtualisation
yum groupinstall Virtualization
yum groupinstall "Virtualization Client"
yum groupinstall "Virtualization Platform"
yum install dejavu-lgc-sans-fonts
Allow 'paul' to run virt-manager and manage the local qemu
Create /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
Friday, 26 June 2015
Using the virtual serial port with KVM
serial --unit=0
terminal --timeout=5 serial console
kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/vg_rhel6-lv_root rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=uk LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 rd_LVM_LV=vg_rhel6/lv_swap crashkernel=auto rd_LVM_LV=vg_rhel6/lv_root rd_NO_DM rhgb quiet console=ttyS0
GRUB_TERMINAL="serial"GRUB_SERIAL_COMMAND="serial"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos_tos7/swap rd.lvm.lv=centos_tos7/root rhgb quiet console=ttyS0"Now regenerate the grub configuration
grub2-mkconfig -o /boot/grub2/grub.cfg
Saturday, 28 June 2014
Using winbind to authenticate to an active directory - Part 3
You can read about the AD setup in Part 1 and the RHEL 6 configuration in Part 2.
I have performed a customized RHEL 5 installation, removing Desktop Environments, Applications, Printer Servers and reset the run level to 3.
yum install samba3x-winbind (you don't need samba for authentication)
Run authconfig-tui --enablemkhomedir to configure winbind, set the following options:
user information: use winbind
authentication: winbind
winbind domain: MY
security model: ads
winbind ads realm: MY.DOM
winbind domain controllers: dc.my.dom
template shell: /bin/bash
Don't click join domain at this stage.
When the wizard completes it will attempt to start winbind and fail. We haven't finished configuring yet so this is fine.
Remove the existing configuration databases, rm -f /var/lib/samba/*
Modify /etc/samba/smb.conf with the following options. This will map all AD users & groups into the range 100000-199999.
workgroup = MY
password server = dc1.my.dom
realm =MY.DOM
security = ads
idmap config * : backend = tdb
idmap config * : range = 200000-299999
idmap config my:backend = rid
idmap config my:range = 100000 - 199999
idmap config my:base_rid = 0
idmap uid = 100000-299999
idmap gid = 100000-299999
You can also set these useful options:
template shell = /bin/bash
winbind use default domain = true
winbind enum users = yes (let's you use getent passwd to see AD users)
winbind enum groups = yes (let's you use getent group to see AD groups)
winbind offline logon = true (cached users can log in when AD is unavailable. Very useful)
Now rerun authconfig-tui --enablemkhomedir and click join domain. Supply the AD domain password when prompted and the client will join the domain successfully. You will be able to see the client in the Windows ADUC tool
It should now start up properly:
chkconfig winbind on ; service winbind start
I'm not setting up centralised home directories so we'll use oddjobd to automatically create home directories when an AD user logs on for the first time to a client.
We'll set the home directories up in /home/MY and make them private. RHEL 6 uses oddjobd for this. RHEL 5 doesn't.
mkdir /home/MY
chmod 711 /home/MY
Modify /etc/pam.d/system-auth-ac to fix home dir permissions
session optional pam_mkhomedir.so umask=0077
Now restrict ssh access to users in the grp-linux-servers AD group.
Edit /etc/security/pam_winbind.conf
require_membership_of = grp-linux-servers
Finally restrict root access via sudo to those in the grp-root-access AD group
Edit /etc/sudoersSome useful commands to check things are working:
%grp-root-access ALL=(ALL) NOPASSWD: ALL
wbinfo -u / wbinfo -g will pull a user and group list from the AD
wbinfo -D my / wbinfo --dc-info=my will put details of AD and associated DCs
getent passwd / getent group will show the client's passwd & group list including AD entries.
In Part 4 I'll describe how to achieve this on a Solaris 10 client. This is the most complex to set up as there is no out the box integration and it also requires additional freeware packages.
Using winbind to authenticate to an active directory - Part 2
I'll assume a basic server installation has been performed. You may need to add additional packages if you've gone with a minimal install.
yum install winbind (you don't need samba for authentication)
Run system-config-authentication or authconfig-tui to configure winbind, set the following options:
user account database: winbind
winbind domain: MY
security model: ads
winbind ads domain: MY.DOM
winbind domain controllers: dc.my.dom
template shell: /bin/bash
Advanced option: create home directories on first logon
Don't click join domain at this stage.
When the wizard completes it will attempt to start winbind and fail. We haven't finished configuring yet so this is fine.
Remove the existing configuration databases, rm -f /var/lib/samba/*
The key thing when integrating into a domain is to make sure the Unix UID / GID are consistent across all unix hosts. Winbind provides several mapping strategies for doing this. I'm using idmap_rid as it's simple to setup, doesn't require an external database and performs an algorithmic mapping from Windows SIDs to UID / GIDs
Modify /etc/samba/smb.conf with the following options. This will map all AD users & groups into the range 100000-199999.
workgroup = MY
password server = dc1.my.dom
realm =MY.DOM
security = ads
idmap config * : backend = tdb
idmap config * : range = 200000-299999
idmap config my:backend = rid
idmap config my:range = 100000 - 199999
idmap config my:base_rid = 0
idmap uid = 100000-299999
idmap gid = 100000-299999
You can also set these useful options:
template shell = /bin/bash
winbind use default domain = true
winbind enum users = yes (let's you use getent passwd to see AD users)
winbind enum groups = yes (let's you use getent group to see AD groups)
winbind offline logon = true (cached users can log in when AD is unavailable. Very useful)
Now rerun the authentication gui / tui and click join domain. Supply the AD domain password when prompted and the client will join the domain successfully. You will be able to see the client in the Windows ADUC tool
It should now start up properly:
chkconfig winbind on ; service winbind start
I'm not setting up centralised home directories so we'll use oddjobd to automatically create home directories when an AD user logs on for the first time to a client.
We'll set the home directories up in /home/MY and make them private:
mkdir /home/MY
chmod 711 /home/MY
Edit /etc/oddjobd.conf.d/oddjobd-mkhomedir.conf
Change 2 umasks to -u 0077 (from 0002) to make home dirs private
service oddjobd restart
Now restrict ssh access to users in the grp-linux-servers AD group.
Edit /etc/security/pam_winbind.confFinally restrict root access via sudo to those in the grp-root-access AD group
require_membership_of = grp-linux-servers
Edit /etc/sudoersSome useful commands to check things are working:
%grp-root-access ALL=(ALL) NOPASSWD: ALL
wbinfo -u / wbinfo -g will pull a user and group list from the AD
wbinfo -D my / wbinfo --dc-info=my will put details of AD and associated DCs
getent passwd / getent group will show the client's passwd & group list including AD entries.
In Part 3 I'll describe how to do the same thing for a RHEL 5 client. The principals are the same but RHEL 5 isn't so tightly integrated with windbind out the box so we have to do a little bit of extra work.
Tuesday, 25 February 2014
Sudo : The basics
Always use visudo to edit as it does syntax checking for you
Command aliases:
Cmnd_Alias DIAGS = /usr/sbin/tcpdump,/usr/sbin/ethtool
Network / host aliases:
Host_Alias LAN = 192.168.0.0/255.255.255.0
You can then allow a user to access these commands:
This will allow Paul to run tcpdump & ethtool from anywhere without reentering his password:
paul ALL = NOPASSWD:DIAGS
Or you can restrict it to certain subnets:
paul LAN = NOPASSWD:DIAGS
Omit the NOPASSWD parameter if you want Paul to reenter his password everytime he uses sudo.
If you want paul to be able to become root and do anything:
paul ALL=(ALL) NOPASSWD:ALL
Monday, 6 January 2014
Replacing mirrored disks under Linux software RAID
# cat /proc/mdstat
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [linear]
md3 : active raid1 sdb3[1] sda3[0]
949995648 blocks [2/2] [UU]
md2 : active raid1 sdb2[1] sda2[0]
8514368 blocks [2/2] [UU]
md1 : active raid1 sdb1[1] sda1[0]
8602688 blocks [2/2] [UU]
md4 : active raid1 sdb4[1] sda4[0]
9638912 blocks [2/2] [UU]
Tuesday, 17 December 2013
Packet capture with tcpdump
Interactive capture of traffic on interface eth0:
- tcpdump -i eth0
Capture traffic to a file, output can be read in Wireshark:
- tcpdump -w output.pcap -i eth0
Filter to a specific source or destination or both:
- tcpdump -i eth0 src 192.168.100.1
- tcpdump -i eth0 dst 192.168.100.1
- tcpdump -i eth0 src 192.168.100.1 or dst 192.168.100.1
Further filter by port:
- tcpdump -i eth0 src 192.168.100.1 or dst 192.168.100.1 and port 22
Thursday, 23 August 2012
Bonded interfaces in RHEL
This bond is working in failover mode with VLAN tagging over interfaces eth0 & eth1:
ifcfg-bond0
DEVICE=bond0ifcfg-bond0.x (where x is vlan number)
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
BONDING_OPTS="mode=1 miimon=100"
DEVICE=bond0.x
IPADDR=y.y.y.y
NETMASK=y.y.y.y
GATEWAY=y.y.y.y
USERCTL=no
BOOTPROTO=static
ONBOOT=yes
VLAN=yes
IPV6INIT=no
DEVICE=ethx
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
Restart network services and the bond will be created. Make sure all previous non-bonded interfaces are destroyed before restarting network services otherwise they will interfere with the bond creation. A reboot is the easiest way to sort this out.
ifenslave --change-active bond0 eth0
ifenslave -d bond0 eth0
ifenslave bond0 eth0
Monday, 13 August 2012
Linux Disk Benchmarking
Write a 512MB file
dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync ; rm test