Setting NIC speed in Linux

Setting the NIC speed in Redhat Linux

Redhat Linux

/etc/sysconfig/network-scripts/ifcfg-eth0

Add a line ETHTOOL_OPTS=”speed 10 duplex full autoneg off”

/etc/init.d/network restart

Did you like this?
Tip cyberfella with Cryptocurrency

Donate Bitcoin to cyberfella

Scan to Donate Bitcoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to cyberfella

Scan to Donate Bitcoin Cash to cyberfella
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to cyberfella

Scan to Donate Ethereum to cyberfella
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to cyberfella

Scan to Donate Litecoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to cyberfella

Scan to Donate Monero to cyberfella
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to cyberfella

Scan to Donate ZCash to cyberfella
Scan the QR code or copy the address below into your wallet to send some ZCash:

Adding a persistent static route

Whether your Windows server or Linux server has multiple NICs to connect it to multiple VLANs and/or networks, sometimes you’ll need to configure a static route so that your server knows which interface to use in order to get to the syslog server, ntp server etc if it is to use a route other than the default gateway.

Solaris

vi /etc/gateways    (if this file doesn’t exist read on…)

Underneath>>    net 192.168.0.1 gateway 192.168.0.254 metric 1 passive

Add the following>>       net 10.0.0.0 gateway 10.8.2.65 metric 1 active

Note:  The default gateway is set in the /etc/defaultrouter file

If the /etc/gateways file doesn’t exist, then static routes may have been added “the old way”

cd /etc/rc2.d

ls | grep static

You may see a startup file called Snnnstatic_routes.  Inside this script will be non-persistent static routes added using lines that read something like /usr/sbin/route add 10.0.0.0/24 10.8.2.65 1   Append your routes to the ‘start’ section, not forgetting to add a corresponding route delete command in the ‘stop’ section.

Red Hat Linux

echo ‘10.0.0.0/24 via 10.8.2.65’ >> /etc/sysconfig/network-scripts/route-eth0

service network restart

route -n to view the current routing table

Windows

route -p ADD 10.0.0.0 MASK 255.255.255.0 10.8.2.65

netstat -rn to view the routing table

Excellent examples here: http://www.thegeekstuff.com/2012/04/route-examples/

Did you like this?
Tip cyberfella with Cryptocurrency

Donate Bitcoin to cyberfella

Scan to Donate Bitcoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to cyberfella

Scan to Donate Bitcoin Cash to cyberfella
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to cyberfella

Scan to Donate Ethereum to cyberfella
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to cyberfella

Scan to Donate Litecoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to cyberfella

Scan to Donate Monero to cyberfella
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to cyberfella

Scan to Donate ZCash to cyberfella
Scan the QR code or copy the address below into your wallet to send some ZCash:

Mounting an .iso image in Linux

Mounting an ISO image as a filesystem in Linux

mkdir -p /mnt/isofile

mount -o loop isofile.iso /mnt/isofile

or

mount -t iso9660 -o loop isofile.iso /mnt/isofile

Did you like this?
Tip cyberfella with Cryptocurrency

Donate Bitcoin to cyberfella

Scan to Donate Bitcoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to cyberfella

Scan to Donate Bitcoin Cash to cyberfella
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to cyberfella

Scan to Donate Ethereum to cyberfella
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to cyberfella

Scan to Donate Litecoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to cyberfella

Scan to Donate Monero to cyberfella
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to cyberfella

Scan to Donate ZCash to cyberfella
Scan the QR code or copy the address below into your wallet to send some ZCash:

Monitoring

How long has the system been up?

uptime

What architecture is the system?

arch

Create a list of useful configuration information for this system

sosreport –list -list plugins

e.g. bootloader  apache  kernel  hardware  memory  samba etc

Display kernel boot messages

dmesg       (/var/log/dmesg)

Display last logged on users

last -x

Read the system log (syslog)

/var/log/messages

Display all kernel information

uname -a

Display release numbers

/etc/lsb-release.d      /etc/redhat-release

Check SNMP is working if HP Systems Management is installed

snmpwalk -v1 -c community_string localhost enterprises | grep -i dl

Did you like this?
Tip cyberfella with Cryptocurrency

Donate Bitcoin to cyberfella

Scan to Donate Bitcoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to cyberfella

Scan to Donate Bitcoin Cash to cyberfella
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to cyberfella

Scan to Donate Ethereum to cyberfella
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to cyberfella

Scan to Donate Litecoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to cyberfella

Scan to Donate Monero to cyberfella
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to cyberfella

