Honore With His Spouce IGA KUBUNTU! OWNER. BLOG SITE. This is My Child FUTURE COMPUTER TECHNOLOGY
blogger JavaScript Rocks.

Friday, 7 June 2013

How to configure IP address in Linux

How to configure IP address in Linux

Every node participating in networking needs a valid IP address. On Linux command prompt IP address is assigned by a network configuration window. This window can be invoked by selecting network configuration sub menu form setup command or directly executing system-config-network commands.
Run setup command form root user
 #setup 
setup
this will launch a new window select network configuration
network configurations
now a new window will show you all available LAN card select your LAN card ( if you don’t see any LAN card here mean you don’t have install driver)
select lan devices in setup
assign IP in this box and click ok
assign ip address
click on ok, quit and again quit to come back on root prompt.
Alternately you can use system-config-network command directly to invoke this setup window
 #system-config-network 
system-config-network
whatever change you made in network configuration will not take place till you restart the LAN card
 #service network restart 
service network restart

ifconfig

ifconfig
The ifconfig command will display the configuration of all active Ethernet card. Without specifying any parameter this command will show all active Ethernet card. if you want to see the configuration of any specific Ethernet card then use the name of that card as the command line arguments. for example to show the IP configuration on loop back Interface execute this command
 #ifconfig lo 
ifconfig lo

ifup/ifdown

ifup ifdown etho
Each installed network adapter has a corresponding ifcfg-* file in /etc/sysconfig/network-scripts. You can activate or deactivate that adapter with the ifup and ifdown commands. Either of the following commands will activate the eth0 network adapter:
 #ifup ifcfg-eth0 #ifup eth0 

netstat

netstat -r
The netstat program provides real-time information on the status of your network connections, as well as network statistics and the routing table. The netstat command has several options you can use to bring up different sorts of information about your network.

arp

arp
The Address Resolution Protocol associates the hardware address of a network adapter with an IP address. The arp command (in the /sbin directory) displays a table of hardware and IP addresses on the local computer. With arp, you can detect problems such as duplicate addresses on the network, or you can manually add arp entries as required.

mii-tool

mii tools
mii-tool command is used to check the link is activated or not. Most use of mii-tool command is to check to physical link of Ethernet card on command line. With this command you can check on command prompt that cable is plugged in LAN card or not.

ping

ping command is used to check the physical connectivity. If you get reply mean everything is ok. If you get request time out response means there is some problem it could be unplugged cable power off switch or enabled firewall on destination node. If you get Destination host unreachable means remote node is not in your network. Use CTRL+C to abort the ping sequence
ping

service network restart

Whatever change you made in network configuration files will not take place until you restart the network services. To implement change this command is used.

service network restart

How to use Linux as router

In this article I will show you that how can you use Linux as a router. Routers are the devices those are used to connect two different networks. Routers are very costly devices. Linux could be a cost effective solution of routing in a small company.
Exam question
Your system is going use as a router for 192.168.0.0/24 and 192.168.1.0/24. Enable the IP forwarding.

Linux as a Router

In this practical we are using three computers. One Linux system will be use for routing and reset two will remain in two different networks. First we will configure the system which is going to play the role of router.
How to create virtual LAN card

Configure server system

