blog.up-link.ro
5Aug/110

Linux: How to retrieve and change partition`s UUID

A Universally Unique Identifier (UUID) is an identifier standard used in software construction, standardized by the Open Software Foundation (OSF) as part of the Distributed Computing Environment (DCE).

How to retrieve UUID

On some unix systems a hard drives partition is referred by to as UUID instead of the location of the it relevant block device file for example like in /etc/fstab:

UUID=03136e34-6187-4720-8594-b27508ef978f /boot ext3 defaults,noatime 1 2

In this case it would be harder to find which partition is mounted behind /boot. Here are some ways how to retrieve relevant partition UUID.

Print This Post Print This Post
30Jul/110

FreeBSD: How To Enable ccache on FreeBSD 8.2

ccache is a software development tool that caches the output of C/C++ compilation so that the next time, the same compilation can be avoided and the results can be taken from the cache. This can greatly speed up recompiling time.

The following is a step by step guide to how to enable and use ccache on FreeBSD 8.2.

Install ccache by running the following command:

make install clean -C /usr/ports/devel/ccache
Print This Post Print This Post
29Jul/110

FreeBSD: How To Rename Network Interfaces

To rename a network interface under FreeBSD, invoke ifconfig command as root:

ifconfig bge1 name net1

Observe that the interface formerly known as bge1 is now net1. To keep the change after reboot, add the following lines to /etc/rc.conf:

ifconfig_bge1_name="net1"
ifconfig_net1="inet 192.168.0.1 netmask 255.255.255.0"

Print This Post Print This Post
28Jul/110

How To Add a nullroute (blackhole filtering)

In computer networking, a null route or blackhole route is a network route that goes nowhere. Matching packets are dropped (ignored) rather than forwarded, acting as a kind of very limited firewall. The act of using null routes is often called blackhole filtering.

Null routing has an advantage over classical firewalls since it is available on every potential network router (including all modern operating systems), and adds virtually no performance impact. Due to the nature of high-bandwidth routers, null routing can often sustain higher throughput than conventional firewalls. For this reason, null routes are often used on high-performance core routers to mitigate large-scale denial-of-service attacks before the packets reach a bottleneck, thus avoiding collateral damage from DDoS attacks — although the target of the attack will be inaccessible to anyone.

Print This Post Print This Post
23Jun/110

How To Enable Two-factor SSH authentication via Google Authenticator

In this tutorial I'll show you how to set up two-factor authentication for SSH using Google Authenticator. Two-factor authentication is where you authenticate to a service (SSH in our case) with two pieces of information: one you know, and one you don't. The information you know is your password (which can be stolen) while the information you don't know is a randomly-generated PIN number that changes every few seconds. So even if your password is stolen, unless an attacker has the means to get the right PIN (tied to a hardware device), they cannot log into the protected service.

Print This Post Print This Post
15May/110

FreeBSD: How To Install FreeBSD 8.x from USB Flash Drive

FreeBSD 8 can be installed from a USB memory stick. The required files can be downloaded via FTP:

i386: ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/ISO-IMAGES/8.2/FreeBSD-8.2-RELEASE-amd64-memstick.img
amd64: ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/ISO-IMAGES/8.2/FreeBSD-8.2-RELEASE-amd64-memstick.img

Insert the USB drive into the computer running Linux/FreeBSD and make sure it gets detect by the Kernel. You can check if the USB device got detect or not by running the following command:

dmesg
Print This Post Print This Post
31Dec/100

Linux: How To Create a USB Debian Installation Flash Drive

In this tutorial I'll show you how to create a USB drive which can be used as an installation media to install Debian Linux.

You will need a computer which is already running Linux and a USB flash drive of size at least 256 MB which we will prepare as our installation media.

Insert the USB drive into the computer running Linux and make sure it gets detect by the Linux Kernel. You can check if the USB device got detect or not by running the following command:

dmesg

and you should see something like this:

[143981.321725] sd 8:0:0:0: [sdb] .321725 512-byte hardware sectors (1024 MB)
[143981.522718] sd 8:0:0:0: [sdb] Write Protect is off
....
[143981.522719] sd 8:0:0:0: [sdb] Attached SCSI disk

Print This Post Print This Post
17Nov/100

How To Install QEMU under FreeBSD 8.1 as Host OS

QEMU is a processor emulator that relies on dynamic binary translation to achieve a reasonable speed while being easy to port on new host CPU architectures.
When used as a machine emulator, QEMU can run Operating Systems and programs made for one machine on a different machine. By using dynamic translation, it achieves very good performance.
When used as a virtualizer, QEMU achieves near native performances by executing the guest code directly on the host CPU.

1. Install QEMU

To install QEMU under FreeBSD, enter:

make install clean -C /usr/ports/emulators/qemu

Install QEMU with options showed in the following image:

Print This Post Print This Post
27Oct/100

How To Monitor Network Traffic by Process under Linux

NetHogs is a small network monitoring tool. Instead of breaking the traffic down per protocol or per subnet, like most tools do, it groups bandwidth by process. NetHogs does not rely on a special kernel module to be loaded. If there's suddenly a lot of network traffic, you can fire up NetHogs and immediately see which process is causing this. This makes it easy to indentify programs that have gone wild and are suddenly taking up your bandwidth.

To install NetHogs under CentOS, Fedora, RHEL, enter:

yum install nethogs

To install NetHogs under Debian and Ubuntu, enter:

apt-get install nethogs

The default network interface to monitor is eth0. If you wish to use other device, simply type the argument after nethog, open the terminal and run the following command:

Print This Post Print This Post
17Oct/100

UNIX Tools: mytop – MySQL Monitoring Tool

MyTop is a console-based tool for monitoring the threads and overall performance of a MySQL server. It runs on most Unix systems. MyTop is a top clone for MySQL Server.

To install MyTop under FreeBSD, enter:

make install clean -C /usr/ports/databases/mytop

To install MyTop under CentOS, Fedora, RHEL, enter:

yum install mytop

To install MyTop under Debian, Ubuntu, enter:

sudo apt-get install mytop

Print This Post Print This Post