Scan to Donate ZCash to cyberfella
Scan the QR code or copy the address below into your wallet to send some ZCash:

Logical Volume Management

Logical volume management on Linux is a different way of using available disks (block devices), allowing for more flexible allocation of space on filesystems stored on one or more disks by grouping disks into volume groups, then creating logical volumes within those volume groups without boundaries.  Filesystems are created on the logical volumes which may use a portion of a disks full capacity, or the capacity of more than one disk.  The only limit is the total space in the volume group which is determined by the sum of the total physical space of all the physical block storage devices in the volume group.

You can add more devices to an existing volume group and even take them away (be careful!).  Volume groups, Logical Volumes in them, and the Filesystems on them can also be extended, resized or removed as necessary.

Scan for block devices that can be used for Logical Volume Management

lvmdiskscan

Display current physical volumes and their LVM Status

pvdisplay

Use block device /dev/hdb for LVM

pvcreate /dev/hdb

This command also takes multiple devicenames in one go, separated by spaces.

Create a volume group consisting of the physical volumes

vgcreate VolGroup01 /dev/hdb

Extend an existing volume group onto the block device just added

vgextend VolGroup00 /dev/hdb

Read the man page on vgextend for all available options.

Create a logical volume within the volume group

lvcreate -L +25G /dev/VolGroup01/LogVol00

Extend existing logical volume into the new unused space in the volume group

lvextend -L +25G /dev/VolGroup00/LogVol00

Expand the filesystem into the new free space in the logical volume.

resize2fs /dev/VolGroup00/LogVol00/

Verify the new size using df

df -kh

Display volume group information

vgdisplay VolGroup01

Display physical volume information

pvdisplay /dev/hdb

Display logical volume information

lvdisplay /dev/VolGroup01/LogVol00

Un-mount the filesystem

umount /filesystem

Check and Fix errors on the filesystem

e2fsck -f /dev/VolGroup01/LogVol00   

or  /dev/mapper/LogVol00

Resize a logical volume

lvresize -L new-size /dev/VolGroup01/LogVol00

Resize a filesystem

resize2fs /dev/mapper/LogVol00

e.g. 1500M or 44G

Did you like this?
Tip cyberfella with Cryptocurrency

Donate Bitcoin to cyberfella

Scan to Donate Bitcoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to cyberfella

Scan to Donate Bitcoin Cash to cyberfella
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to cyberfella

Scan to Donate Ethereum to cyberfella
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to cyberfella

Scan to Donate Litecoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to cyberfella

Scan to Donate Monero to cyberfella
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to cyberfella

Scan to Donate ZCash to cyberfella
Scan the QR code or copy the address below into your wallet to send some ZCash:

Disks and Partitions

List scsi devices

lsscsi

Explore the directory containing SCSI information

ls -F /proc/scsi

Display block devices on the system

ls /sys/block

Display disk devices

fdisk -l

Rescan SCSI bus without reboot

echo ” – – -” > /sys/class/scsi_host/host#/scan

Determine SCSI host value

ls /sys/class/scsi_host

Did you like this?
Tip cyberfella with Cryptocurrency

Donate Bitcoin to cyberfella

Scan to Donate Bitcoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to cyberfella

Scan to Donate Bitcoin Cash to cyberfella
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to cyberfella

Scan to Donate Ethereum to cyberfella
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to cyberfella

Scan to Donate Litecoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to cyberfella

Scan to Donate Monero to cyberfella
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to cyberfella

Scan to Donate ZCash to cyberfella
Scan the QR code or copy the address below into your wallet to send some ZCash:

Process Management Commands

Display load average, top CPU processes (use SHIFT M to sort by memory use).

top

Display a tree of all processes

pstree

Display all processes

ps -aux

Customise ps output to your requirements

ps -eo pid tid class rtprio ni pri stat comm

Find zombied processes

ps -eo pid stat | grep Z

Find processes waiting for disk

ps -eo pid stat | grep D

Trace execution of process

strace

Display free memory

free

Display virtual memory status

vmstat

Display inter-process communication status

ipcs -l or -a

Display names of slab memory in size order

slabtop

Did you like this?
Tip cyberfella with Cryptocurrency

Donate Bitcoin to cyberfella

Scan to Donate Bitcoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to cyberfella

Scan to Donate Bitcoin Cash to cyberfella
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to cyberfella

Scan to Donate Ethereum to cyberfella
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to cyberfella

Scan to Donate Litecoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to cyberfella

Scan to Donate Monero to cyberfella
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to cyberfella

Scan to Donate ZCash to cyberfella
Scan the QR code or copy the address below into your wallet to send some ZCash: