Networking chapter VI
-
Upload
jayakumar-balasubramanian -
Category
Technology
-
view
334 -
download
1
description
Transcript of Networking chapter VI
![Page 2: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/2.jpg)
Introduction to IPThe concept of ‘unreliability’Datagram delivery from source to
destinationCreates a ‘virtual path’ and forms the basis
of packet switchingTakes the optimal/shortest pathLearn the network topology and perform
‘routing’ functionalityIndependent of data link layer technology
![Page 3: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/3.jpg)
Recap of addressing
![Page 4: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/4.jpg)
The IP addressLogical address32 bit lengthIP address parts:
Network partHost part
Multiple classesClass AClass BClass CSpecial class
The ‘heart’ of routing
![Page 5: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/5.jpg)
Subnet maskThe subnet mask is
used to get the network portion of the IP address.
This is basically achieved by performing logical AND.
By looking into the subnet mask we can determine the class of the IP address.
The concept of ‘subnetting’
![Page 6: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/6.jpg)
Example
![Page 7: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/7.jpg)
The concept of ‘routing’
![Page 8: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/8.jpg)
Some more conceptsRoute types:
Network specific routeHost specific routeDefault route
Type of protocolsRouting protocols (Ex) OSPF,
BGPRouted protocols (Ex) TCP,
DNS, SNMP
Data link layer Maximum Transfer Unit
(MTU)Segmentation and re-
assembly (SAR)
![Page 9: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/9.jpg)
Special class of IP addressesBroadcast AddressMulticast AddressLoop back Address
![Page 10: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/10.jpg)
The concept of MulticastingHave you used Yahoo/Google groups?Instead of sending a separate copy of the
data for each recipient, the source ends the data only once.
Unicast does mass mailings; Multicast does chain letters.
Advantages: Cost-efficient Timely distribution of data Reduces WAN traffic
![Page 11: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/11.jpg)
Multicast IP addressesThe IP address belongs to ‘Class D’Ranges from 224.0.0.0 to 239.255.255.255Each address corresponds to a particular
group/pre-defined protocol.224.0.0.1 is for “All-hosts-in-LAN”
![Page 12: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/12.jpg)
Sockets and multicasting optionsThe ‘setsockopt’ API:
setsockopt (int sockFd, int level, int optname, const void* optval, socklen_t optlen);
level : IPPROTO_IP opt-name: IP_ADD_MEMBERSHIP IP_DROP_MEMBERSHIP
![Page 13: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/13.jpg)
struct ip_mreqstruct ip_mreq{ struct in_addr imr_multiaddr; struct in_addr imr_interface;};
![Page 14: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/14.jpg)
The ‘xinetd’ daemonThe ‘xinetd’ is a replacement for ‘inetd’, the
internet services daemon.Each internet services are categorized based
on port number.The daemons in Linux are started when the
system is booting up. Basically all standard servers (Telnet, FTP, SSH, etc..) are started in the similar way.
Our idea is to make our server program as a daemon and try out some things.
![Page 15: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/15.jpg)
Some basicsThe syntax of ‘select()’ and brush up.Standard socket descriptors: STDIN and
STDOUT.Linux specific:
• The /etc directory• The *.conf files in Linux
![Page 16: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/16.jpg)
The /etc/services fileDefines the sockets and protocols used for
Internet services. Each service is listed on a single line
corresponding to the form:Syntax:ServiceName PortNumber/ProtocolName Aliases
ServiceName - Specifies an official Internet service PortNumber - Specifies the socket port number user ProtocolName - Specifies the transport protocol used Aliases - Specifies a list of unofficial service names.
![Page 17: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/17.jpg)
Example echo 7/tcp echo 7/udp discard 9/tcp
sink null discard 9/udp sink null daytime 13/tcp
daytime 13/udp chargen 19/tcp ttytst source chargen 19/udp ttytst source ftp 21/tcp time 37/tcp timeserver
![Page 18: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/18.jpg)
The /etc/xinetd.conf filexinetd.conf is the configuration file that
determines the services provided by xinetd. Any line whose first non-white-space
character is a '#' is considered a comment line. Empty lines are ignored.
Each entry defines a service identified by the service_name.
This is where the service specific details are provided.
![Page 19: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/19.jpg)
Syntax and Exampleservice <service_name> {
<attribute> <assign_op> <value> <value> ... ...
}
service SMTP { socket type = streamprotocol = tcpwait = nouser = mailserver = /usr/sbin/exim
}
![Page 20: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/20.jpg)
Inside your programImportant points:
Use ‘select’ and STDIN combination for receiving client requests.
Use STDOUT for sending the data out to clients.
Restarting the ‘xinetd’
/etc/init.d/xinetd restart
![Page 21: Networking chapter VI](https://reader036.fdocuments.us/reader036/viewer/2022062513/55597276d8b42a60298b494f/html5/thumbnails/21.jpg)
Web : http://www.jwritings.comEmail: [email protected]