You need two LAN card for routing between two networks or you can create virtual LAN card instead of deploying them physically.
To create virtual Ethernet card change directory to /etc/sysconfig/network-scripts
change directory network script
ifcfg-eth0 is the necessary script file for Ethernet 0. Copy this file to the same folder to create new virtual LAN cards.
cp eth0 eth0.1
Now on this newly created virtual LAN card. It could be done by service network restart
service network restart
Run setup command and select network configuration sub window from list
setup
You have two LAN card here, select eth0 from list to assign IP
select eh0
This Ethernet card will be the default gateway of first network set its IP to 192.168.1.254 and click on ok
assign ip
Now select eth0.1 ( This our virtual LAN card which we create in our last sections)
select eth1
Set its IP to 192.168.0.254 This will be the default gateway of other network. Click on OK then quit and quit to come back on command prompt
assign ip eth1
IP forwarding can be enabled by editing in /etc/sysctl.conf file. open this file
vi /etc/sysctl.conf
Locate the net.ipv4. ip_forward = 0 tag. and replace the value 0 to 1. This will enable IP forwarding to permanently . But this require a system reboot.
change value sysctl.conf
If don't want to restart the system you can tell running kernel directly by echo command and kernel will enable the IP forwarding
echo command
now configure our client system. we are using two system one from each network to test the connectivity .
Our first system is a Linux machine run setup command on it
setup commands
assign its IP address to 192.168.0.1 with a default gateway of 192.168.0.254
assign IP address
now restart the network service and check connectivity form its default gateway ( Server IP)
ping
Now go on our other host which we are using a window machine ( You can also use Linux host ) and set IP address to 192.168.1.1 with a default gateway to 192.168.1.254
ip configurations
now open command prompt and test connectivity with default gateway
ping commands
At this point you have completed all necessary step's to enable routing its time to verify this

Test from windows system

ping the Linux host located on other network
ping replay

Test from Linux system

ping the Window host located on other network
ping replay

Configure linux server to deny icmp ping request

ICMP protocol is used by ping command to check the connectivity between two computers. By defaults all Linux servers will response on ICMP request. Hacker can misuse this service. They can generate countless ping requests to your Linux server. This is what called DOS denial of services.
In this article I will show that how can you block ICMP ping request
We will use to two system for this practical. Go on first Linux system and set IP address to 192.168.0.254
assign ip on server
Apply new IP by service network restart command and verify it ifconfig
service network restart
Now go other machine and set IP address to 192.168.0.1 (I am using window machine for testing you can use your Linux machine for it also.)
assign ip
verify new ip by ipconfig
ipconfig
Test connectivity with server by ping commands
ping
You will get reply because all Linux servers are by default configured to response on ICMP ping request.
Now go back on Linux server and configure it to deny ping request.
We need to add deny tag in sysctl.conf file open /etc/sysctl.conf file
vi sysctl.conf
Now add net.ipv4.icmp_echo_ignore_all = 1 line in the end of file and save this file
edit in sysclt.conf
Change will take place after restart, reboot system with reboot -f commands
reboot -f
Now try to ping form other system again you will not get replay now
ping
Now other system cannot ping the Linux server but Linux server can ping ohter system as so far our other system have no such service configured. Go on Linux server and pingother system
ifconfig
After doing practical don't forget remove net.ipv4.icmp_echo_ignore_all = 1 line form sysctl.conf on server. Otherwise you will not get replay form server that not good at least in classroom lab.

Network configuration in Linux

In this article we will discuss all those necessary steps which you need to perform before solving networking related questions in RHCE exam. Don't skip this tutorial, giving few minutes to this could save you from huge problems in exam. All steps are given in a sequences don't skip them .

Check LAN card driver is installed or not.

LAN driver is the top most part for network. To check it run setup command
setup commands
Select network configuration from list

If you see LAN card here mean you have LAN driver
select lan card
if you don't see here anything and Linux drop you back on list manu means you don't have LAN driver. Install is first.

Check proper IP configuration

All systems on RHCE exam should have an properly configured IP address. During this entire practical we are using three systems. There description is given below Check these systems for properly configured IP address.
Node Operating system Name IP
PC1Linux RHELServer192.168.0.254
PC2Linux RHELClient1192.168.0.1
PC3Windows XPClient2192.168.0.2

Change host name

If you have skipped hostname during installation then it would be localhost.localdomain. You can change hostname with hostname command but this change would be temporary. To change hostname permanently do editing in /etc/sysconfig/network.
set computer name as shown in table.
#vi /etc/sysconfig/network
sysconfig
On server system set it to Server and in client system set it Client1
network

Check /etc/hosts files for name resolution

Several Linux server depend name resolution. This file should have entry of all network systems. It will save you from naming related problem. In our network it should look like this on both Linux system Server and Client1
hosts files

Check firewall status

Firewall is the necessary security part of Linux system which is connected to Internet. But in exam we are not going to use Internet so it’s good practice to disable it.
To disable firewall run setup commands
setup
Now select firewall configuration from list and click on run tool
select firewall configurations
Select disable and click on ok and quit to return on command prompt.
diable firewall
System reboot require to take effect so reboot system with reboot -f commands
reboot

Check portmap and xinetd package status

Almost every Linux server needs these two rpm to function properly. First check that these rpm are install or not. If no rpm is install then install them via rpm commands.
rpm status
If you have rpm then check there status via setup commands
setup
Now select system service from menu
select system service
put a star in front the portmap service
select portmap
Now put star in front the xinetd service
xinetd
Click on ok and select quit to come back on command prompt
Now restart these two service.
service restart
To keep on these services after reboot on then via chkconfig command
chkconfig
After reboot verify their status. It must be in running condition
service status
Once you have successfully completed these steps you are ready to configure the Linux server

How to configure ssh server in Linux

Telnet and FTP are well-known protocol but they send data in plain text format, which can be captured by someone using another system on the same network, including the Internet.
On the other hand, all data transferred using OpenSSH tools is encrypted, making it inherently more secure. The OpenSSH suite of tools includes ssh for securely logging in to a remote system and executing remote commands, scp for encrypting files while transferring them to a remote system, and sftp for secure FTP transfers.
OpenSSH uses a server-client relationship. The system being connected to is referred to as the server. The system requesting the connection is referred to as the client. A system can be both an SSH server and a client. OpenSSH also has the added benefits of X11 forwarding and port forwarding.
X11 forwarding, if enabled on both the server and client, allows users to display a graphical application from the system they are logged in to on the system they are logged in from.
Port forwarding allows a connection request to be sent to one server but be forwarded to another server that actually accepts the request.
In this article we will discusses how to use OpenSSH, both from the server-side and the client-side.

Configuring the ssh Server

The openssh-server RPM package is required to configure a Red Hat Enterprise Linux system as an OpenSSH server. If it is not already installed, install it with rpm commands as described in our pervious article. After it is installed, start the service as root with the command service sshd start . The system is now an SSH server and can accept connections. To configure the server to automatically start the service at boot time, execute the command chkconfig sshd on as root. To stop the server, execute the command service sshd stop. To verify that the server is running, use the command service sshd status.

Configure ssh server

In this example we will configure a ssh server and will invoke connection from client side.
For this example we are using two systems one linux server one linux clients . To complete these per quest of ssh server Follow this link
Network configuration in Linux
  • A linux server with ip address 192.168.0.254 and hostname Server
  • A linux client with ip address 192.168.0.1 and hostname Client1
  • Updated /etc/hosts file on both linux system
  • Running portmap and xinetd services
  • Firewall should be off on server
We suggest you to review that article before start configuration of ssh server. Once you have completed the necessary steps follow this guide.Three rpm are required to configure ssh server. openssh-server, portmap, xinetd check them if not found then install
rpm
Now check sshd, portmap, xinetd service in system service it should be on
 #setup
 Select  System service from list
 [*]portmap
 [*]xinetd
 [*]sshd 
Now restart xinetd and portmap and sshd service
service restart
ssh restart
To keep on these services after reboot on then via chkconfig command
chkconfig
After reboot verify their status. It must be in running condition
service status
Create a normal user named vinita
useradd

On Linux client

ping from ssh server and run ssh command and give root password
root login
By default ssh command will enable root session. If you want to login from normal user then specify his name with -l options.
user login
With ssh you can run any command on server without login (user password require)














How to configure FTP Server in Linux

ftp server is used to transfer files between server and clients. All major operating system supports ftp. ftp is the most used protocol over internet to transfer files. Like most Internet operations, FTP works on a client/ server model. FTP client programs can enable users to transfer files to and from a remote system running an FTP server program.
Any Linux system can operate as an FTP server. It has to run only the server software—an FTP daemon with the appropriate configuration. Transfers are made between user accounts on client and server systems. A user on the remote system has to log in to an account on a server and can then transfer files to and from that account's directories only.
A special kind of user account, named ftp, allows any user to log in to it with the username “anonymous.” This account has its own set of directories and files that are considered public, available to anyone on the network who wants to download them.
The numerous FTP sites on the Internet are FTP servers supporting FTP user accounts with anonymous login. Any Linux system can be configured to support anonymous FTP access, turning them into network FTP sites. Such sites can work on an intranet or on the Internet.

Configuring the ftp Server

The vsftpd RPM package is required to configure a Red Hat Enterprise Linux system as an ftp server. If it is not already installed, install it with rpm commands as described in our pervious article. After it is installed, start the service as root with the command service vsftpd start . The system is now an ftp server and can accept connections. To configure the server to automatically start the service at boot time, execute the command chkconfig vsftpd on as root. To stop the server, execute the command service vsftpd stop. To verify that the server is running, use the command service vsftpd status.

Configure vsftpd server

In this example we will configure a vsftpd server and will transfer files from client side.
For this example we are using three systems one linux server one linux clients and one windows xp clients. To complete these per quest of ftp server Follow this link
Network configuration in Linux
  • A linux server with ip address 192.168.0.254 and hostname Server
  • A linux client with ip address 192.168.0.1 and hostname Client1
  • A window client with ip address 192.168.0.2 and hostname Client2
  • Updated /etc/hosts file on both linux system
  • Running portmap and xinetd services
  • Firewall should be off on server

We suggest you to review that article before start configuration of ssh server. Once you have completed the necessary steps follow this guide.
Three rpm are required to configure ssh server. vsftpd, portmap, xinetd check them if not found then install
rpm
Now check vsftpd, portmap, xinetd service in system service it should be on
 #setup
 Select  System service from list
 [*]portmap
 [*]xinetd 
 [*]vsftpd 
Now restart xinetd and portmap and vsftpd service
service restart
service vsftpd restart
To keep on these services after reboot on then via chkconfig command
chkconfig
After reboot verify their status. It must be in running condition
service status
Create a normal user named vinita
useradd
Login for this user on other terminal and create a test file
create file

On Linux client

ping from ftp server and run ftp command and give username and password
user login ftp server
after login you can download files from the specified directories

Most commonly commands used on ftp prompt are

put  To upload files on server
get  To download files from server
mput To upload all files
mget To download all files
?    To see all available command on ftp prompts
cd   To change remote directory
lcd  To change local directory.
help commands on ftp server

On window clients

Now go on window clients and create a file. copy con command is used to create files on window. To save use CTRL+Z
copy con
Now ping from ftp server and invoke ftp session from server, login from user account and download as well as uploads files
user login on window system

Enable root account for ftp session and set permission on user

By default on vsftpd server root account is disable. You cannot login from root account.
deny root for ftp sessions
Now we will enable root account for ftp session and same time we will disable our normal user vinita to use ftp sessions.
open file /etc/vsftpd/ftpusers . Users whose name are set in this file will not allowed to login from ftp.
vi ftpuser
ftp user
By default this file have an entry for root that why root are not allowed to use ftp. remove root from list and add user vinita
ftp user
Now remove entry form /etc/vsftpd/user_list files. Users whose names are set in this file are also not allowed to login from ftp even they are not prompt for password.

userlist
By default this file have an entry for root that way root is denied form login even not asked for password remove root from list and add user vinita
userlist
After saving change in these files restart the vsftpd service
service vsftpd restart
Now go on client system and login from root this time root will login
root login
Now try to login form user vinita she should not prompt form password also
deny vinita

How to set login banner for ftp server

To set login banner open /etc/vsftpd/vsftpd.conf file and search for this tag
banner
Uncomment this tag and set your banner and save file , and restart the vsftpd service
banner
Go on client system and check banner it will appear before user login




How to configure NIS Server in Linux

NIS, or Network Information Systems, is a network service that allows authentication and login information to be stored on a centrally located server. This includes the username and password database for login authentication, database of user groups, and the locations of home directories.

