Saturday, December 17, 2016

What is Networking !



What is networking?

Definition: In the world of computers, networking is the practice of interfacing two or more computing devices with each other for the purpose of sharing data. Computer networks are built with a combination of hardware and software.
Computer networks can be categorized in several different ways. One approach defines the type of network according to the geographic area it spans.
Local area networks (LANs), for example, typically span a single home, school, or small office building, whereas wide area networks (WANs), reach across cities, states, or even across the world.The Internet is the world’s largest public WAN.

Home Networking

While other types of networks are built and maintained by engineers, home networks belong to ordinary homeowners, people often with little or no technical background. Various manufacturers produce broadband router hardware designed to simplify home network setup. Home broadband routers allow devices in different rooms to efficiently share a broadband Internet connection, enable people to more easily share their files and printers within the network, and help with overall network security.
Home networks have increased in capability with each generation of new technology. Years ago, people commonly set up their home network just to connect a few PCs, share some documents and perhaps a printer. Now its common for households to also network game consoles, digital video recorders, and smartphones for streaming sound and video. Home automation systems have also existed for many years, but these too have grown in popularity more recently with practical systems for controlling lights, digital thermostats and appliances.

Business Networks

Small and home office (SOHO) environments use similar technology as found in home networks. Businesses often have additional communication, data storage, and security requirements that require expanding their networks in different ways, particularly as the business gets larger. Whereas a home network generally functions as one LAN, a business network tends to contain multiple LANs. Companies with buildings in multiple locations utilize wide-area networking to connect these branch offices together. Though also available and used by some households, voice over IP communication and network storageand backup technologies are prevalent in businesses. Larger companies also maintain their own internal Web sites, called intranets to help with employee business communication.

Networking and the Internet

The popularity of computer networks sharply increased with the creation of the World Wide Web (WWW) in the 1990s. Public Web sites, peer to peer (P2P) file sharing systems, and various other services run on Internet servers across the world.

Wired versus  Wireless Networking

Many of the same network protocols, like TCP/IP, work in both wired and wireless networks. Networks withEthernet cables predominated in businesses, schools, and homes for several decades. More recently, however, wireless alternatives have emerged as the premier technology for building new computer networks, in part to support smartphones and the other new kinds of wireless gadgets that have triggered the rise of mobile networking.

What is IP address?

Internet Protocol address, an IP or IP address is an address of a computer or other network device on a network using TCP/IP. For example, the number “192.168.1.101” is an example of such an address. These addresses are similar to an addresses used on a house and is what allows data to reach the appropriate destination on a network and the Internet.
There are five classes of available IP ranges: Class A, Class B, Class C, Class D and Class E, while only A, B, and C are commonly used. Each class allows for a range of valid IP addresses. Below is a listing of these addresses.
Class
Address Range
Supports
Class A
1.0.0.1 to 126.255.255.254
Supports 16 million hosts on each of 127 networks.
Class B
128.1.0.1 to 191.255.255.254
Supports 65,000 hosts on each of 16,000 networks.
Class C
192.0.1.1 to 223.255.254.254
Supports 254 hosts on each of 2 million networks.
Class D
224.0.0.0 to 239.255.255.255
Reserved for multicast groups.
Class E
240.0.0.0 to 254.255.255.254
Reserved for future use, or Research and Development Purposes.

Ranges 127.x.x.x are reserved for the loopback or localhost, for example, 127.0.0.1 is the common loop back address. Range 255.255.255.255 broadcasts to all hosts on the local network.

How to configure IP address (manually) in Linux servers:

Before delving into the interface configuration files, let us first itemize the primary configuration files used in network configuration. Understanding the role these files play in setting up the network stack can be helpful when customizing a Red Hat Enterprise Linux system.
/etc/hosts
The main purpose of this file is to resolve host names that cannot be resolved any other way. It can also be used to resolve host names on small networks with no DNS server. Regardless of the type of network the computer is on, this file should contain a line specifying the IP address of the loopback device (127.0.0.1) as localhost.localdomain.
Following is a sample /etc/hosts file:
           IPAddress                  Hostname                Alias
           127.0.0.1                  localhost               deep.openna.com
           208.164.186.1              deep.openna.com         deep
           208.164.186.2              mail.openna.com         mail
           208.164.186.3              web.openna.com          web
/etc/resolv.conf
This file specifies the IP addresses of DNS servers and the search domain. Unless configured to do otherwise, the network initialization scripts populate this file.
Following is a example /etc/resolv.conf
search mydomain.com
nameserver 8.8.8.8
nameserver 8.8.4.4
/etc/sysconfig/network
This file specifies routing and host information for all network interfaces. It is used to contain directives which are to have global effect and not to be interface specific.

Following is a example /etc/sysconfig/network file:
           NETWORKING=yes
           FORWARD_IPV4=yes
           HOSTNAME=deep. openna.com
           GATEWAY=0.0.0.0
/etc/sysconfig/network-scripts/ifcfg-interface-name
For each network interface, there is a corresponding interface configuration script. Each of these files provide information specific to a particular network interface.
Following is a example /etc/sysconfig/network-scripts/ifcfg-eth0 file:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Configuration for eth0
DEVICE=eth0
BOOTPROTO=none
# This line ensures that the interface will be brought up during boot.
ONBOOT=yes
# eth0 - This is the main IP address that will be used for most outbound connections.
# The address, netmask, and gateway are all necessary.
IPADDR=198.51.100.5
NETMASK=255.255.255.0
GATEWAY=198.51.100.1
 
