blog.up-link.ro
26Apr/100

How To Change MAC Address in Linux, BSD, Unix

Media Access Control address (MAC address) is a unique identifier assigned to most network adapters or network interface cards (NICs) by the manufacturer for identification, and used in the Media Access Control protocol sub-layer. If assigned by the manufacturer, a MAC address usually encodes the manufacturer's registered identification number. It may also be known as an Ethernet Hardware Address (EHA), hardware address, adapter address, or physical address.

1. Change MAC Address in Linux ( CentOS, Debian, Fedora, RHEL, Slackware, SuSE, Ubuntu )

# ifconfig [interface name] down
# ifconfig [interface name] hw ether [new MAC address]
# ifconfig [interface name] up

Example:

# ifconfig eth0 down
# ifconfig eth0 hw ether 1A:2B:3C:4D:5E:6F
# ifconfig eth0 up

Print This Post Print This Post
25Apr/100

FreeBSD: How To Install and Configure SNMP in FreeBSD

Simple Network Management Protocol (SNMP) is a UDP-based network protocol. It is used in network management systems to monitor network-attached devices for conditions that warrant administrative attention.

1. SNMP installation using ports

Install net-snmp using this commands:

# cd /usr/ports/net-mgmt/net-snmp
# make install clean

net-snmp

2. SNMP basic configuration

Copy the default configuration file to the right location.

Print This Post Print This Post
24Apr/100

FreeBSD: How To Prevent Users from seeing information about processes owned by others

FreeBSD has inbuilt security measure to disallow users to see processes that are being run under another UID to avoid information snooping. To enable this security feature via sysctl, type the following commands:

sysctl security.bsd.see_other_uids=0
sysctl security.bsd.see_other_gids=0

To enable this security feature on boot, add the following lines to /etc/sysctl.conf:

# Hide UID and GID from other users
security.bsd.see_other_gids=0
security.bsd.see_other_uids=0
Print This Post Print This Post
23Apr/100

Bandwidth Monitoring Tools for FreeBSD and Linux: nload

Bandwidth in computer networking refers to the data rate supported by a network connection and it represents the capacity of the connection.

nload is a ncurse based network traffic analyser.
nload allow a system administrator to easily monitor the traffic going on its network. It provide both a graph of incoming and outgoing traffic as well as network data transfer statistics.

Print This Post Print This Post
16Apr/100

How To Set Up a FreeBSD Router – Step-by-Step Tutorial

This tutorial explains how to set up a FreeBSD system that will act as a network router that takes advantage of the ported version of OpenBSD's PF packet filter. A network router is a system that forwards packets from one interface to another.

1. FreeBSD Installation

Install FreeBSD by using this tutorial.

Now that you have FreeBSD installed, lets proceed with the next step.

2. FreeBSD Network Configuration

Open /etc/rc.conf in your favorite editor. You need to add a line for each network card present on the system, for example in our case we'll use two network cards:

Print This Post Print This Post
10Apr/100

How To monitor Apache traffic in real-time with apachetop

Apachetop is a very useful program that displays the stats for Apache in real time. Apachetop can show you how many requests per second are coming in, what files have been accessed and how many times. It can also show you who is hitting the sites and where they are coming from.

1. Installing apachetop

To install apachetop in CentOS, Fedora:

# yum install apachetop

Make sure you have DAG repository enabled.

Print This Post Print This Post
9Apr/100

How To mount ISO images in FreeBSD and Linux

An ISO image is an archive file (disk image) of an optical disc using a conventional ISO (International Organization for Standardization) format. ISO image files typically have a file extension of .ISO.

The name "ISO" is taken from the ISO 9660 file system used with CD-ROM media, but an ISO image can also contain UDF file system because UDF is backward-compatible to ISO 9660.

1. Procedure to mount ISO images under Linux

You can mount an ISO image via the loop device under Linux. It's possible to specify transfer functions using loop device.

Print This Post Print This Post
5Apr/100

How To Set Up VSFTPD virtual users ( Berkeley DB + PAM )

vsftpd is a GPL licensed FTP server for UNIX systems, including Linux and FreeBSD. It is secure, stable and extremely fast.

vsftpd will handle:

  • Virtual IP configurations
  • Virtual users
  • Standalone or inetd operation
  • Powerful per-user configurability
  • Bandwidth throttling
  • Per-source-IP configurability
  • Per-source-IP limits
  • IPv6
  • Encryption support through SSL integration
  • etc...

If you are hosting several web sites, for security reasons, you may want the webmasters to access their own files only.  This article describes how you can install and configure vsftpd to work with virtual users.

A virtual user is a user login which does not exist as a real login on the system in /etc/passwd and /etc/shadow file. Virtual users can therefore be more secure than real users, because a compromised account can only use the FTP server but cannot login to system to use other services such as ssh, telnet or smtp.

Print This Post Print This Post
30Mar/100

How To Backup MySQL databases using a shell script

MySQL is one of the most popular open source database management system for the development of interactive websites.

If your server stores its sensitive data in a MySQL database, you will most definitely want to backup that information so that it can be restored in case of any disaster.

Below is a backup script for MySQL databases (please make sure you will change MYSQL_PASS):

#!/bin/sh
# backup mysql databases shell script
# UNIX LINUX BSD
# by Adi https://blog.up-link.ro
# March 2010

DATE=$(date +%Y-%m-%d)
MYSQL=$(which mysql)
MYSQLDUMP=$(which mysqldump)
MYSQL_USER="root"
MYSQL_PASS="password"
HOSTNAME=$(hostname)
GZIP=$(which gzip)
ARG="-u $MYSQL_USER -p$MYSQL_PASS"
DATABASES=$($MYSQL $ARG -s -e "SHOW DATABASES;")
BACKUP_PATH="/home/backup/$DATE/mysql"

! [ -d $BACKUP_PATH ] && mkdir -p $BACKUP_PATH

for DB in $DATABASES
do
BACKUP_FILE="$BACKUP_PATH/$HOSTNAME-mysql-$DB-$DATE.sql.gz"
$MYSQLDUMP $ARG $DB | $GZIP -9 > $BACKUP_FILE
done

Download the script from here.

Print This Post Print This Post
28Mar/100

FreeBSD: How To Install FreeBSD – FreeBSD 8 Installation Guide

This article is a guide to install FreeBSD 8 using an installation CD/DVD, please make sure you've got a FreeBSD 8 installation CD/DVD.

1.Starting the FreeBSD installation

Start the installation by booting up using the installation disc.

FreeBSD Installation Screenshot 1

FreeBSD Installation Screenshot 1

Press ENTER, the system will start hardware probe process and you will see lots of text messages flying by your screen.
Once the installer has booted up it'll ask you to select the country, system console keymap and the type of installation you want to run. You can use the UP/DOWN arrow key to select and ENTER to continue.

Print This Post Print This Post