RHCE exam questions

One NIS Domain named rhce is configured in your lab, server is 192.168.0.254. nis1, nis2,nis3 user are created on domain server. Make your system as a member of rhce domain. Make sure that when nis user login in your system home directory should get by them. Home directory is shared on server /rhome/nis1.
RHCE exam doesn't ask candidate to configure NIS server. It test only NIS client side configuration. As you can see in example questions. But here in this article we will configure both server and client side for testing purpose so you can get more depth knowledge of nis server

Configure NIS server

In this example we will configure a NIS server and a user nis1 will login from client side.
For this example we are using two systems one linux server one linux clients . To complete these per quest of nis server Follow this link
Network configuration in Linux
  • A linux server with ip address 192.168.0.254 and hostname Server
  • A linux client with ip address 192.168.0.1 and hostname Client1
  • Updated /etc/hosts file on both linux system
  • Running portmap and xinetd services
  • Firewall should be off on server
We suggest you to review that article before start configuration of nis server. Once you have completed the necessary steps follow this guide.Seven rpm are required to configure nis server. ypserv, cach, nfs, make, ypbind, portmap, xinetd check them if not found then install
rpm
Now check nfs,ypserv,yppasswdd,ypbind, portmap, xinetd service in system service it should be on
#setup
Select  System service
from list
[*]portmap
[*]xinetd
[*]nfs
[*]ypserv
[*]yppasswdd
[*]ypbind
Now open /etc/sysconfig/network file
network
Set hostname and NIS domain name as shown here and save file
change hostname
Now create a user named nis1 and give his home directory on /rhome with full permission
useradd
Now open /etc/exports file
exportfs
share /rhome/nis1 directory for network
exportfs
save this with :wq and exit
now open /var/yp/Makefile file
Makefile
and locate line number 109 [ use ESC + : +set nu command to show hidden lines or read our vi editor article to know more about vi command line option ]
Makefile
Now remove other entry from this line excepts passwd group hosts netid \ [as shown here]
Makefile
save this with :wq and exit
Now restart these service
#service portmap restart
#service xinetd restart
#service nfs restart
#service ypserv restart
#service yppasswdd restart
Don't restart ypbind service at this time as we haven't updated our database
Now change directory to /var/yp and run make command to create database
make
now update this database by running this commands [ first add server and then add all client machine one by one. After adding press CTRL+D to save, confirm by pressing y]
ypinit
Now once again restart all these service this time there should be no error
#service portmap restart
#service xinetd restart
#service nfs restart
#service ypserv restart
#service yppasswdd restart
#service ypbind restart
Now set all these service to on with chkconfig so these could be on after restart
#chkconfig portmap on
#chkconfig xinetd on
#chkconfig nfs on
#chkconfig ypserv on
#chkconfig yppasswdd on
#chkconfig ypbind on

Client configuration

Before you start client configuration we suggest you to check proper connectivity between server and client. First try to login on NIS server from telnet. If you can successfully login via telnet then try to mount /rhome/nis1 directory via nfs server. If you get any error in telnet or nfs then remove those error first. You can read our pervious article for configuration related help.
To know how configure nfs server read
How to configure nfs server in Linux
To know how configure telnet server read
How to configure telnet server in Linux
Once you successfully completed necessary test then start configuration of client sides.
Two rpm are required to configure clients yp-tools and ypbind check them for install
rpm
now open /etc/sysconfig/network file
vi network
and make change as shown here
network
save the file with :wq and exit
now run setup command and select authentication configuration from list
#setup
select authenications
now check mark on NIS and enter on next
setup
Set domain name to rhce and server to 192.168.0.254 and click on ok
set nis domain name
No error should be occurred here if you see any error then check all configuration.
no open /etc/auto.master file
auto.master
in the end of file do editing of /rhome as shown here
editing in auto.master
save the file with :wq and exit
now open /etc/auto.misc file
auto.misc
in the end of file do editing of user nis1 as shown here
auto.misc
save the file with :wq and exit
now restart autofs and ypbind service
service restart
set these service on via chkconfig commands
#chkconfig autofs on
#chkconfig ypbind on
now restart the system
 #reboot -f 