To configure Alias IP on same interface:
vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
# Configuration for eth0:0
DEVICE=eth0:0
BOOTPROTO=none
# This line ensures that the interface will be brought up during boot.
ONBOOT=yes
# eth0:0
IPADDR=192.0.2.6
NETMASK=255.255.255.0
 
& restart network service:
# service network restart

To configure network  to get IP from DHCP server:

vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Configuration for eth0:0
DEVICE=eth0
BOOTPROTO=dhcp
# This line ensures that the interface will be brought up during boot.
ONBOOT=yes
& restart network service:
# service network restart
 
Verify your IP address:
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:40:93:9C
     inet addr:192.168.1.102 Bcast:192.168.1.255 Mask:255.255.255.0
     UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
     RX packets:1771 errors:0 dropped:0 overruns:0 frame:0
     TX packets:359 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:1000
     RX bytes:138184 (134.9 KiB) TX bytes:49108 (47.9 KiB)
     Interrupt:67 Base address:0x2000
 
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:390 errors:0 dropped:0 overruns:0 frame:0
     TX packets:390 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:0
     RX bytes:29204 (28.5 KiB) TX bytes:29204 (28.5 KiB)


ping definition

Ping is a basic Internet program that allows a user to verify that a particular IP address exists and can accept requests.
Ping is used diagnostically to ensure that a host computer the user is trying to reach is actually operating. Ping works by sending an Internet Control Message Protocol (ICMP) Echo Request to a specified interface on the network and waiting for a reply. Ping can be used for troubleshooting to test connectivity and determine response time.
# ping google.com
PING google.com (63.96.4.23): 56 data bytes
64 bytes from 63.96.4.23: icmp_seq=0 ttl=59 time=9.151 ms
64 bytes from 63.96.4.23: icmp_seq=1 ttl=59 time=10.637 ms
64 bytes from 63.96.4.23: icmp_seq=2 ttl=59 time=34.646 ms
# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: icmp_seq=0 ttl=64 time=5.958 ms
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=5.272 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=4.112 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=144.064 ms
# ping 10.0.1.1  —————–> No network connection
PING 10.0.1.1 (10.0.1.1): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3


What is HTTP/Apache?

The Apache HTTP server is a software (or program) that runs in the background under an appropriate operating system,
which supports multi-tasking and provides services to other applications that connect to it, such as client web browsers.apache
It was first developed to work with Linux/Unix operating systems, but was later adapted to work under other systems, including Windows and Mac.
The Apache binary running under UNIX is called HTTPd (short for HTTP daemon)

Step:1 Install HTTP server package
 # yum install –y http*
Step:2 Verify the HTTP Packages:
 # rpm -qa -c httpd
/etc/httpd/conf.d/welcome.conf
/etc/httpd/conf/httpd.conf
/etc/httpd/conf/magic
/etc/logrotate.d/httpd
/etc/sysconfig/htcacheclean
/etc/sysconfig/httpd.....
/var/www/error/include/top.html
 
Step:3 Start the HTTP server
  # service httpd start
Step:4 Verify the HTTP server
  # service httpd status
Step:5 Check for TCP port 80 on listen state
  # netstat -an | grep 80
    tcp4       0      0  *.80                  *.*                    LISTEN     
Step:6 Enable to Auto-start during server reboot
  # chkconfig <httpd> on
Step:7 Now go to browser and hit your ex: IP http://192.168.1.1  (Note: Try your server IP)
   If you see the below page, it means your web-server is working :-)
  Rhel6_apache_test_page
Step:8 Let us customize your webserver 
  # cd /var/www/html
  # touch index.html
  # vi index.html
        <h1>
         This is my first RHEL webserver, Hello World !!
        </h1>
   :wq!
 
Step:9 restart the HTTP server
  # service <httpd> restart
 
Again, go to browser and hit your ex: IP http://192.168.1.1  & you should see your custom page.


Let us see what is HTTP/Apache Virtual Host?

The term Virtual Host refers to the practice of maintaining more than one web site on onevirutalhost Apache machine or server.
The NameVirtualHost directive is a required directive if you want to configure name-based virtual hosts.
With the NameVirtualHost directive you specify the IP address on which the server will receive requests for the name-based virtual hosts.
This will usually be the address to which your name-based virtual host names resolve.

cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf_orig
# Use name-based virtual hosting.
NameVirtualHost *:80                                             ------------> uncomment this line
### add the following lines for 2 instance
<VirtualHost *:80>
   ServerAdmin webmaster@host01.example.com
   DocumentRoot /var/www/html
   ServerName host01.example.com
   ServerAlias host01
   ErrorLog logs/host01.example.com-error_log
   CustomLog logs/host01.example.com-access_log common
</VirtualHost>
 
<VirtualHost *:80>
   ServerAdmin webmaster@host02.example.com
   DocumentRoot /www/html
   ServerName host02.xample.com
   Serveralias host02
   ErrorLog logs/host02.example.com-error_log
   CustomLog logs/host02.example.com-access_log common
</VirtualHost>
 
Source : MyLinuxguru 

No comments:

Post a Comment