linux poison RSS
linux poison Email
0

Configure Routing , NAT and Gateway in Linux

A router is a device that directs network traffic destined for an entirely different network in the right direction. For example, suppose your network is having the IP address range of 192.168.1.0/16 and you also have a different network which has a network addresses in range 192.168.2.0/16 . Note that these are ‘Class C’ network addresses which are sub netted. So for your computer ( on the network 192.168.1.0/16 ) to directly communicate between a computer in the network 192.168.2.0/16, you need a intermediary to direct the traffic to the destination network. This is achieved by a router.

Configuring Linux as a router
Linux can be effectively configured to act as a router between two networks. To activate routing functionality , you enable IP forwarding in Linux. This is how you do this:

# echo “1″ > /proc/sys/net/ipv4/ip_forward

Now you have enabled IP forwarding in Linux. Now make this change persistent across reboots by editing the file /etc/sysctl.conf and entering the following line:

# vi /etc/sysctl.conf
…
net.ipv4.ip_forward = 1
…

Optionally, after editing the above file, you may execute the command :
# sysctl -p

Note: For your linux machine to act as a router, you need two Ethernet cards in your machine or you can also configure a single ethernet card to have multiple IP addresses.

What is a gateway?
Any device which acts as the path to or from your network to another network or the internet is considered to be a gateway. Let me explain this with an example: Suppose your computer, machine_B has an address 192.168.0.5 with default netmask. And another computer (machine_A) with an IP address 192.168.0.1 in your network is connected to the internet using a USB cable modem. Now if you want machine_B to send or recieve data destined for an outside network a.k.a internet, it has to direct it to machine_A first which forwards it to the internet. So machine_A acts as the gateway to the internet. Each machine needs a default gateway to reach machines outside the local network. You can set the gateway in machine_B to point to machine_A as follows:
# route add default gw machine_A

Or if DNS is not configured…

# route add default gw 192.168.0.1

Now you can check if the default gateway is set on machine_B as follows:

# route -n

Note: Additional routes can be set using route command. To make the changes persistent across reboots, you may edit the /etc/sysconfig/static-routes file to show the configured route.

What is NAT ?
Network Address Translation (NAT) is a capability of linux kernel where the source or destination address / port of the packet is altered while in transit.

This is used in situations where multiple machines need to access the internet with only one official IP address available. A common name for this is IP masquerading. With masquerading, your router acts as a OSI layer 3 or layer 4 proxy. In this case, Linux keeps track of the packet(s) journey so that during transmission and recipt of data, the content of the session remains intact. You can easily implement NAT on your gateway machine or router by using Iptables, which I will explain in another post.
Read more
0

Alternate Linux desktops (Window Manager)

Most Linux users are familiar with KDE and GNOME, as both are desktop environments used by most major Linux distributions but there are some really good alternate window manager out there. If you have some old PC with minimum hardware and want to run GUI on it then in this case the list of window manager provided below will definitely help you to chose one ..

XFCE
It is a lightweight desktop environment for Unix operating systems. The main goal is to be fast and light, while being visually attractive and easy to use. It is based on the GTK + toolkit same as GNOME, so if you are Gnome fan, you'll find XFCE very usefull.


Enlightement
Enlightenment is a themeable, fast, flexible, and powerful window manager that is designed to be as configurable as possible in both look and feel. In addition, Enlightenment provides an applet API that provides functionality somewhere between the GNOME applet system and Dock Apps from Afterstep/WindowMaker. The current design aim is for Enlightenment to become a desktop shell..