login from nis1 user on client system
user login




How to configure dhcp server in Linux

DHCP, or Dynamic Host Configuration Protocol, allows an administrator to configure network settings for all clients on a central server.
The DHCP clients request an IP address and other network settings from the DHCP server on the network. The DHCP server in turn leases the client an IP address within a given range or leases the client an IP address based on the MAC address of the client's network interface card (NIC). The information includes its IP address, along with the network's name server, gateway, and proxy addresses,including the netmask.
Nothing has to be configured manually on the local system, except to specify the DHCP server it should get its network configuration from. If an IP address is assigned according to the MAC address of the client's NIC, the same IP address can be leased to the client every time the client requests one. DHCP makes network administration easier and less prone to error.
Exam Question Configure the DHCP server by matching the following conditions:
  • Subnet and netmask should be 192.168.0.0 255.255.255.0
  • Gateway Should be 192.168.0.254
  • DNS Sever Should be 192.168.0.254
  • Domain Name should be example.com
  • Range from 192.168.0.10-50
Exam Question You have DHCP server, which assigns the IP, gateway and DNS server ip to Clients. There is one DNS servers having MAC address (00:50:FC:98:8D:00 in your LAN, But it always required fixed IP address (192.168.0.10). Configure the DHCP server to assign the fixed IP address to DNS server.

Configure dhcp server

In this example we will configure a dhcp server and will lease ip address to clients.
For this example we are using three systems one linux server one linux clients and one window clients.
dhcp rpm is required to configure dhcp server. check it if not found then install
rpm
Now check dhcpd service in system service it should be on
#setup
Select  System service
from list [*]dhcpd

To assign IP to dhcp server

DHCP server have a static a ip address. First configure the ip address 192.168.0.254 with netmask of 255.255.255.0 on server.
Run setup command form root user
 #setup 
setup
this will launch a new window select network configuration
network configurations
now a new window will show you all available LAN card select your LAN card ( if you don't see any LAN card here mean you don't have install driver)
select lan devices in setup
assign IP in this box and click ok
assign ip address
click on ok, quit and again quit to come back on root prompt.
restart the network service so new ip address can take place on LAN card
 #service network restart 
main configuration file of dhcp server is dhcpd.conf. This file located on /etc directory. If this file is not present there or you have corrupted this file, then copy new file first, if ask for overwrite press y
cp dhcpd sample file
now open /etc/dhcpd.conf
vi dhcpd
default entry in this file look like this
dhcpd.conf
make these change in this file to configure dhcp server
remove this line # - - - default gateway
set option routers to 192.168.0.254
set option subnet-mask to 255.255.255.0
option nis domain to example.com
option domain-name to example.com
option domain-name-servers to 192.168.0.254
range dynamic-bootp to 192.168.0.10 192.168.0.50;
After change this file should look like this
dhcpd.conf

how to assign fix ip address to any host

locate this paragraph and change hardware Ethernet to client's mac address and fixed -address to ip address which you want to provide that host
dhcpd.conf
after making necessary change save file and exit
now create a blank file use to store the allocated ip address information
touch
Now restart dhcpd service and on it with chkconfig commands
service dhcpd restart

Linux Client configuration

Client configuration is very easy and straightforward. All you need to do is set ip address to dynamic in the properties of lan card. In linux
#setup
select  network configuration from menu list
Select  lan card and enter on ok
Select  USE DHCP and enter on ok
Now click on  quit
and  quit to come back on root prompt
Now restart the network service to obtain ip from dhcp server
service network restart

Window Client configuration

To configure windows system as dhcp clients open lan card properties and select tcp/ip and click on properties and set obtain ip address automatically
lan card porperties
Go on command prompt and check new ip address
ipconfig

Check lease on DHCP server

you can check allocated address on server.
 cat
cat lease



How to configure web server in Linux

When you view a web page over the Internet, the code to create that page must be retrieved from a server somewhere on the Internet. The server that sends your web browser the code to display a web page is called a web server. There are countless web servers all over the Internet serving countless websites to people all over the world. Whether you need a web server to host a website on the Internet a Red Hat Enterprise Linux server can function as a web server using the Apache HTTP server. The Apache HTTP server is a popular, open source server application that runs on many UNIX-based systems as well as Microsoft Windows.
Exam question 1 There are two sites www.vinita.com and www.nikita.com. Both sites are mappings to 192.168.0.X IP address where X is your Host address. Configure the Apache web server for these sites to make accessible on web

Configure web server

In this example we will configure a web server.
necessary rpm for web server is httpd, httpd-devel and apr check them for install
rpmNow configure the ip address to 192.168.0.254 and check it
ifconfig
start httpd daemons and verify its running status
pgrep httpd

Configure virtual hosting

In this example we will host a website www.vinita.com to apache web server. create a documents root directory for this website and a index page
mkdir vinita
for testing purpose we are writing site name in its index page
index.htm
save file and exit
now open /etc/hosts file
hosts
in the end of file bind system ip with www.vinita.com
entry of vinita in hosts
now open /etc/httpd/conf/httpd.conf main configuration file of apache server
vi httpd.conf
locate virtual host tag
virtual host
remove # from the beginning and add the IP of host
virtual host
Now go in the end of file and copy last seven line [ virtual host tag ] and paste them in the end of file. change these seven lines as shown in image
httpd.conf
now save this file and exit from it
you have done necessary configuration now restart the httpd service and test this configuration run links command
links
if links command retrieve your home page

means you have successfully configured the virtual host now test it with site name
links vinita
In output of links command you should see the index page of site
webpage of vinita

Configure multiple site with same ip address

At this point you have configured one site www.vinita.com with the ip address 192.168.0.254. Now we will configure one more site www.nikita.com with same ip address
create a documents root directory for www.nikita.com website and a index page
create virtual directory
for testing purpose we are writing site name in its index page
index.htm
save file and exit
now open /etc/hosts file and bind system ip with www.nikita.com
hosts
now open /etc/httpd/conf/httpd.conf main configuration file of apache server
vi httpd.conf
Now go in the end of file and copy last seven line [ virtual host tag ] and paste them in the end of file. change these seven lines as shown in image
httd.conf
now save this file and exit from it
you have done necessary configuration now restart the httpd service
service httpd restart
test this configuration run links command
links
In output of links command you should see the index page of site

configure multiple site with multiple ip address

Now we will host multiple sites with multiple ip address. Create a virtual lan card on server and assign its an ip address of 192.168.0.253. we will create a testing site www.nidhi.com and will bind it with ip address of 192.168.0.253
create a documents root directory for www.nidhi.com website and a index page
vi nidhi
for testing purpose we are writing site name in its index page
index.htm
save file and exit
now open /etc/hosts file and bind system ip with www.nidhi.com
hosts
now open /etc/httpd/conf/httpd.conf main configuration file of apache server
vi httpd.conf
Now go in the end of file and copy last seven line [ virtual host tag ] and paste them in the end of file. change these seven lines as shown in image
httpd.conf
now save this file and exit from it
you have done necessary configuration now restart the httpd service
service httpd restart
test this configuration run links command
links
In output of links command you should see the index page of site

How to create site alias

Now I will show you that how can you use site alias to configure more name of same site. we configure a site www.vinita.com in stating of example. now we will create www.goswami.com site alias for this site so this site can be access with both name.
To create alias first make its entry in /etc/hosts file as shown here
hosts
Now open main apache configuration /etc/httpd/conf/httpd.conf
vi httpd.conf
Now go in the end of file and copy last seven line [ virtual host tag ] and paste them in the end of file. change these seven lines as shown in image
httpd.conf
now save this file and exit from it
you have done necessary configuration now restart the httpd service and test this configuration run links command
links
In output of links command you should see the index page of site
webpage of goswami


0 comments:

Post a Comment