Setting Up a Network Interface Card
6. You then need to use the route command to give the system a little more
information about this interface. For this you type: route add -net
127.0.0.0
7. You now have your loopback set up and the ifconfig command shows the device lo in its listing.
Configuring the network card
1. Configuring a network card follows the same procedure as configuring the loopback interface.
2. You use the same command, ifconfig, but this time use the name ‘eth0’ for an Ethernet device.
3. You also need to know the IP address, the netmask, and the broadcast addresses.
www.myitweb.weebly.com
4. These numbers vary depending on the type of network being built. 5. For an internal network that never connects to the outside world, any IP
numbers can be used, however there are IP numbers typically used with these networks.
RESERVED NETWORK NUMBERS
Network Class Netmask Network Addresses
A 255.0.0.0 10.0.0.0–10.255.255.255
B 255.255.0.0 172.16.0.0–
17.31.255.255
C 255.255.255.0 192.168.0.0–
192.168.255.255
6. If you are connecting to an existing network, you must have its IP address, netmask, and broadcast address. You also need to have the router and domain name server addresses.
7. In this example, you configure an Ethernet interface for an internal network. You need to issue the command:
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255
8. The result of above is file get created in /etc/sysconfig/network-scripts called ifcfg-etho
9. We can check this file by issuing following command :
[root@main~]# cat /etc/sysconfig/network-scripts/ifcfg-etho
Note : A broadcast address is a logical address at which all devices connected to a multiple-access communications network are enabled to receive datagrams. A message sent to a broadcast address is typically received by all network-attached hosts, rather than by a specific host.
www.myitweb.weebly.com
Configuring an internal network
1. Now you have a network device configured for one computer, to add additional computers to your network you need to repeat this process on the other computers you want to add.
2. The only change is that you need to assign a different IP address. For example, the second computer on your network could have the address 192.168.1.2, the third could have 192.168.1.3, and so on.
3. In addition to configuring the network cards on each of the computers in the network, three files on each computer need to be modified. These files are all located in the /etc directory and they are:
i. /etc/hosts ii. /etc/hosts.conf iii. /etc/resolv.conf
4. The /etc/hosts.conf file contains configuration information for the name resolver and should contain the following:
order hosts, bind multi on
5. This configuration tells the name resolver to check the /etc/hosts file before attempting to query a nameserver and to return all valid addresses for a host found in the /etc/hosts file instead of just the first.
6. The /etc/hosts file contains the names of all the computers on the local network.
7. For a small network, maintaining this file is not difficult, but for a large network keeping the file up to date is often impractical.
8. The /etc/resolv.conf file provides information about name servers employed to resolve hostnames.
[root@main~]# cat /etc/resolv.conf search rcn.com
www.myitweb.weebly.com
Note : /etc/host.conf is a short, plain text file that specifies how host (i.e., computer) names on a network are resolved, i.e., matched with their corresponding IP
www.myitweb.weebly.com
TCP/IP
1. TCP/IP is an acronym for Transmission Control Protocol/Internet Protocol, and refers to a family of protocols used for computer communications.
2. TCP and IP are just two of the separate protocols contained in the group of protocols developed by the Department of Defense, sometimes called the DoD Suite, but more commonly known as TCP/IP.
3. In addition to Transmission Control Protocol and Internet Protocol, this family also includes Address Resolution Protocol (ARP), Domain Name System (DNS), Internet Control Message Protocol (ICMP), User Datagram Protocol (UDP),
Routing Information Protocol (RIP), Simple Mail Transfer Protocol (SMTP), Telnet and many others.
4. To be able to send and receive information on the network, each device connected to it must have an address.
5. The address of any device on the network must be unique and have a standard, defined format by which it is known to any other device on the network.
6. This device address consists of two parts
a. Network addresses are IP addresses that have assigned to the device. b. The two unique address are typically called Network layer addresses and
Media Access Control (MAC) addresses
7. Devices that are physically connected to each other (not separated by routers) would have the same network number but different node, or host numbers. 8. This would be typical of an internal network at a company or university, these
types of networks are now often referred to as intranets.
Data Transfer in TCP/IP
1) The data transfer is accomplished by breaking the information into small pieces of data called packets or datagram.
2) It’s necessary to break data into small pieces because of two reasons which are sharing resources and error correction.
www.myitweb.weebly.com a) Sharing resources
(1) If two computers are communicating with each other, the line is busy. If these computers were sharing a large amount of data, other devices on the network would be unable to transfer their data.
(2) When long streams of data are broken into small packets, each packet is sent individually, and the other devices can send their packets between the
packets of the long stream.
b) Error correction
(1) Because the data is transmitted across media that is subject to interference, the data can become corrupt.
(2) One way to deal with the corruption is to send a checksum along with the data, A checksum is a running count of the bytes sent in the message.
3) These packets are made up of two parts, the header, which contains the address and reassembly instructions and the body which contains the data.
4) Keeping all this information in order is the protocol, The protocol is a set of rules that specifies the format of the package and how it is used.
www.myitweb.weebly.com
Understanding Network Classes
1. All addresses must have two parts, the network part and the node or host part.
2. Addresses used in TCP/IP networks are four bytes long, called IP addresses, and are written in standard dot notation, which means a decimal number separated by dots.
3. For example, 192.168.1.2. The decimal numbers must be within the numeric range of 0 to 255 to conform to the one-byte requirement.
4. IP addresses are divided into classes with the most significant being classes A, B, and C depending on the value of the first byte of the address.
Class First Byte
Class A 0-127
Class B 128-191
Class C 192-233
5. The reason for the class division is to enable efficient use of the address numbers.
6. If the division were the first two bytes to the network part and the last two bytes to the host part, then no network could have more than 216 hosts. 7. This would be impractical for large networks and wasteful for small
networks.
8. There are a few ways to assign IP addresses to the devices depending on the purpose of the network.
9. If the network is internal, an intranet, not connected to an outside network, any class A, B, or C network number can be used.
10. Although this is possible but in the real world this approach would not allow for connecting to the Internet.
www.myitweb.weebly.com
Understanding Subnetting
1. A few more steps accomplish outside connection, including configuring a router, obtaining an ip address and actually making the connecting. 2. IP numbers are not assigned to hosts, they are assigned to network
interfaces on hosts.
3. Subnetting is process of dividing single network address into multiple networks.
4. Even though many computers on an IP network have a single network interface and a single IP number, a single computer can have more than one network interface.
5. In the current (IPv4) implementation, IP numbers consist of 4 (8-bit) bytes for a total of 32 bits of available information.
6. This system results in large numbers, even when they are represented in decimal notation. To make them easier to read and organize, they are written in what is called dotted quad format.
7. Example the internal network IP address 192.168.1.1. Each of the four groups of numbers can range from 0 to 255.
8. Binary notation: If the bit is set to 1 it is counted, and if set to zero it is not counted.
The binary notation for 192.168.1.1 is; 11000000.10101000.00000001.00000001 9. The dotted quad notation from this binary is:
(128+64).(128+32+8).(1).(1) = 192.168.1.1
www.myitweb.weebly.com
Interpreting IP numbers
1. IP numbers can have three possible meanings.
a. The first of these is an address of a network, which is the number representing all the devices that are physically connected to each other.
b. The second is the broadcast address of the network, which is the address that enables all devices on the network to be contacted. c. The last meaning is an actual interface address.
2. Look at the Class C network for an example. a. 192.168.3.0 is a Class C network number. b. 192.168.3.42 is a host address on this network c. 192.168.3.255 is the network broadcast address.
Before you subnet your Network
1. First you need to decide the number of hosts on each of your subnets so you can determine how many IP addresses you need.
2. Every IP network has two addresses that cannot be used – the network IP number itself and the broadcast address. Whenever you subnetwork the IP network you are creating additional addresses that are unusable
3. Every IP network has two addresses that cannot be used — the network IP number itself and the broadcast address.
4. Every time you subnet you are creating these two unusable addresses, so the more subnets you have, the more IP addresses you lose.
www.myitweb.weebly.com
5. Hence the point is, don’t subnet your network more than necessary. 6. If you wanted to divide your Class C network into two subnetworks, you
would change the first host bit to one and you would get a net mask of 11111111.11111111.11111111.10000000 or 255.255.255.128
7. This would give you 126 possible IP numbers for each of your subnets because that you lose two IP address for each subnet.
8. If you want to have four subnetworks, you need to change the first two host bits to ones and this would give you a netmask of 255.255.255.192 . You would have 62 IP addresses available hosts for your Class C networks. 9. Now all you need to do is assign the appropriate numbers for the network,
the broadcast address, and the IP addresses for each of the interfaces and you’re nearly done.
10. To create subnets for Class A and B networks, you follow the same procedure as that shown for Class C networks.
www.myitweb.weebly.com
Gateways and Routers
1. Even though after subnetting individual network segments cannot
communicate with each other, to configure a path for them we use router. 2. Router is necessary for separate networks to communicate with each other,
each network must be connected to a router in order for this communication to take place.
3. This router that is connected to each network is called its gateway. 4. In Linux, you can use a computer with two network interfaces to route
between two or more subnets. To be able to do this you need to make sure that you enable IP Forwarding.
5. You can check this by entering the following query at a command prompt: cat /proc/sys/net/ipv4/ip_forward
6. If forwarding is enabled, the number 1 is displayed; if forwarding is not enabled, the number 0 is displayed.
7. To enable Ip forwarding if it is not already enabled, type the following command:
Echo “0” > /proc/sys/net/ipv4/ip_forward
8. Assume that a computer running Linux is acting as a router for your network, It has two network interfaces to the local LANs using the lowest available IP address in each subnetwork on its interface to that network.
www.myitweb.weebly.com
Configuring NFS Client
1. Configuring a client system to use NFS involves making sure that the portmapper and NFS file locking daemons statd and lockd are available, adding entries to the clients /etc/fstab for the NFS exports and mounting the exports using the mount command.
2. Make sure that the portmapper is running on the client system using the portmap initialization script:
service portmap status
3. If the output says portmap is stopped (it shouldn’t be), start the portmapper:
service portmap start
4. Presumably, you have already started nfslock on the server, so all that remains is to start it on the client system:
service nfslock start
5. Now mount the file system. To mount /home from the server use following command
command as root:
mount –t nfs bubba:/home /home
6. If you want to mount by specifying client mount options. mount –t nfs bubba:/home /home –o rsize=8292,hard
a. rsize sets the NFS read buffer size to n bytes
b. Hard – enables failed NFS file operations to continue retrying after reporting “server not responding” on the system.
7. Using Automount Services
a. The easiest way for client systems to mount NFS exports is to use autofs, which automatically mounts file system not already mounted when the file system is first accessed.
www.myitweb.weebly.com
b. Autofs uses the automount daemon to mount and unmount file systems that automount has been configured to control.
c. Autofs uses a set of map files to control automounting. A master map file, /etc/auto.master, associates mount points with secondary map files. The secondary map files, in turn control the file systems
mounted under the corresponding mount points
d. Example consider the following /etc/auto.master autofs configure file:
/home /etc/auto.home
www.myitweb.weebly.com
NFS Advantages
1. The biggest advantage NFS provides is centralized administration, because