FVWM-Crystal
FVWM-Crystal aims to create an easy to use, eye-candy but also powerful desktop environment for Linux or other Unix-like operating systems. It uses following programs: FVWM as a window manager and "main core", ROX-Filer as file manager (manages icons on the desktop), xterm, aterm, mrxvt or urxvt as terminal emulators, MPD or XMMS as music players (there's built-in support for controlling these programs), and several other tools for different functions, like setting a wallpaper or making screen shots.


LXDE
"Lightweight X11 Desktop Environment", is an extremely faster, performing and energy saving Linux desktop environment maintained by an international community of developers. It comes with a beautiful interface, multi-language support, standard keyboard short cuts and additional features like tabbed file browsing. LXDE uses less CPU and less RAM. It is especially designed for computers with low hardware specifications like netbooks, mobile internet devices (MIDs) or older computers. LXDE can be installed with distributions like Ubuntu or Debian. Applications running on these systems will run with LXDE. The source code of LXDE is licensed partly under the terms of the General Public License and partly under the LGPL.


IceWM
IceWM is simple and highly configurable. All settings are stored as plain text files on the user's home directory, so it is easy to customize and configure it. You can apply your favorite theme and make it appear Windows Vista, Mac OS X or whatever you want.

Fluxbox
Fluxbox is a windowmanager for X that was based on the Blackbox 0.61.1 code. It is very light on resources and easy to handle but yet full of features to make an easy, and extremely fast, desktop experience. It is built using C++ and licensed under the MIT-License.

Window Maker
Window Maker is an X11 window manager originally designed to provide integration support for the GNUstep  Desktop Environment. In every way possible, it reproduces the elegant look and feel of the NEXTSTEP[tm] user interface. It is fast, feature rich, easy to configure, and easy to use.

Window Maker includes compatibility options which allow it to work with other popular desktop environments, namely GNOME and KDE, and comes with a powerful GUI configuration editor, called WPrefs, which removes the need to edit text-based config files by hand.


AfterStep
AfterStep is a window manager for the Unix X Window System. Originally based on the look and feel of the NeXTStep interface, it provides end users with a consistent, clean, and elegant desktop. The goal of AfterStep development is to provide for flexibility of desktop configuration, improving aestetics, and efficient use of system resources.

Some of the distinguishing features of AfterStep compared to other window managers are its low usage of resources, stability and configurability.

Read more
1

Songbird 1 (Final) Linux Installation on Fedora, Ubuntu and Others

Songbird project is a desktop Web player, a digital jukebox and Web browser mash-up. Like Winamp, it supports extensions and skins feathers.



Like Firefox, it is built from Mozilla, cross-platform and open source.

Installation: 
Fedora Linux:
Provided by Auralvance (Rutgers University)
Updated: 12/6/08 1.0.0 Rev 1
NOTES: For MP3 and other audio licensed playback you must have the full compliment of gstreamer plugins installed (good, bad, ugly, etc) - Check here

Songbird 1.0.0 - Fedora 9 - i386
Songbird 1.0.0 - Fedora 9 - x86_64

Songbird 1.0.0 - Fedora 10 - i386
Songbird 1.0.0 - Fedora 10 - x86_64

After downloading the rpm file, you just need to install the pakage using command :
# rpm -ivh songbird-1.0.0-1.fc9.i386.rpm

Ubuntu Linux (.deb)
Ubuntu Intrepid 32 bits -  1.0.0
Ubuntu Intrepid 64 bits - 1.0.0  

Others
Right-click the downloaded .tar.gz file after you downloaded it from http://getsongbird.com and extract it.

Double-click the file called “songbird” in the newly created folder.

The first time you’ll have to agree to some EULA, it will ask you if you want to scan your pc for music files. It will also suggest some recommended add-ons.

 you move that folder to your home directory and add a launcher for it in your “application -> sound and video” menu.

Go to “system -> preferences -> main menu”, and create a new entry in the sound and video menu. In the command box simply link to the songbird file. If you have the songbird folder in your home directory that would be /home/yourusernamehere/Songbird/songbird. 

Here are some key features of "SongBird":
Play Anything:
· MP3, AAC, OGG, FLAC, WMA, and more. Can you teach Songbird to sing?

Pick Feathers:
· Choose from the two included themes: Rubberducky or Dove. You can even make one yourself.

Control the Flow:
· Play, Pause, Previous, Next, Volume, Mute, Seek, Three Repeat Modes, and Shuffle.

Multi-Task:
· Quickly switch between tasks using the buttons to the right of the dashboard display.

Organize Your Library:
· Filter your collection by Genre, Artist, Album, and Song or Search-As-You-Type.

Scan Your Computer for Music:
· Songbird will find your music and add it to your collection for you.

Super Slim Mini-Mode:
· Use the mini-mode for basic controls while keeping Songbird out of the way.

Multi-Language Support:
· Songbird comes in 39 languages. Be a localizer and see Songbird in your language!

Build Custom Mixes:
· Drag-and-drop songs from the Library or another playlist to your create your own custom mixes.

Make Smart Mixes:
· Criteria-based playlists that are always up-to-date with your current collection.

Dynamic Mixes:
· Get mixes from the Internet and stay up-to-date with the latest updates, downloads, and casts.

Play In Place:
· Songbird plays MP3s without leaving the page.

Play the Web:
· Play web pages as playlists and view any web page as a playlist.

Set Music Watch Folders:
· Tell Songbird to watch a folder for new music and it will automatically add new tracks to your collection

GStreamer:
· We now use GStreamer as our main media playback system, across all platforms - giving us higher performance, better reliability, and a platform for much more media-related functionality in the future.

Improved Album Art Support:
· The album artwork feature now supports drag and drop of images, as well as, toggling between Now Playing and Currently Selected tracks.
Read more
0

MyDNS + MyDNSConfig installation and configuration

MyDNS is a free DNS server for UNIX. It was implemented from scratch and is designed to serve records directly from an SQL database (currently either MySQL or PostgreSQL).

Its primary objectives are stability, security, interoperability, and speed, though not necessarily in that order. MyDNS does not include recursive name service, nor a resolver library. It is primarily designed for organizations with many zones and/or resource records who desire the ability to perform real-time dynamic updates on their DNS data via MySQL.

MyDNS starts and is ready to answer questions immediately, no matter how much DNS data you have in the database. It supports a few frills, including round robin DNS, dynamic load balancing, and outgoing AXFR for non-MyDNS nameservers and is licensed under the GNU General Public License.

Installation:
First make sure you have a working setup of Apache and mysql

Download MyDNSConfig:
# wget http://mesh.dl.sourceforge.net/sourceforge/mydnsconfig/MyDNSConfig-1.1.0.tar.gz
# tar xvfz MyDNSConfig-1.1.0.tar.gz
# cd MyDNSConfig-1.1.0
# mkdir /srv/www/htdocs/mydnsconfig
# cp -rf interface/* /srv/www/htdocs/mydnsconfig

Above "/srv/www/htdocs/" is my web directory


Mysql database setup::
# mysql -u root -p

> CREATE DATABASE mydns;
> GRANT SELECT, INSERT, UPDATE, DELETE ON mydns.* TO 'mydns'@'localhost' IDENTIFIED BY 'mydnspassword';
> GRANT SELECT, INSERT, UPDATE, DELETE ON mydns.* TO 'mydns'@'localhost.localdomain' IDENTIFIED BY 'mydnspassword';
> FLUSH PRIVILEGES;
> quit;

Replace the word mydnspassword in the above commands with a password of your choice.

Install the MyDNSConfig MySQL Database:

# mysql -u root -p mydns < MyDNSConfig-1.1.0/install/mydnsconfig.sql

Edit the MyDNSConfig configuration; please make sure you fill in the correct database settings:
# vi /srv/www/htdocs/mydnsconfig/lib/config.inc.php

$conf["db_type"]        = 'mysql';
$conf["db_host"]        = 'localhost';
$conf["db_database"]        = 'mydns';
$conf["db_user"]        = 'mydns';
$conf["db_password"]        = 'mydnspassword';

Installing MyDNS
# wget http://mydns.bboy.net/download/mydns-mysql-1.1.0-1.i386.rpm
# rpm -ivh mydns-mysql-1.1.0-1.i386.rpm

Open the MyDNS configuration file /etc/mydns.conf, fill in the correct database details, allow zone transfers by setting allow-axfr to yes, enable TCP (allow-tcp = yes), and specify a recursive resolver (i.e., a valid nameserver, e.g. from your ISP; e.g. recursive = 213.191.92.86) so that MyDNS can answer queries for domains that it isn't authoritative for:

# vi /etc/mydns.conf

Finally start the mydns server
# /etc/init.d/mydns start

To log in to the MyDNSConfig interface, open a web browser and enter enter the following URL:

http:///mydnsconfig/

Replace with the IP address of your server.

The default username and password of MyDNSConfig are:

Username: admin
Password: admin
Read more
2

Configuring sudo and adding users to Wheel group

If a server needs to be administered by a number of people it is normally not a good idea for them all to use the root account. This is because it becomes difficult to determine exactly who did what, when and where if everyone logs in with the same credentials. The sudo utility was designed to overcome this difficulty.

With sudo (which stands for "superuser do"), you can delegate a limited set of administrative responsibilities to other users, who are strictly limited to the commands you allow them. sudo creates a thorough audit trail, so everything users do gets logged; if users somehow manage to do something they shouldn't have, you'll be able to detect it and apply the needed fixes. You can even configure sudo centrally, so its permissions apply to several hosts.

The privileged command you want to run must first begin with the word sudo followed by the command's regular syntax. When running the command with the sudo prefix, you will be prompted for your regular password before it is executed. You may run other privileged commands using sudo within a five-minute period without being re-prompted for a password. All commands run as sudo are logged in the log file /var/log/messages.


The sudo configuration file is /etc/sudoers. We should never edit this file manually. Instead, use the visudo command:  # visudo

This protects from conflicts (when two admins edit this file at the same time) and guarantees that the right syntax is used (the permission bits are correct). The program uses Vi text editor.

All Access to Specific Users
You can grant users bob and bunny full access to all privileged commands, with this sudoers entry.
user1, user2  ALL=(ALL) ALL
This is generally not a good idea because this allows user1 and user2 to use the su command to grant themselves permanent root privileges thereby bypassing the command logging features of sudo.

Access To Specific Users To Specific Files
This entry allows user1 and all the members of the group operator to gain access to all the program files in the /sbin and /usr/sbin directories, plus the privilege of running the command /usr/apps/check.pl.
user1, %operator ALL= /sbin/, /usr/sbin, /usr/apps/check.pl

Access to Specific Files as Another User
user1 ALL=(accounts) /bin/kill, /usr/bin/kill, /usr/bin/pkill

Access Without Needing Passwords
This example allows all users in the group operator to execute all the commands in the /sbin directory without the need for entering a password.
%operator ALL= NOPASSWD: /sbin/

Adding users to the wheel group
The wheel group is a legacy from UNIX. When a server had to be maintained at a higher level than the day-to-day system administrator, root rights were often required. The 'wheel' group was used to create a pool of user accounts that were allowed to get that level of access to the server. If you weren't in the 'wheel' group, you were denied access to root.

Edit the configuration file (/etc/sudoers) with visudo and change these lines:
# Uncomment to allow people in group wheel to run all commands
# %wheel ALL=(ALL) ALL

To this (as recommended):

# Uncomment to allow people in group wheel to run all commands
%wheel ALL=(ALL) ALL

This will allow anyone in the wheel group to execute commands using sudo (rather than having to add each person one by one).

Now finally use the following command to add any user (e.g- user1) to Wheel group
# usermod -G10 user1

Read more
Related Posts with Thumbnails