Sunday, September 18, 2011

LINUX NETWORKING

LINUX NETWORKING

What Is A LAN?
• A Local Area Network (LAN) is a grouping of ports on a hub, switch or tied to a wireless access point (WAP) that can only communicate with each other.
• It is possible to have LANs that span multiple switches. Simple home switches can be connected in a chain formation to create a LAN with more ports. This is often called “daisy chaining”.
• Pure switches provide no access control between servers connected to the same LAN. This is why network administrators group trusted servers having similar roles on the same LAN. They will also ensure that they don’t mix servers on different IP networks on the same LAN segment. A good rule of thumb is to have only one network per LAN.
• Communication to devices on another LAN requires a router directly connected to both LANs. The router is also capable of filtering traffic passing between the two LANs therefore providing additional security.
• Larger, more expensive switches can be configured to assign only certain ports to pre-specified Virtual LANs or (VLANs) chosen by the network administrator. In this case, the switch houses ports on multiple LANs. A router is still needs to be connected to each VLAN for inter-network communication.


What Is A Hub?
• A hub is a device into which you can connect all devices on a home network so that they can talk together. Hubs physically cross-connect all their ports with one another which causes all traffic sent from a server to the hub to be blurted out to all other servers connected to that hub whether they are the intended recipient or not.
• Hubs have none or very little electronics inside and therefore do not regulate traffic. It is possible for multiple servers to speak at once with all of them receiving garbled messages. When this happens the servers try again, after a random time interval, until the message gets through correctly.
What Is A Switch?
• A switch is also a device into which you can connect all devices on a home network so that they can talk together. Unlike a hub, traffic sent from Server A to Server B will only be received by Server B. The only exception is broadcast traffic which is blurted out to all the servers simultaneously.
• Switches regulate traffic, thereby eliminating the possibility of message garbling. Switches therefore provide more efficient traffic flow.

• Devices that plug into switches should be set to full duplex to take full advantage of the dedicated bandwidth coming from each switch port.
What Is A Router?
• As stated before, switches and hubs usually only have servers connected to them that have been configured as being part of the same network.
• Routers will connect into multiple switches to allow these networks to communicate with one another.
• Routers can also be configured to deny communication between specific servers on different networks. They can also filter traffic based on the TCP port section of each packet. For example, it is possible to deny communication between two servers on different networks that intend to communicate on TCP port 80, and allow all other traffic between them. Routers therefore direct and regulate traffic between separate networks, much like a traffic policeman.
• If you intend to route between networks, then for each network, you must reserve an IP address for a router and make sure that the router is directly connected to the LAN associated with that network.
• In home networks, routers most frequently provide connectivity to he Internet using network address translation or NAT.

Network Protocols
The word protocol simply means set of rules. There are different types of protocols available. These differ according to the OS we use. For example:

Unix/Linux use TCP/IP

Windows supports the following protocols
NetBEUI (Net Bios Extended User Interface).
TCP/IP (Transmission Control Protocol/Internet Protocol)
NwLink IPX/SPX Compatible Protocol (Internet Packet Exchange/
Sequenced Packet Exchange)
Apple Talk used if Apple Mackintosh Os is to be used.

Novel Netware use IPX/SPX


TCP/IP (Transmission Control protocol/Internet protocol)
TCP/IP is a universal standard suite of protocols used to provide connectivity between networked devices. It is part of the larger OSI model upon which most data communications is based.

One component of TCP/IP is the Internet Protocol (IP), which is responsible for ensuring that data is transferred between two addresses without being corrupted.
For manageability, the data is usually split into multiple pieces or “packets” each with its own error detection bytes in the control section or “header” of the packet. The remote computer then receives the packets and reassembles the data and checks for errors. It then passes the data to the program that expects to receive it.
 It is a protocol stack
 Managed by Inter NIC
 It is classified in to 32 bits, this again classified into 4 octats, each octet varying from 0-255 Eg of an Ipaddr is 192.168.10.33
 InterNIC classifies 32 bit IP address into different classes: - class A, class B,class C, class D
 This classification is based on no: of machines or no: of hosts/per network.
 By default communication between diff network is not possible.
 The first octet value represents the class, which it belongs to.
