15 Useful “ifconfig” Commands to Configure Network Interface

ifconfig in short “interface configuration” utility for system/network administration in Unix/Linux operating systems to configure, manage and query network interface parameters via command line interface or in a system configuration scripts.

The “ifconfig” command is used for displaying current network configuration information, setting up an ip address, netmask or broadcast address to an network interface, creating an alias for network interface, setting up hardware address and enable or disable network interfaces.

 

1. View All Network Setting

The “ifconfig” command with no arguments will display all the active interfaces details. The ifconfig command also used to check the assigned IP address of an server.

[root@tecmint ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0B:CD:1C:18:5A
inet addr:172.16.25.126  Bcast:172.16.25.63  Mask:255.255.255.224
inet6 addr: fe80::20b:cdff:fe1c:185a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:2341604 errors:0 dropped:0 overruns:0 frame:0
TX packets:2217673 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:293460932 (279.8 MiB)  TX bytes:1042006549 (993.7 MiB)
Interrupt:185 Memory:f7fe0000-f7ff0000
lo        Link encap:Local Loopback
inet addr:127.0.0.1  Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING  MTU:16436  Metric:1
RX packets:5019066 errors:0 dropped:0 overruns:0 frame:0
TX packets:5019066 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2174522634 (2.0 GiB)  TX bytes:2174522634 (2.0 GiB)
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.1.1.1  P-t-P:10.1.1.2  Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

2. Display Information of All Network Interfaces

The following ifconfig command with -a argument will display information of all active or inactive network interfaces on server. It displays the results for eth0, lo, sit0 and tun0.

[root@tecmint ~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:0B:CD:1C:18:5A
inet addr:172.16.25.126  Bcast:172.16.25.63  Mask:255.255.255.224
inet6 addr: fe80::20b:cdff:fe1c:185a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:2344927 errors:0 dropped:0 overruns:0 frame:0
TX packets:2220777 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:293839516 (280.2 MiB)  TX bytes:1043722206 (995.3 MiB)
Interrupt:185 Memory:f7fe0000-f7ff0000
lo        Link encap:Local Loopback
inet addr:127.0.0.1  Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING  MTU:16436  Metric:1
RX packets:5022927 errors:0 dropped:0 overruns:0 frame:0
TX packets:5022927 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2175739488 (2.0 GiB)  TX bytes:2175739488 (2.0 GiB)
sit0      Link encap:IPv6-in-IPv4
NOARP  MTU:1480  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.1.1.1  P-t-P:10.1.1.2  Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

3. View Network Settings of Specific Interface

Using interface name (eth0) as an argument with “ifconfig” command will display details of specific network interface.

[root@tecmint ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0B:CD:1C:18:5A
inet addr:172.16.25.126  Bcast:172.16.25.63  Mask:255.255.255.224
inet6 addr: fe80::20b:cdff:fe1c:185a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:2345583 errors:0 dropped:0 overruns:0 frame:0
TX packets:2221421 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:293912265 (280.2 MiB)  TX bytes:1044100408 (995.7 MiB)
Interrupt:185 Memory:f7fe0000-f7ff0000

4. How to Enable an Network Interface

The “up” or “ifup” flag with interface name (eth0) activates an network interface, if it is not in active state and allowing to send and receive information. For example, “ifconfig eth0 up” or “ifup eth0” will activate the eth0 interface.

[root@tecmint ~]# ifconfig eth0 up
OR
[root@tecmint ~]# ifup eth0

5. How to Disable an Network Interface

The “down” or “ifdown” flag with interface name (eth0) deactivates the specified network interface. For example, “ifconfig eth0 down” or “ifdown eth0” command deactivates the eth0 interface, if it is in active state.

[root@tecmint ~]# ifconfig eth0 down
OR
[root@tecmint ~]# ifdown eth0

6. How to Assign a IP Address to Network Interface

To assign an IP address to an specific interface, use the following command with an interface name (eth0) and ip address that you want to set. For example, “ifconfig eth0 172.16.25.125” will set the IP address to interface eth0.

[root@tecmint ~]# ifconfig eth0 172.16.25.125

7. How to Assign a Netmask to Network Interface

Using the “ifconfig” command with “netmask” argument and interface name as (eth0) allows you to define an netmask to an given interface. For example, “ifconfig eth0 netmask 255.255.255.224” will set the network mask to an given interface eth0.

[root@tecmint ~]# ifconfig eth0 netmask 255.255.255.224

8. How to Assign a Broadcast to Network Interface

Using the “broadcast” argument with an interface name will set the broadcast address for the given interface. For example, “ifconfig eth0 broadcast 172.16.25.63” command sets the broadcast address to an interface eth0.

[root@tecmint ~]# ifconfig eth0 broadcast 172.16.25.63

9. How to Assign a IP, Netmask and Broadcast to Network Interface

To assign an IP address, Netmask address and Broadcast address all at once using “ifconfig” command with all arguments as given below.

[root@tecmint ~]# ifconfig eth0 172.16.25.125 netmask 255.255.255.224 broadcast 172.16.25.63

10. How to Change MTU for an Network Interface

The “mtu” argument set the maximum transmission unit to an interface. The MTU allows you to set the limit size of packets that are transmitted on an interface. The MTU able to handle maximum number of octets to an interface in one single transaction. For example, “ifconfig eth0 mtu 1000” will set the maximum transmission unit to given set (i.e. 1000). Not all network interfaces supports MTU settings.

[root@tecmint ~]# ifconfig eth0 mtu 1000

11. How to Enable Promiscuous Mode

What happens in normal mode, when a packet received by a network card, it verifies that the packet belongs to itself. If not, it drops the packet normally, but in the promiscuous mode is used to accept all the packets that flows through the network card.

Most of the today’s network tools uses the promiscuous mode to capture and analyze the packets that flows through the network interface. To set the promiscuous mode, use the following command.

[root@tecmint ~]# ifconfig eth0 promisc

12. How to Disable Promiscuous Mode

To disable promiscuous mode, use the “-promisc” switch that drops back the network interface in normal mode.

[root@tecmint ~]# ifconfig eth0 -promisc

13. How to Add New Alias to Network Interface

The ifconfig utility allows you to configure additional network interfaces using alias feature. To add alias network interface of eth0, use the following command. Please note that alias network address in same sub-net mask. For example, if your eth0 network ip address is 172.16.25.125, then alias ip address must be 172.16.25.127.

[root@tecmint ~]# ifconfig eth0:0 172.16.25.127

Next, verify the newly created alias network interface address, by using “ifconfig eth0:0” command.

[root@tecmint ~]# ifconfig eth0:0
eth0:0    Link encap:Ethernet  HWaddr 00:01:6C:99:14:68
inet addr:172.16.25.123  Bcast:172.16.25.63  Mask:255.255.255.240
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
Interrupt:17

14. How to Remove Alias to Network Interface

If you no longer required an alias network interface or you incorrectly configured it, you can remove it by using the following command.

[root@tecmint ~]# ifconfig eth0:0 down

15. How to Change the MAC address of Network Interface

To change the MAC (Media Access Control) address of an eth0 network interface, use the following command with argument “hw ether“. For example, see below.

[root@tecmint ~]# ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF

These are the most useful commands for configuring network interfaces in Linux, for more information and usage of ifconfig command use the manpages like “man ifconfig” at the terminal. Check out some other networking utilities below.

Easy Samba server installation on CentOS 6.5

Easy Samba server installation on CentOS 6.5

Security issue
# vim /etc/sysconfig/selinux

Show All Users on your samba server
    [root@localhost ~]# tail /etc/passwd

Block certain file extensions on samba linux

comment = vishalvyas
Path = /home/vishal
public = yes
writable = yes
browseable = yes
read only = no
valid user = vishal
create mask = 0775
Veto files = /*.exe/*.com/*.dll/*.bat/*.vbs/*.tmp/*.mp3/*.avi/*.mp4/*.wmv/*.wma/

Enable or Disable SELinux

Important

Changes you make to files while SELinux is disabled may give them an unexpected security label, and new files will not have a label. You may need to relabel part or all of the file system after re-enabling SELinux.

From the command line, you can edit the /etc/sysconfig/selinux file. This file is a symlink to/etc/selinux/config. The configuration file is self-explanatory. Changing the value of SELINUX or SELINUXTYPEchanges the state of SELinux and the name of the policy to be used the next time the system boots.

[root@host2a ~]# vim /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=permissive
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0
Changing the Mode of SELinux Using the GUI

Use the following procedure to change the mode of SELinux using the GUI.

Note

You need administrator privileges to perform this procedure.

  1. On the System menu, point to Administration and then click Security Level and Firewall to display the Security Level Configuration dialog box.
  2. Click the SELinux tab.
  3. In the SELinux Setting select either Disabled, Enforcing or Permissive, and then click OK.
  4. If you changed from Enabled to Disabled or vice versa, you need to restart the machine for the change to take effect.

Changes made using this dialog box are immediately reflected in /etc/sysconfig/selinux.

How To Install – Apache, MySQL, PHP (LAMP) stack On CentOS 6

About LAMP

LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the server is already running CentOS, the linux part is taken care of. Here is how to install the rest.

Set Up

The steps in this tutorial require the user on the virtual private server to have root privileges. You can see how to set that up in the Initial Server Setup Tutorial in steps 3 and 4.

Step One—Install Apache

Apache is a free open source software which runs over 50% of the world’s web servers.

To install apache, open terminal and type in this command:

sudo yum install httpd

Once it installs, you can start apache running on your VPS:

sudo service httpd start

That’s it. To check if Apache is installed, direct your browser to your server’s IP address (eg. http://12.34.56.789). The page should display the words “It works!” like this.

How to find your Server’s IP address

You can run the following command to reveal your server’s IP address.

ifconfig eth0 | grep inet | awk '{ print $2 }'

Step Two—Install MySQL

MySQL is a powerful database management system used for organizing and retrieving data on a virtual server

To install MySQL, open terminal and type in these commands:

sudo yum install mysql-server
sudo service mysqld start

During the installation, MySQL will ask you for your permission twice. After you say Yes to both, MySQL will install.

Once it is done installing, you can set a root MySQL password:

sudo /usr/bin/mysql_secure_installation

The prompt will ask you for your current root password.

Since you just installed MySQL, you most likely won’t have one, so leave it blank by pressing enter.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Then the prompt will ask you if you want to set a root password. Go ahead and choose Y and follow the instructions.

CentOS automates the process of setting up MySQL, asking you a series of yes or no questions.

It’s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y                                            
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Step Three—Install PHP

PHP is an open source web scripting language that is widely used to build dynamic webpages.

To install PHP on your virtual private server, open terminal and type in this command:

sudo yum install php php-mysql

Once you answer yes to the PHP prompt, PHP will be installed.

PHP Modules

PHP also has a variety of useful libraries and modules that you can add onto your server. You can see the libraries that are available by typing:

yum search php-

Terminal then will display the list of possible modules. The beginning looks like this:

php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
php-cli.x86_64 : Command-line interface for PHP
php-common.x86_64 : Common files for PHP
php-dba.x86_64 : A database abstraction layer module for PHP applications
php-devel.x86_64 : Files needed for building PHP extensions
php-embedded.x86_64 : PHP library for embedding in applications
php-enchant.x86_64 : Human Language and Character Encoding Support
php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-imap.x86_64 : A module for PHP applications that use IMAP

To see more details about what each module does, type the following command into terminal, replacing the name of the module with whatever library you want to learn about.

yum info name of the module

Once you decide to install the module, type:

sudo yum install name of the module

You can install multiple libraries at once by separating the name of each module with a space.

Congratulations! You now have LAMP stack on your droplet!

We should also set the processes to run automatically when the server boots (php will run automatically once Apache starts):

sudo chkconfig httpd on
sudo chkconfig mysqld on

Step Four—RESULTS: See PHP on your Server

Although LAMP is installed on your virtual server, we can still take a look and see the components online by creating a quick php info page

To set this up, first create a new file:

sudo nano /var/www/html/info.php

Add in the following line:

<?php
phpinfo();
?>

Then Save and Exit.

Restart apache so that all of the changes take effect on your virtual server:

sudo service httpd restart

Finish up by visiting your php info page (make sure you replace the example ip address with your correct one):

http://12.34.56.789/info.php

It should look similar to ♥♥♣♠

How to Install Webmin on CentOS/RHEL 7/6/5 and Fedora 21/20

Webmin is a web-based interface for managing Unix like systems. Its provides options to setup user accounts, Apache, DNS, file sharing and much more. All recent versions of Webmin are under a BSD-like license.

webmin-large-image

This article will help you to install and configure Webmin on CentOS, RHEL and Fedora systems. Kindly go through below steps. At the time of last update of this article Webmin 1.730is the latest available version to download and install. Continue reading

Install Ubuntu 14.04.2 LTS

Using a DVD?

It’s easy to install Ubuntu from a DVD. Here’s what you need to do:

Put the Ubuntu DVD into the DVD-drive

Restart your computer. You should see a welcome screen prompting you to choose your language and giving you the option to install Ubuntu or try it from the DVD.

If you don’t get this menu, read the booting from the DVDguide for more information.

Using a USB drive?

Most newer computers can boot from USB. You should see a welcome screen prompting you to choose your language and giving you the option to install Ubuntu or try it from the CD.

If your computer doesn’t automatically do so, you might need to press the F12 key to bring up the boot menu, but be careful not to hold it down – that can cause an error message.

  1. Prepare to install Ubuntu

    • We recommend you plug your computer into a power source
    • You should also make sure you have enough space on your computer to install Ubuntu
    • We advise you to select Download updates while installing and Install this third-party software now
    • You should also stay connected to the internet so you can get the latest updates while you install Ubuntu
    • If you’re not connected to the internet, we’ll help you set up wireless at the next step
  2. 3

    Set up wireless

    If you are not connected to the internet, you will be asked to select a wireless network, if available. We advise you to connect during the installation so we can ensure your machine is up to date. So, if you set up your wireless network at this point, it’s worth then clicking the Back button to go back to the last screen (Preparing to install Ubuntu) and ticking the box marked ’Download updates while installing’.

  3. 4

    Allocate drive space

    Use the checkboxes to choose whether you’d like to Install Ubuntu alongside another operating system, delete your existing operating system and replace it with Ubuntu, or — if you’re an advanced user — choose the ’Something else’option

  4. 5

    Begin the installation

    Depending on your previous selections, you can now verify that you have chosen the way in which you would like to install Ubuntu. The installation process will begin when you click the Install Now button.

    Ubuntu needs about 4.5 GB to install, so add a few extra GB to allow for your files.

  5. 6

    Select your location

    If you are connected to the internet, this should be done automatically. Check your location is correct and click’Forward’ to proceed. If you’re unsure of your time zone, type the name of the town you’re in or click on the map and we’ll help you find it.

    TIP: If you’re having problems connecting to the Internet, use the menu in the top-right-hand corner to select a network.

  6. 7

    Select your preferred keyboard layout

    Click on the language option you need. If you’re not sure, click the ’Detect Keyboard Layout’ button for help.

  7. 8

    Enter your login and password details

  8. 9

    Learn more about Ubuntu while
    the system installs…

    …or make a cup of tea!

  9. 10

    That’s it.

    All that’s left is to restart your computer and start enjoying Ubuntu!

Installing and configuring samba on centOS

Samba is free software mainly used for file sharing between other platforms ( Windows ) using  SMB/CIFS protocol .Default centos 6 installation will not include samba packages , you need install manually .Here we can see how to install and configure samba using yum.

Step 1 » Update yum repositories and packages by typing the below command

 

[root@localhost ~]# rpm -qa | grep samba

[root@localhost ~]# yum update

Step 2 » Install samba packages along with dependencies using yum

[root@localhost ~]# yum install samba

Samba configuration :

Step 3 » Create a share username and password & Group

[root@localhost ~]# adduser shareuser

Now create samba password for username shareuser using smbpasswd command .


[root@localhost ~]# smbpasswd -a shareuser
New SMB password:****
Retype new SMB password:****
Added user shareuser.

[root@Fileserver ~]# tail /etc/passwd

[root@Fileserver ~]# groupadd sambauser

[root@Fileserver ~]# gpasswd -M IT,fashion sambauser

[root@Fileserver ~]# chgrp sambauser /home/samba

[root@Fileserver ~]# chmod 2770 /home/samba -R

Step 4 »  Create a folder called share in the root directory .

[root@localhost ~]# mkdir /share -p

and change the ownership for the share folder

[root@localhost ~]# chown -R shareuser:root /share/

Step 5 »  open the file /etc/samba/smb.conf . ( Before editing the file , please copy the file to another location for backup ) . Add the below lines at the bottom of the file .

Open up /etc/samba/smb.conf and add the following lines to each share:

veto files = /._*/.DS_Store/*.exe/*.com/*.dll/*.bat/*.vbs/*.tmp/*.mp3/
delete veto files = yes

[root@localhost ~]# chmod 2770 /home/samba -R


[root@localhost ~]# vim /etc/samba/smb.conf
[share]
comment = insert any comments here
path = /share
public = no
printable = no
writable = yes
valid users = shareuser
write list = shareuser
invalid users = admin
create mask = 0765
Veto files = /*.exe/*.com/*.dll/*.bat/*.vbs/*.tmp/*.mp3/

Step 6 » start samba service


[root@localhost ~]# service smb start

and type this below command to start samba service automatically while booting.


[root@localhost ~]# chkconfig --levels 235 smb on

Samba testing :

Step 7 » You can check  your configuration by using testparm command


[root@localhost ~]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[share]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
cups options = raw
[homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
printable = Yes
browseable = No
[share]
comment = Share
path = /share
valid users = shareuser
read only = No

You can see your share sections. Here by default home folders of users will be displayed . you can comment the unwanted section using “;” symbol .

For example . you can comment homes section as below and restart the service using  “service smb restart”


[root@localhost ~]# service smb restart
[root@localhost ~]# chkconfig smb on
[root@localhost ~]# service nmb restart
[root@localhost ~]# chkconfig nmb on

Step 7 » Firewall Disable & selinux OFF


[root@localhost ~]# service iptables stop
[root@localhost ~]# getenforce 0

;[homes]
;comment = Home Directories
;read only = No
;browseable = No

Now you can access share folder on windows machine by typing \samba-server-ip on run prompt . you can see your share folder after entering username and password.

Show All Users on your samba server


[root@localhost ~]# tail /etc/passwd

Cheers ..

Vim OR Vi Editor

Hit the Esc key; that goes into command mode. Then you can type

  • :q to quit (short for :quit)
  • :q! to quit without saving (short for :quit!)
  • :wq to write and quit (think write and quit)
  • :x to write and quit (shorter than :wq)
  • :qa to quit all (short for :quitall)

When you press :, a : will appear at the bottom of the screen.

Or you can press Esc ZZ (Esc Shift+Z Shift+Z) to write/save if the file was changed, then quit.

Or if you don’t want to save changes you can use ZQ instead.

Vim has extensive help, so type Esc:helpReturn and you will have all your answers and even a neat tutorial.

MAIL Server

Mail Server Configuration Details on Linux

# fdisk -l
# mount -t vfat /dev/sdb1 /mnt/

==============================
MAIL Server
==============================

# vi /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.1.50
netmask 255.255.255.0
gateway 192.168.1.1

:x!

# vi /etc/resolv.conf

nameserver 202.84.32.22
nameserver 202.84.33.20

# /etc/init.d/networking restart

# vi /etc/apt/sources.list

Source List:

deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main

deb http://cdn.debian.net/debian/ stable main contrib
deb http://security.debian.org/ stable/updates main

deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

deb http://cdn.debian.net/debian/ squeeze-updates main
deb-src http://cdn.debian.net/debian/ squeeze-updates main

# apt-get update

# apt-get install vim telnet traceroute iftop iptraf gcc g++ cpp libgmp3-dev zip file tnef make patch zlib1g-dev

# apt-get install postfix

Internet with Smarthost

# vim /etc/postfix/main.cf

myhostname = mail.example.com
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
myorigin = daytexbd.com
mydestination = mail.example.com, mail, localhost.localdomain, localhost, hash:/etc/postfix/transport
#relayhost =
mynetworks = 127.0.0.0/8, 192.168.1.0/24, 202.84.40.5/32
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
transport_maps = hash:/etc/postfix/transport

# touch /etc/postfix/aliases
# postalias /etc/postfix/aliases
# vim /etc/postfix/transport

example.com local:
.example.com local:

# postmap /etc/postfix/transport
# /etc/init.d/postfix restart

# apt-get install dovecot-imapd dovecot-pop3d dovecot-common
# vim /etc/dovecot/dovecot.conf

protocols = imap imaps pop3 pop3s
ssl_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
ssl_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
disable_plaintext_auth = no
pop3_uidl_format = %08Xu%08Xv
mail_location = mbox:~/mail:INBOX=/var/mail/%u

# /etc/init.d/dovecot restart

# adduser omar

—————–
testing postfix
—————–

C:>telnet 192.168.1.1 25
220 mail.example.com ESMTP Postfix (Debian/GNU)
ehlo 192.168.1.1
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<omar@example.com>
rcpt to:<omar@example.com>
data
Its working!
.

quit
221 2.0.0 Bye

—————–
testing dovecot
—————–

C:>telnet 192.168.1.1 110
+OK Dovecot ready.
user bolcorp
+OK
pass b0lc0rp
+OK Logged in.
list
+OK 0 messages:
.
quit
+OK Logging out.

———————-
SASL Auth with smtps
———————-

# vim /etc/postfix/master.cf

#smtp inet n – – – – smtpd
smtps inet n – – – – smtpd
-o smtpd_sasl_auth_enable=yes

# vim /etc/postfix/main.cf

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
broken_sasl_auth_clients = yes
smtpd_sender_restrictions = permit_sasl_authenticated
smtpd_sasl_local_domain = example.com
smtpd_sasl_security_options = noanonymous
smtpd_helo_required = yes
smtpd_sasl_authenticated_header = yes

# vim /etc/dovecot/dovecot.conf

auth default {
mechanisms = plain login
passdb pam {
}
userdb passwd {
}
socket listen {
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}

——————————————–
Openwebmail Installation and Configuration
——————————————–

# apt-get install apache2
# wget http://www.openwebmail.org/openwebmail/download/current/openwebmail-current.tar.gz
# tar -zxvf openwebmail-current.tar.gz
# cp -R cgi-bin/openwebmail /usr/lib/cgi-bin/
# cd data/
# mv openwebmail /var/www
# vim /usr/lib/cgi-bin/openwebmail/etc/openwebmail.conf

domainnames example.com
auth_module auth_unix.pl
mailspooldir /var/mail
ow_cgidir /usr/lib/cgi-bin/openwebmail
ow_cgiurl /cgi-bin/openwebmail
ow_htmldir /var/www/openwebmail
ow_htmlurl /openwebmail
logfile /var/log/openwebmail.log

# vim /usr/lib/cgi-bin/openwebmail/etc/defaults/auth_unix.conf

passwdfile_encrypted /etc/shadow
passwdmkdb none

# vim /usr/lib/cgi-bin/openwebmail/etc/defaults/dbm.conf

dbm_ext .pag
dbmopen_ext none
dbmopen_haslock no

# apt-get install perl-suid libhtml-template-perl
# cd /usr/lib/cgi-bin/openwebmail
# chmod 4555 *.pl
# cd /var/www
# chown -R www-data:www-data openwebmail
# cd /usr/lib/cgi-bin/openwebmail/etc/
# chmod 777 sessions
# cd /usr/lib/cgi-bin/openwebmail
# ./openwebmail-tool.pl –init
# cd /var/www/openwebmail
# cp redirect.html index.html

Installation is complete. Now type this address to login to the web page.

http://***.***.***.***/openwebmail/

To get the webmail page in root web page

# cp /var/www/openwebmail/redirect.html /var/www/index.html

———————————————
Squirrelmail Installation and Configuration
———————————————

# apt-get install apache2
# wget http://squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fprdownloads.sourceforge.net%2Fsquirrelmail%2Fsquirrelmail-webmail-1.4.22.tar.gz
# mv countdl.ph……………..mail%2Fsquirrelmail-webmail-1.4.22.tar.gz squirrelmail-webmail-1.4.22.tar.gz
# tar -zxvf squirrelmail-webmail-1.4.22.tar.gz
# mkdir /var/www/webmail
# cd squirrelmail-webmail-1.4.22/
# cp -R * /var/www/webmail/
# cd /var/www/webmail/
# ./configure

***change the settings as you like***
***Change data and attach location in option 4 as follows***
/var/spool/squirrelmail/data/
/var/spool/squirrelmail/attach/

# mkdir /var/spool/squirrelmail
# mkdir /var/spool/squirrelmail/data
# mkdir /var/spool/squirrelmail/attach
# chown www-data:www-data /var/spool/squirrelmail/data/
# chown www-data:www-data /var/spool/squirrelmail/attach/
# apt-get install libapache2-mod-php5
# cd /var/www/
# mv index.html index.html.orig
# vim index.html
Auto-Redirect Page for Webmail

# cd
# wget http://squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fchange_pass-3.1-1.4.0.tar.gz
# mv countdl.php?fileurl=http:%2F%2Fwww.squirrelmail.org%2Fplugins%2Fchange_pass-3.1-1.4.0.tar.gz change_pass-3.1-1.4.0.tar.gz
# tar -zxvf change_pass-3.1-1.4.0.tar.gz
# cp -R change_pass/ /var/www/webmail/plugins/
# cd /var/www/webmail/
# ./configure

***Enable Change_Pass in option 8***

# apt-get install poppassd

CentOS 6.3 OS Installation

Boot Computer with CentOS 6.3 OS Installation CD/DVD.

  1. SelectInstallor Upgrade existing system options.

cent-1Select Install or Upgrade

  1. Chooseskipmedia test as it may take long time to check media.

cent-2Skip CentOS 6.3 Media Test

  1. CentOS 6.3 Welcome Screen pressNext.

cent-3CentOS 6.3 Welcome Screen

  1. LanguageSelection.

cent-4CentOS 6.3 Language Selection

  1. Select appropriateKeyboard.

cent-5CentOS 6.3 Keyboard Selection

  1. SelectBasic Storage Device if your hard drive is attached locally.

cent-6CentOS 6.3 Storage Device Selection

  1. You may getStorage Devicewarning, you can click Yes, discard any data button to Continue.

cent-7CentOS 6.3 Storage Device Warning

  1. Give aHostnameto the server and click on Configure Network button if you want to configure network while installation.

cent-8CentOS 6.3 Hostname and Network Setup

  1. ClickWiredtab and click on Add button.

cent-9CentOS 6.3 Network Setup

  1. SelectConnect Automatically, go toipv4 settings tab and select Method and select Manual in drop down. Click on Add tab to fill address box with IP Address, Netmask, Gateway and DNS Server. Here I’m using IP Address 192.168.1.6 and DNS Server is 4.2.2.2 for demo. This IP Address may vary in your environment.

cent-10CentOS 6.3 Network Configuration

  1. SelectTime Zone.

cent-11CentOS 6.3 Set Timezone

  1. Give aroot password.

cent-12CentOS 6.3 root Password

  1. Select appropriate partitioning as per your requirement.

cent-13CentOS 6.3 Partition Selection

  1. Verify filesystem. Here, you can edit filesystem If you want.

cent-14CentOS 6.3 Partition Verify

  1. DiskFormat Warning, click on Format.

cent-15CentOS 6.3 Disk Format

  1. SelectWrite Changes to disk.

cent-16CentOS 6.3 Disk Changes

  1. Hard Drive isFormatting.

cent-17CentOS 6.3 Disk Formatting

  1. Here, you can giveBoot loader Password for better security.

cent-18CentOS 6.3 Boot Loader Password

  1. Select the applications you want to install, you can chooseCustomize nowand click Next.

cent-19CentOS 6.3 Package Selection

  1. Select the applications you want to install and clickNext.

cent-20CentOS 6.3 Packages Selection

  1. Installation started, this may take several minutes as per selection of packages.

cent-21CentOS 6.3 Installation

  1. Installation completed, Please removeCD/DVDand reboot system.

cent-22CentOS 6.3 Installation Completes

  1. Welcome to CentOS 6.3Login Screen.

cent-23CentOS 6.3 Login Screen

  1. CentOS 6.3Desktop Screen.

cent-24

Liked the article? Sharing is the best way to say thank you!