o Class A 1st octet value is b/w 0-126 ie, n/w.host.host.host
That is 28 n/w and 224 hosts/network eg: -10.1.100.220
The default subnet mask is 255.0.0.0
o Class B 1st octet value is b/w 128-191. ie, n/w.n/w.host.host
That is 216 n/w and 216 hosts/network eg: - 128.1.100.127
The default subnet mask is 255.255.0.0
o Class C 1st octet value is b/w 192-223 ie, n/w.n/w.n/w.host
That is 224 n/w and 28 hosts/network eg: -200.168.56.100
The default subnet mask is 255.255.255.0
o Class D 1st octet value is b/w 224-239
Normally not used. Used only in multitasking.
o Class E  octet value lies b/w 240-255
This too is normally not used.

Note The IP address beginning with 127 can be called the loop back address and is used to test the system independently.

Broadcast Id the id used to communicate with an entire group
Network Id the Id used to communicate with a particular group.
Subnet mask used to calculate the broadcast id and network id. If the subnet mask is 255.255.255.0 (in the case of a Class C network), it means there is no subnet.
Subnet masks are used to tell which part of the IP address represents. The network on which the computer is connected (Network portion). The
computer's unique identifier on that network (Host portion)
MAC Media Access Control id is the independent id of a machine, it will be the h/w address or NIC no: of the machine.

Private IP Address These addresses can be used with your internal N/w and do not need to be registered with interNIC for local n/w.

Class A 10.0.0.0 to 10.255.255.255
Class B 172.16.0.0 to 172.31.255.255
Class C 192.168.0.0 to 192.168.255.255


CONFIGURATION OF NETWORK INTERFACE CARD
#netconfig to configure your n/w or NIC card
the value gets active only after u restarts the system
#ifconfig to display IP information of NIC card.
#ifconfig device_name ipaddr subnetmask to give a new IP address
Eg:- #ifconfig eth0 192.168.1.65 255.255.255.0
#ifconfig eth1 192.168.23 helps to give a virtual IP address to the same NIC card.
If there are more than one NIC cards, then also the same way is used to give IP addresses to the NIC cards.
#ifconfig eth0 down to disconnect the machine from the n/w
#ifconfig eth0 up to enable networking
#ping ipaddr to test if your networking if proper or not.
Eg:- #ping 127.0.0.1

The file named /etc/sysconfig/network contains the following information like whether networking is enabled or not, the host name and domain name of the machine.


NETWORKIN=yes
HOSTNAME=linux5
DOMAINNAME=nascent.com

The file named /etc/sysconfig/networking/devices/ifcfg-eth0 contains the following information like device name, whether the device is to be detected at boot itself, whether the IP is static or not, IP address, mask value etc.
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.65
NETMASK=255.255.255.0
The boot protocol information can be of two types—static or auto(auto means gets ip from DHCP server)

The netconfig cmnd creates the above file “ifcfg-etho” using the script in /etc/sysconfig/network-scripts

Configuring Hostname Resolution

To resolve host name, edit the following file, ie,
#vi /etc/hosts
192.168.1.65 nascent.com linux3. nascent.com

host name of the machine
domain name or any alias name given to the system.

ipaddr
[then quit from the file.]

Port Definitions

There are about more than 65,000 ports available for communication.
For a TCP/IP & UDP the port nos are as follows:
 0 - 1023 (well known ports)
 1024 - 49151 (Registered ports)
 49152 - 65535 (Dynamic and/or Private ports)

Port values are defined in /etc/services

Port values of some commonly used services are as follows.

Service name Port value
ftp 21 *
Ssh 22
telnet 23 *
Smtp 25 *
Name server 42
tftp 69
Finger 79
http 80 *
Pop3 110 *
Imap 143 *
snmp 161
Ldap 389
https 443 *

[here * is used to show that all these are important port values]

# service_name IP:portvalue helps to communicate in the specified port value of the machine that has the given id.
Eg: #telnet 192.168.1.65:1009 is the case in which we have changed the
telnet port value from 23 to 1009

No comments: