SlideShare a Scribd company logo
1 of 9
Download to read offline
Linux Interview Essentials – Part II (TCP/IP & Socket programming)
Emertxe Information Technologies
1 Basics:
1. What is difference between LAN, MAN and WAN?
LAN is a private network used in small offices or homes usually within 1km range with high speed
transfer data rate and fulltime service connectivity in low cost. WAN covers a large geographical
area for example, a country or a continent. Its data transfer data is usually low as compared to
LAN, but it is compatible with a variety of access lines and has an advanced security. MAN covers
an area bigger than LAN within a city or town and serves as an ISP for larger LAN. It uses optical
fibers or wireless infrastructure to link the LANs therefore, providing high speed regional resource
sharing.
2. Explain OSI layers in detail
3. Explain TCP/IP layers in detail
Linux Interview Essentials – Part II (TCP/IP & Socket programming)
Emertxe Information Technologies
4. What is the fundamental difference between OSI model & TCP/IP model?
OSI model is a reference model, which mentions about functionality of each of the layers. TCP/IP
model is a derived model from OSI, which practically implements the OSI functionalities.
5. What other models you know other than TCP/IP that are derived based on OSI?
 AppleTalk
 IPX
 SNA
 UMTS
6. What are the differences between Hub / Switch / Router?
 Hub
A network hub is designed to connect computers to each other with no real understanding of what
it is transferring. When a hub receives a packet of data from a connected device, it broadcasts
that data packet to all other connected devices regardless of which one ends up being the final
destination. Working at layer 1 (Refer OSI model)
 Switch
A network switch also connects computers to each other, like a hub. Where the switch differs from
a hub is in the way it handles packets of data. When a switch receives a packet of data, it
determines what computer or device the packet is intended for and sends it to that computer
only. Traditional switching operates at layer 2 but layer 3 switches also available
 Router
A network router is quite different from a switch or hub since its primary function is to route data
packets to other networks, instead of just the local computers. A router is quite common to find in
homes and businesses since it allows your network to communicate with other networks including
the Internet. Operates at layer 3
2 TCP/IP addressing:
1. What is a MAC address? What is its significance?
A media access control address (MAC address), also called physical address, is a unique identifier
assigned to network interfaces for communications on the physical network segment. MAC
addresses are used as a network address for most network technologies, including Ethernet and
Wi-Fi. Logically, MAC addresses are used in the media access control protocol sublayer of the OSI
reference model.
MAC addresses are most often assigned by the manufacturer of a network interface controller
(NIC) and are stored in its hardware.
Linux Interview Essentials – Part II (TCP/IP & Socket programming)
Emertxe Information Technologies
2. What is an IP address? What is its significance?
An IP address is an identifier/address for a computer or device on a TCP/IP network. Where the
networks using the TCP/IP protocol and route messages based on the IP address of the destination.
The format of an IP address is a 32-bit numeric address written as four numbers separated by
periods. Each number can be 0 to 255. For example, 192.168.32.12 could be an IP address. IP have
two parts network and host part.
3. What is port number? What is its significance?
A port number is the logical address of each application or process that uses a network or the
Internet to communicate. A port number uniquely identifies a network-based application on a
computer. Each application/program is allocated a 16-bit integer port number.
Port numbers are mainly used in TCP and UDP based networks, with an available range of 0-65,535
for assigning port numbers. Although an application can change its port number, some commonly
used Internet/network services are allocated with global port numbers such as Port Number 80 for
HTTP, 23 for Telnet and 25 for SMTP.
4. What are various classes of IP address?
Class Theoretical Address Range Binary Start
A 0.0.0.0 to 127.255.255.255 0
B 128.0.0.0 to 191.255.255.255 10
C 192.0.0.0 to 223.255.255.255 110
D 224.0.0.0 to 239.255.255.255 1110
5. What is a netmask? Explain its significance
A netmask is a 32-bit mask used to divide an IP address into subnets and specify the network's
available hosts. In a netmask, two bits are always automatically assigned. For example, in
255.255.225.0, "0" is the assigned network address. In 255.255.255.255, "255" is the assigned
broadcast address.
6. What is IPv4 and IPv6 addresses? Explain their differences
An IP address is binary numbers but can be stored as text for human readers. For example, a 32-
bit numeric address (IPv4) is written in decimal as four numbers separated by periods. Each
number can be zero to 255. For example, 1.160.10.240 could be an IP address.
IPv6 addresses are 128-bit IP address written in hexadecimal and separated by colons. An example
IPv6 address could be written like this: 3ffe:1900:4545:3:200:f8ff:fe21:67cf
Advantages of IPv6 over IPv4:
 IPv6 simplified the router’s task compared to IPv4.
 IPv6 is more compatible to mobile networks than IPv4.
 IPv6 allows for bigger payloads than what is allowed in IPv4.
 IPv6 is used by less than 1% of the networks, while IPv4 is still in use by the remaining 99%.
7. Explain differences between different types of ports.
 Well known ports
Well known ports are used by system or processes run by root or with specific privileges.
The port numbers range from 0 to 1023.
 System ports
Same as well-known ports
 User ports /Registered ports
The registered port numbers range from 1024-49151. Such ports are used by programs run
by users in the system.
Linux Interview Essentials – Part II (TCP/IP & Socket programming)
Emertxe Information Technologies
 Dynamic / Private ports
Private ports are not assigned for any specific purpose. Its range are from range 49152–
65535
8. Explain importance of following Linux Networking commands:
 ifconfig
To get IP address as well as MAC address of system interfaces.
 Traceroute
To get the route of each packet from source to destination
 Nslookup / host
To convert a domain name to IP address.
 Netstat
Current network status of application using network
 ping
To check connectivity between two system using ICMP protocol
9. Explain TCP three-way handshake steps in detail
Before the sending device and the receiving device start the exchange of data, both devices need
to be synchronized. During the TCP initialization process, the sending device and the receiving
device exchange a few control packets for synchronization purposes. This exchange is known as
Three-way handshake.
Step 1. Device A (Client) sends a TCP segment with SYN = 1, ACK = 0, ISN (Initial Sequence
Number) = 2000. Refer TCP header
An Initial Sequence Number (ISN) is a random Sequence Number, allocated for the first packet in a
new TCP connection.
The Active Open device (Device A) sends a segment with the SYN flag set to 1, ACK flag set to 0
and an Initial Sequence Number 2000 (For Example), which marks the beginning of the sequence
numbers for data that device A will transmit. SYN is short for SYNchronize. SYN flag announces an
attempt to open a connection.
Step 2. Device B (Server) receives Device A's TCP segment and returns a TCP segment with SYN =
1, ACK = 1, ISN = 5000 (Device B's Initial Sequence Number), Acknowledgment Number = 2001
(2000 + 1, the next sequence number Device B expecting from Device A).Refer TCP header
Step 3. Device A sends a TCP segment to Device B that acknowledges receipt of Device B's ISN,
With flags set as SYN = 0, ACK = 1, Sequence number = 2001, Acknowledgment number = 5001
(5000 + 1, the next sequence number Device A expecting from Device B)
This handshaking technique is referred to as TCP Three-way handshake or SYN, SYN-ACK, ACK.
After the Three-way handshake, the connection is open and the participant computers start
sending data using the agreed sequence and acknowledge numbers.
Linux Interview Essentials – Part II (TCP/IP & Socket programming)
Emertxe Information Technologies
10. What is the difference between TCP and UDP
TCP UDP
 Connection oriented TCP
 Reliable delivery
 In-order guaranteed
 Three way handshake
 More network BW
 Connectionless UDP
 Unreliable delivery
 No-order guarantees
 No notion of “connection”
 Less network BW
11. Explain various fields of TCP header
Source Port: 16 bits
The source port number.
Destination Port: 16 bits
The destination port number.
Sequence Number: 32 bits
The sequence number of the first data octet in this segment (except when SYN is present). If SYN
is present the sequence number is the initial sequence number (ISN) and the first data octet is
ISN+1.
Acknowledgment Number: 32 bits
If the ACK control bit is set this field contains the value of the next sequence number the sender
of the segment is expecting to receive. Once a connection is established this is always sent.
Data Offset (Header len) : 4 bits
The number of 32 bit words in the TCP Header. This indicates where
the data begins. The TCP header (even one including options) is an
integral number of 32 bits long.
Control Bits: 6 bits (from left to right):
URG: Urgent Pointer field significant
ACK: Acknowledgment field significant
PSH: Push Function
RST: Reset the connection
SYN: Synchronize sequence numbers
FIN: No more data from sender
Linux Interview Essentials – Part II (TCP/IP & Socket programming)
Emertxe Information Technologies
12. Explain various fields of IP header
Version:
IPv4 or IPv6
Source and destination IP address:
This fields store the source and destination address respectively. Since size of these fields will vary
according to version (IPv4 – 32bit, IPv6 – 128 bit).
13. Explain various fields of UDP header
14. Given an application you need to choose between TCP and UDP. Compare them with respect to
speed, cost and reliability
Refer Qn 10
15. Briefly explain how routing works?
Routing is the process of forwarding IP packets using routing table from one network to another. A
router is a device that joins networks together and routes traffic between them.
A routing table is a set of rules, often viewed in table format that is used to determine where data
packets traveling over an Internet Protocol (IP) network will be directed. All IP-enabled devices,
including routers and switches, use routing tables.
3 TCP/IP protocols – Brief working details:
1. SNMP
Simple Network Management Protocol (SNMP) is an Internet-standard protocol for collecting and
organizing information about managed devices on IP networks and for modifying that information
to change device behavior. Devices that typically support SNMP include routers, switches, servers,
workstations, printers, modem racks and more.
SNMP is widely used in network management systems to monitor network-attached devices for
Linux Interview Essentials – Part II (TCP/IP & Socket programming)
Emertxe Information Technologies
conditions that warrant administrative attention. SNMP exposes management data in the form of
variables on the managed systems, which describe the system configuration. These variables can
then be queried (and sometimes set) by managing applications.
2. ICMP
ICMP (Internet Control Message Protocol) is an error-reporting protocol network devices like
routers use to generate error messages to the source IP address when network problems prevent
delivery of IP packets. ICMP creates and sends messages to the source IP address indicating that a
gateway to the Internet that a router, service or host cannot be reached for packet delivery. Any
IP network device has the capability to send, receive or process ICMP messages. ICMP is not a
transport protocol that sends data between systems.
3. ARP & RARP
The address resolution protocol (ARP) is a protocol used by the Internet Protocol (IP) [RFC826],
specifically IPv4, to map IP network addresses to the hardware addresses used by a data link
protocol. The protocol operates below the network layer as a part of the interface between the
OSI network and OSI link layer.
The Reverse Address Resolution Protocol (RARP) is an obsolete computer networking protocol used
by a client computer to request its Internet Protocol (IPv4) address from a computer network,
when all it has available is its link layer or hardware address, such as a MAC address.
4. DNS
The domain name system (DNS) is the way that Internet domain names are located and translated
into Internet Protocol addresses. A domain name is a meaningful and easy-to-remember "handle"
for an Internet address. Because maintaining a central list of domain name/IP address
correspondences would be impractical, the lists of domain names and IP addresses are distributed
throughout the Internet in a hierarchy of authority. There is probably a DNS server within close
geographic proximity to your access provider that maps the domain names in your Internet
requests or forwards them to other servers in the Internet.
5. DHCP
DHCP (Dynamic Host Configuration Protocol) is a communications protocol that network
administrators use to centrally manage and automate the network configuration of devices
attaching to an Internet Protocol (IP) network. DHCP allows devices needing an IP address to
request one when they are starting up, for example, rather than an address preassigned and
manually configured on each device. With DHCP, if a device is moved from place to place, it will
be assigned a new address in each location.
4 Socket programming
1. What is a socket? How it is different compared to other system calls?
A socket is just a logical endpoint for communication. They exist on the transport layer. You can
send and receive data on a socket. A socket is bind to a protocol, machine, and port.
Using socket we can communicate between process in same system as well as process in different
device over network.
Linux Interview Essentials – Part II (TCP/IP & Socket programming)
Emertxe Information Technologies
2. Explain system calls used in TCP client and server.
3. Explain TCP client and server system calls and three-way handshake
Three way handshake happens between connect and accept. Ref Qn 9
4. Is bind() is mandatory in the client side? Justify your answer.
Bind is optional in client side. When we do a connect request from the client bind will happen
automatically.
5. What is host byte order and network byte order? Explain
Since machines will have different type of byte orders (little endian v/s big endian), it will create
undesired issues in the network. In order to ensure consistency network (big endian) byte
order to be used as a standard. There are multiple help functions (for conversion) available
which can be used for this purpose.
uint16_t htons(uint16_t host_short);
uint16_t ntohs(uint16_t network_short);
uint32_t htonl(uint32_t host_long);
uint32_t ntohl(uint32_t network_long);
6. What is control connection and what is data connection? Explain with respect to socket() and
accept() system calls.
In server program of a TCP/IP connection we will get two socket fds.
1. From socket system call, which we need to bind with IP and port number. This socket fd is
called as control socket. We use this socket to accept connections from multiple clients.
With one control socket we can accept any number of clients.
2. When accept multiple connections we need one more fd to send/receive data with client.
That fd we will receive from accept system call which called as data socket.
7. What is the difference between send() and sendto()?
Send is using for TCP/IP connection where we only send data. Sendto using for UDP connection
where we need send data as well as destination details (IP and PORT).
Linux Interview Essentials – Part II (TCP/IP & Socket programming)
Emertxe Information Technologies
8. Define iterative server and concurrent server. What are their advantages and disadvantages?
Iterative server Con-current server
Pros:
– Simple
– Reduced network overhead
– Less CPU intensive
– Higher single-threaded transaction throughput
Cons:
– Severely limits concurrent access
– Server is locked while dealing with one client
Pros:
– Concurrent access
– Can run longer since no one is waiting for
completion
– Only one listener for many clients
Cons
– Increased network overhead
– More CPU and resource intensive
9. What is the importance of select () system call? Explain it in the context of synchronous I/O
Select is a system call which help to write a concurrent server in one process. It also used to
examine the status of file descriptors of open input/output channels. The select system call is
similar to the polling in operating systems. Select loop uses the select system call to sleep until a
condition occurs on a file descriptor (e.g., when data is available for reading) or a timeout occurs.
By examining the return parameters of the select call, the loop finds out which file descriptor has
changed and executes the appropriate code to read/write to file descriptor.
10. What is a RAW socket? Explain its importance
Using RAW packet we can read the packet directly from physical layer. Means it will by-pass
transport and network layer and directly passed application layer.
If you want implement your own protocols on top of physical layer, we can use RAW packet data.
5 Application specific:
1. I type www.google.com in Chrome. Explain various protocols that helps to make browsing
happen
 The browser extracts the domain name from the URL.
 The browser queries DNS for the IP address of the URL. If neither the browser nor the
OS have a cached copy of the IP address, then a request is sent off to the system's
configured DNS server.
 If that DNS server has the address for that domain, it will return it. Otherwise, it will
forward the query along to DNS server it is configured to defer to.
 The web browser then assembles an HTTP request, which consists of a header and
optional content.
 This HTTP request is sent off to the web server host (via TCP/IP/MAC layer protocols)
as some number of packets, each of which is routed in the same way as the earlier
DNS query. (The packets have sequence numbers that allow them to be reassembled in
order even if they take different paths.)
 In the routing side there are a set of routing protocols (RIP, IGMP, OSPF etc..) which
routes the packet from the source (your machine) to the web-server. This follows
complex routing algorithm
 Once the request arrives at the webserver, it generates a response (this may be a
static page, served as-is, or a more dynamic response, generated in any number of
ways.) The web server software sends the generated page back to the client in the
similar way.
2. List of protocols that doesn’t use IP address
DHCP, ICMP, IGRP, ARP etc

More Related Content

What's hot

Network tunneling techniques
Network tunneling techniquesNetwork tunneling techniques
Network tunneling techniquesinbroker
 
Point To Point Protocol
Point To Point ProtocolPoint To Point Protocol
Point To Point ProtocolPhan Vuong
 
ARM architcture
ARM architcture ARM architcture
ARM architcture Hossam Adel
 
Network address translation
Network address translationNetwork address translation
Network address translationMohak Kaushik
 
HDLC(High level Data Link Control)
HDLC(High level Data Link Control)HDLC(High level Data Link Control)
HDLC(High level Data Link Control)sonangrai
 
Chorus - Distributed Operating System [ case study ]
Chorus - Distributed Operating System [ case study ]Chorus - Distributed Operating System [ case study ]
Chorus - Distributed Operating System [ case study ]Akhil Nadh PC
 
Network lab manual
Network lab manualNetwork lab manual
Network lab manualPrabhu D
 
Device drivers and interrupt service mechanism
Device drivers and interrupt service mechanismDevice drivers and interrupt service mechanism
Device drivers and interrupt service mechanismVijay Kumar
 

What's hot (20)

Network tunneling techniques
Network tunneling techniquesNetwork tunneling techniques
Network tunneling techniques
 
Embedded linux network device driver development
Embedded linux network device driver developmentEmbedded linux network device driver development
Embedded linux network device driver development
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 
Point To Point Protocol
Point To Point ProtocolPoint To Point Protocol
Point To Point Protocol
 
Linux-Internals-and-Networking
Linux-Internals-and-NetworkingLinux-Internals-and-Networking
Linux-Internals-and-Networking
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
 
Advanced C - Part 2
Advanced C - Part 2Advanced C - Part 2
Advanced C - Part 2
 
Embedded C - Day 2
Embedded C - Day 2Embedded C - Day 2
Embedded C - Day 2
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Embedded Linux - Building toolchain
Embedded Linux - Building toolchainEmbedded Linux - Building toolchain
Embedded Linux - Building toolchain
 
6LoWPAN: An Open IoT Networking Protocol
6LoWPAN: An Open IoT Networking Protocol6LoWPAN: An Open IoT Networking Protocol
6LoWPAN: An Open IoT Networking Protocol
 
ARM architcture
ARM architcture ARM architcture
ARM architcture
 
Ipv6
Ipv6Ipv6
Ipv6
 
Network address translation
Network address translationNetwork address translation
Network address translation
 
HDLC(High level Data Link Control)
HDLC(High level Data Link Control)HDLC(High level Data Link Control)
HDLC(High level Data Link Control)
 
Chorus - Distributed Operating System [ case study ]
Chorus - Distributed Operating System [ case study ]Chorus - Distributed Operating System [ case study ]
Chorus - Distributed Operating System [ case study ]
 
Network lab manual
Network lab manualNetwork lab manual
Network lab manual
 
Embedded systems course - student resume template
Embedded systems course - student resume templateEmbedded systems course - student resume template
Embedded systems course - student resume template
 
Device drivers and interrupt service mechanism
Device drivers and interrupt service mechanismDevice drivers and interrupt service mechanism
Device drivers and interrupt service mechanism
 

Viewers also liked

Vba Macros Interoperability
Vba Macros InteroperabilityVba Macros Interoperability
Vba Macros InteroperabilityRajesh Sola
 
fudcon-fedora-arm-iot-rajeshsola
fudcon-fedora-arm-iot-rajeshsolafudcon-fedora-arm-iot-rajeshsola
fudcon-fedora-arm-iot-rajeshsolaRajesh Sola
 
aoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsolaaoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsolaRajesh Sola
 
Getting started with IOT Development using Fedora on ARM
Getting started with IOT Development using Fedora on ARMGetting started with IOT Development using Fedora on ARM
Getting started with IOT Development using Fedora on ARMRajesh Sola
 
Go Green - Save Power
Go Green - Save PowerGo Green - Save Power
Go Green - Save PowerRajesh Sola
 
Windows Internals for Linux Kernel Developers
Windows Internals for Linux Kernel DevelopersWindows Internals for Linux Kernel Developers
Windows Internals for Linux Kernel DevelopersKernel TLV
 
Hands on with embedded linux using zero hardware
Hands on with embedded linux using zero hardwareHands on with embedded linux using zero hardware
Hands on with embedded linux using zero hardwareRajesh Sola
 
Kickstarting IOT using NodeRED
Kickstarting IOT using NodeREDKickstarting IOT using NodeRED
Kickstarting IOT using NodeREDRajesh Sola
 
Using Node-RED for building IoT workflows
Using Node-RED for building IoT workflowsUsing Node-RED for building IoT workflows
Using Node-RED for building IoT workflowsAniruddha Chakrabarti
 

Viewers also liked (20)

Linux Internals - Interview essentials 3.0
Linux Internals - Interview essentials 3.0Linux Internals - Interview essentials 3.0
Linux Internals - Interview essentials 3.0
 
Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)
 
Linux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platformLinux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platform
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
Embedded C
Embedded CEmbedded C
Embedded C
 
Vba Macros Interoperability
Vba Macros InteroperabilityVba Macros Interoperability
Vba Macros Interoperability
 
fudcon-fedora-arm-iot-rajeshsola
fudcon-fedora-arm-iot-rajeshsolafudcon-fedora-arm-iot-rajeshsola
fudcon-fedora-arm-iot-rajeshsola
 
Linux internals v4
Linux internals v4Linux internals v4
Linux internals v4
 
aoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsolaaoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsola
 
Getting started with IOT Development using Fedora on ARM
Getting started with IOT Development using Fedora on ARMGetting started with IOT Development using Fedora on ARM
Getting started with IOT Development using Fedora on ARM
 
Go Green - Save Power
Go Green - Save PowerGo Green - Save Power
Go Green - Save Power
 
Windows Internals for Linux Kernel Developers
Windows Internals for Linux Kernel DevelopersWindows Internals for Linux Kernel Developers
Windows Internals for Linux Kernel Developers
 
Hands on with embedded linux using zero hardware
Hands on with embedded linux using zero hardwareHands on with embedded linux using zero hardware
Hands on with embedded linux using zero hardware
 
Kickstarting IOT using NodeRED
Kickstarting IOT using NodeREDKickstarting IOT using NodeRED
Kickstarting IOT using NodeRED
 
Using Node-RED for building IoT workflows
Using Node-RED for building IoT workflowsUsing Node-RED for building IoT workflows
Using Node-RED for building IoT workflows
 
Linux Programming
Linux ProgrammingLinux Programming
Linux Programming
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 
Data Structures & Algorithm design using C
Data Structures & Algorithm design using C Data Structures & Algorithm design using C
Data Structures & Algorithm design using C
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 

Similar to Linux Internals - Interview essentials 2.0

07 - TCP_IP and the DoD Model.ppt
07 - TCP_IP and the DoD Model.ppt07 - TCP_IP and the DoD Model.ppt
07 - TCP_IP and the DoD Model.pptssuserf7cd2b
 
Report on ip addresses
Report on ip addressesReport on ip addresses
Report on ip addressesAmandeep Kaur
 
Лекц 7
Лекц 7Лекц 7
Лекц 7Muuluu
 
5 configuring TCP/IP
5 configuring TCP/IP5 configuring TCP/IP
5 configuring TCP/IPHameda Hurmat
 
Lecture 2 -_understanding_networks_with_presenter_notes
Lecture 2 -_understanding_networks_with_presenter_notesLecture 2 -_understanding_networks_with_presenter_notes
Lecture 2 -_understanding_networks_with_presenter_notesSerious_SamSoul
 
Exploration network chapter_5_modified
Exploration network chapter_5_modifiedExploration network chapter_5_modified
Exploration network chapter_5_modifiedrajesh531
 
Internet protocol (ip) ppt
Internet protocol (ip) pptInternet protocol (ip) ppt
Internet protocol (ip) pptDulith Kasun
 
Ip protocol
Ip protocolIp protocol
Ip protocolH K
 
16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)Jeff Green
 
Chapter2ccna
Chapter2ccnaChapter2ccna
Chapter2ccnarobertoxe
 
ip addressing & routing
 ip addressing & routing ip addressing & routing
ip addressing & routingVikas Jagtap
 
Automation and Robotics 20ME51I_Week_3_Practicals.pdf
Automation and Robotics 20ME51I_Week_3_Practicals.pdfAutomation and Robotics 20ME51I_Week_3_Practicals.pdf
Automation and Robotics 20ME51I_Week_3_Practicals.pdfGandhibabu8
 

Similar to Linux Internals - Interview essentials 2.0 (20)

07 - TCP_IP and the DoD Model.ppt
07 - TCP_IP and the DoD Model.ppt07 - TCP_IP and the DoD Model.ppt
07 - TCP_IP and the DoD Model.ppt
 
Hardware9
Hardware9Hardware9
Hardware9
 
IP Address
IP AddressIP Address
IP Address
 
Report on ip addresses
Report on ip addressesReport on ip addresses
Report on ip addresses
 
Лекц 7
Лекц 7Лекц 7
Лекц 7
 
5 configuring TCP/IP
5 configuring TCP/IP5 configuring TCP/IP
5 configuring TCP/IP
 
More on Tcp/Ip
More on Tcp/IpMore on Tcp/Ip
More on Tcp/Ip
 
Lecture 2 -_understanding_networks_with_presenter_notes
Lecture 2 -_understanding_networks_with_presenter_notesLecture 2 -_understanding_networks_with_presenter_notes
Lecture 2 -_understanding_networks_with_presenter_notes
 
Exploration network chapter_5_modified
Exploration network chapter_5_modifiedExploration network chapter_5_modified
Exploration network chapter_5_modified
 
Internet protocol (ip) ppt
Internet protocol (ip) pptInternet protocol (ip) ppt
Internet protocol (ip) ppt
 
Ip protocol
Ip protocolIp protocol
Ip protocol
 
C14-TCPIP.ppt
C14-TCPIP.pptC14-TCPIP.ppt
C14-TCPIP.ppt
 
TCP/IP Introduction
TCP/IP IntroductionTCP/IP Introduction
TCP/IP Introduction
 
Internet Protocol
Internet ProtocolInternet Protocol
Internet Protocol
 
16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)
 
Network Layer
Network LayerNetwork Layer
Network Layer
 
Chapter2ccna
Chapter2ccnaChapter2ccna
Chapter2ccna
 
Chapter2ccna
Chapter2ccnaChapter2ccna
Chapter2ccna
 
ip addressing & routing
 ip addressing & routing ip addressing & routing
ip addressing & routing
 
Automation and Robotics 20ME51I_Week_3_Practicals.pdf
Automation and Robotics 20ME51I_Week_3_Practicals.pdfAutomation and Robotics 20ME51I_Week_3_Practicals.pdf
Automation and Robotics 20ME51I_Week_3_Practicals.pdf
 

More from Emertxe Information Technologies Pvt Ltd

More from Emertxe Information Technologies Pvt Ltd (20)

premium post (1).pdf
premium post (1).pdfpremium post (1).pdf
premium post (1).pdf
 
Career Transition (1).pdf
Career Transition (1).pdfCareer Transition (1).pdf
Career Transition (1).pdf
 
10_isxdigit.pdf
10_isxdigit.pdf10_isxdigit.pdf
10_isxdigit.pdf
 
01_student_record.pdf
01_student_record.pdf01_student_record.pdf
01_student_record.pdf
 
02_swap.pdf
02_swap.pdf02_swap.pdf
02_swap.pdf
 
01_sizeof.pdf
01_sizeof.pdf01_sizeof.pdf
01_sizeof.pdf
 
07_product_matrix.pdf
07_product_matrix.pdf07_product_matrix.pdf
07_product_matrix.pdf
 
06_sort_names.pdf
06_sort_names.pdf06_sort_names.pdf
06_sort_names.pdf
 
05_fragments.pdf
05_fragments.pdf05_fragments.pdf
05_fragments.pdf
 
04_magic_square.pdf
04_magic_square.pdf04_magic_square.pdf
04_magic_square.pdf
 
03_endianess.pdf
03_endianess.pdf03_endianess.pdf
03_endianess.pdf
 
02_variance.pdf
02_variance.pdf02_variance.pdf
02_variance.pdf
 
01_memory_manager.pdf
01_memory_manager.pdf01_memory_manager.pdf
01_memory_manager.pdf
 
09_nrps.pdf
09_nrps.pdf09_nrps.pdf
09_nrps.pdf
 
11_pangram.pdf
11_pangram.pdf11_pangram.pdf
11_pangram.pdf
 
10_combinations.pdf
10_combinations.pdf10_combinations.pdf
10_combinations.pdf
 
08_squeeze.pdf
08_squeeze.pdf08_squeeze.pdf
08_squeeze.pdf
 
07_strtok.pdf
07_strtok.pdf07_strtok.pdf
07_strtok.pdf
 
06_reverserec.pdf
06_reverserec.pdf06_reverserec.pdf
06_reverserec.pdf
 
05_reverseiter.pdf
05_reverseiter.pdf05_reverseiter.pdf
05_reverseiter.pdf
 

Recently uploaded

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Recently uploaded (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

Linux Internals - Interview essentials 2.0

  • 1. Linux Interview Essentials – Part II (TCP/IP & Socket programming) Emertxe Information Technologies 1 Basics: 1. What is difference between LAN, MAN and WAN? LAN is a private network used in small offices or homes usually within 1km range with high speed transfer data rate and fulltime service connectivity in low cost. WAN covers a large geographical area for example, a country or a continent. Its data transfer data is usually low as compared to LAN, but it is compatible with a variety of access lines and has an advanced security. MAN covers an area bigger than LAN within a city or town and serves as an ISP for larger LAN. It uses optical fibers or wireless infrastructure to link the LANs therefore, providing high speed regional resource sharing. 2. Explain OSI layers in detail 3. Explain TCP/IP layers in detail
  • 2. Linux Interview Essentials – Part II (TCP/IP & Socket programming) Emertxe Information Technologies 4. What is the fundamental difference between OSI model & TCP/IP model? OSI model is a reference model, which mentions about functionality of each of the layers. TCP/IP model is a derived model from OSI, which practically implements the OSI functionalities. 5. What other models you know other than TCP/IP that are derived based on OSI?  AppleTalk  IPX  SNA  UMTS 6. What are the differences between Hub / Switch / Router?  Hub A network hub is designed to connect computers to each other with no real understanding of what it is transferring. When a hub receives a packet of data from a connected device, it broadcasts that data packet to all other connected devices regardless of which one ends up being the final destination. Working at layer 1 (Refer OSI model)  Switch A network switch also connects computers to each other, like a hub. Where the switch differs from a hub is in the way it handles packets of data. When a switch receives a packet of data, it determines what computer or device the packet is intended for and sends it to that computer only. Traditional switching operates at layer 2 but layer 3 switches also available  Router A network router is quite different from a switch or hub since its primary function is to route data packets to other networks, instead of just the local computers. A router is quite common to find in homes and businesses since it allows your network to communicate with other networks including the Internet. Operates at layer 3 2 TCP/IP addressing: 1. What is a MAC address? What is its significance? A media access control address (MAC address), also called physical address, is a unique identifier assigned to network interfaces for communications on the physical network segment. MAC addresses are used as a network address for most network technologies, including Ethernet and Wi-Fi. Logically, MAC addresses are used in the media access control protocol sublayer of the OSI reference model. MAC addresses are most often assigned by the manufacturer of a network interface controller (NIC) and are stored in its hardware.
  • 3. Linux Interview Essentials – Part II (TCP/IP & Socket programming) Emertxe Information Technologies 2. What is an IP address? What is its significance? An IP address is an identifier/address for a computer or device on a TCP/IP network. Where the networks using the TCP/IP protocol and route messages based on the IP address of the destination. The format of an IP address is a 32-bit numeric address written as four numbers separated by periods. Each number can be 0 to 255. For example, 192.168.32.12 could be an IP address. IP have two parts network and host part. 3. What is port number? What is its significance? A port number is the logical address of each application or process that uses a network or the Internet to communicate. A port number uniquely identifies a network-based application on a computer. Each application/program is allocated a 16-bit integer port number. Port numbers are mainly used in TCP and UDP based networks, with an available range of 0-65,535 for assigning port numbers. Although an application can change its port number, some commonly used Internet/network services are allocated with global port numbers such as Port Number 80 for HTTP, 23 for Telnet and 25 for SMTP. 4. What are various classes of IP address? Class Theoretical Address Range Binary Start A 0.0.0.0 to 127.255.255.255 0 B 128.0.0.0 to 191.255.255.255 10 C 192.0.0.0 to 223.255.255.255 110 D 224.0.0.0 to 239.255.255.255 1110 5. What is a netmask? Explain its significance A netmask is a 32-bit mask used to divide an IP address into subnets and specify the network's available hosts. In a netmask, two bits are always automatically assigned. For example, in 255.255.225.0, "0" is the assigned network address. In 255.255.255.255, "255" is the assigned broadcast address. 6. What is IPv4 and IPv6 addresses? Explain their differences An IP address is binary numbers but can be stored as text for human readers. For example, a 32- bit numeric address (IPv4) is written in decimal as four numbers separated by periods. Each number can be zero to 255. For example, 1.160.10.240 could be an IP address. IPv6 addresses are 128-bit IP address written in hexadecimal and separated by colons. An example IPv6 address could be written like this: 3ffe:1900:4545:3:200:f8ff:fe21:67cf Advantages of IPv6 over IPv4:  IPv6 simplified the router’s task compared to IPv4.  IPv6 is more compatible to mobile networks than IPv4.  IPv6 allows for bigger payloads than what is allowed in IPv4.  IPv6 is used by less than 1% of the networks, while IPv4 is still in use by the remaining 99%. 7. Explain differences between different types of ports.  Well known ports Well known ports are used by system or processes run by root or with specific privileges. The port numbers range from 0 to 1023.  System ports Same as well-known ports  User ports /Registered ports The registered port numbers range from 1024-49151. Such ports are used by programs run by users in the system.
  • 4. Linux Interview Essentials – Part II (TCP/IP & Socket programming) Emertxe Information Technologies  Dynamic / Private ports Private ports are not assigned for any specific purpose. Its range are from range 49152– 65535 8. Explain importance of following Linux Networking commands:  ifconfig To get IP address as well as MAC address of system interfaces.  Traceroute To get the route of each packet from source to destination  Nslookup / host To convert a domain name to IP address.  Netstat Current network status of application using network  ping To check connectivity between two system using ICMP protocol 9. Explain TCP three-way handshake steps in detail Before the sending device and the receiving device start the exchange of data, both devices need to be synchronized. During the TCP initialization process, the sending device and the receiving device exchange a few control packets for synchronization purposes. This exchange is known as Three-way handshake. Step 1. Device A (Client) sends a TCP segment with SYN = 1, ACK = 0, ISN (Initial Sequence Number) = 2000. Refer TCP header An Initial Sequence Number (ISN) is a random Sequence Number, allocated for the first packet in a new TCP connection. The Active Open device (Device A) sends a segment with the SYN flag set to 1, ACK flag set to 0 and an Initial Sequence Number 2000 (For Example), which marks the beginning of the sequence numbers for data that device A will transmit. SYN is short for SYNchronize. SYN flag announces an attempt to open a connection. Step 2. Device B (Server) receives Device A's TCP segment and returns a TCP segment with SYN = 1, ACK = 1, ISN = 5000 (Device B's Initial Sequence Number), Acknowledgment Number = 2001 (2000 + 1, the next sequence number Device B expecting from Device A).Refer TCP header Step 3. Device A sends a TCP segment to Device B that acknowledges receipt of Device B's ISN, With flags set as SYN = 0, ACK = 1, Sequence number = 2001, Acknowledgment number = 5001 (5000 + 1, the next sequence number Device A expecting from Device B) This handshaking technique is referred to as TCP Three-way handshake or SYN, SYN-ACK, ACK. After the Three-way handshake, the connection is open and the participant computers start sending data using the agreed sequence and acknowledge numbers.
  • 5. Linux Interview Essentials – Part II (TCP/IP & Socket programming) Emertxe Information Technologies 10. What is the difference between TCP and UDP TCP UDP  Connection oriented TCP  Reliable delivery  In-order guaranteed  Three way handshake  More network BW  Connectionless UDP  Unreliable delivery  No-order guarantees  No notion of “connection”  Less network BW 11. Explain various fields of TCP header Source Port: 16 bits The source port number. Destination Port: 16 bits The destination port number. Sequence Number: 32 bits The sequence number of the first data octet in this segment (except when SYN is present). If SYN is present the sequence number is the initial sequence number (ISN) and the first data octet is ISN+1. Acknowledgment Number: 32 bits If the ACK control bit is set this field contains the value of the next sequence number the sender of the segment is expecting to receive. Once a connection is established this is always sent. Data Offset (Header len) : 4 bits The number of 32 bit words in the TCP Header. This indicates where the data begins. The TCP header (even one including options) is an integral number of 32 bits long. Control Bits: 6 bits (from left to right): URG: Urgent Pointer field significant ACK: Acknowledgment field significant PSH: Push Function RST: Reset the connection SYN: Synchronize sequence numbers FIN: No more data from sender
  • 6. Linux Interview Essentials – Part II (TCP/IP & Socket programming) Emertxe Information Technologies 12. Explain various fields of IP header Version: IPv4 or IPv6 Source and destination IP address: This fields store the source and destination address respectively. Since size of these fields will vary according to version (IPv4 – 32bit, IPv6 – 128 bit). 13. Explain various fields of UDP header 14. Given an application you need to choose between TCP and UDP. Compare them with respect to speed, cost and reliability Refer Qn 10 15. Briefly explain how routing works? Routing is the process of forwarding IP packets using routing table from one network to another. A router is a device that joins networks together and routes traffic between them. A routing table is a set of rules, often viewed in table format that is used to determine where data packets traveling over an Internet Protocol (IP) network will be directed. All IP-enabled devices, including routers and switches, use routing tables. 3 TCP/IP protocols – Brief working details: 1. SNMP Simple Network Management Protocol (SNMP) is an Internet-standard protocol for collecting and organizing information about managed devices on IP networks and for modifying that information to change device behavior. Devices that typically support SNMP include routers, switches, servers, workstations, printers, modem racks and more. SNMP is widely used in network management systems to monitor network-attached devices for
  • 7. Linux Interview Essentials – Part II (TCP/IP & Socket programming) Emertxe Information Technologies conditions that warrant administrative attention. SNMP exposes management data in the form of variables on the managed systems, which describe the system configuration. These variables can then be queried (and sometimes set) by managing applications. 2. ICMP ICMP (Internet Control Message Protocol) is an error-reporting protocol network devices like routers use to generate error messages to the source IP address when network problems prevent delivery of IP packets. ICMP creates and sends messages to the source IP address indicating that a gateway to the Internet that a router, service or host cannot be reached for packet delivery. Any IP network device has the capability to send, receive or process ICMP messages. ICMP is not a transport protocol that sends data between systems. 3. ARP & RARP The address resolution protocol (ARP) is a protocol used by the Internet Protocol (IP) [RFC826], specifically IPv4, to map IP network addresses to the hardware addresses used by a data link protocol. The protocol operates below the network layer as a part of the interface between the OSI network and OSI link layer. The Reverse Address Resolution Protocol (RARP) is an obsolete computer networking protocol used by a client computer to request its Internet Protocol (IPv4) address from a computer network, when all it has available is its link layer or hardware address, such as a MAC address. 4. DNS The domain name system (DNS) is the way that Internet domain names are located and translated into Internet Protocol addresses. A domain name is a meaningful and easy-to-remember "handle" for an Internet address. Because maintaining a central list of domain name/IP address correspondences would be impractical, the lists of domain names and IP addresses are distributed throughout the Internet in a hierarchy of authority. There is probably a DNS server within close geographic proximity to your access provider that maps the domain names in your Internet requests or forwards them to other servers in the Internet. 5. DHCP DHCP (Dynamic Host Configuration Protocol) is a communications protocol that network administrators use to centrally manage and automate the network configuration of devices attaching to an Internet Protocol (IP) network. DHCP allows devices needing an IP address to request one when they are starting up, for example, rather than an address preassigned and manually configured on each device. With DHCP, if a device is moved from place to place, it will be assigned a new address in each location. 4 Socket programming 1. What is a socket? How it is different compared to other system calls? A socket is just a logical endpoint for communication. They exist on the transport layer. You can send and receive data on a socket. A socket is bind to a protocol, machine, and port. Using socket we can communicate between process in same system as well as process in different device over network.
  • 8. Linux Interview Essentials – Part II (TCP/IP & Socket programming) Emertxe Information Technologies 2. Explain system calls used in TCP client and server. 3. Explain TCP client and server system calls and three-way handshake Three way handshake happens between connect and accept. Ref Qn 9 4. Is bind() is mandatory in the client side? Justify your answer. Bind is optional in client side. When we do a connect request from the client bind will happen automatically. 5. What is host byte order and network byte order? Explain Since machines will have different type of byte orders (little endian v/s big endian), it will create undesired issues in the network. In order to ensure consistency network (big endian) byte order to be used as a standard. There are multiple help functions (for conversion) available which can be used for this purpose. uint16_t htons(uint16_t host_short); uint16_t ntohs(uint16_t network_short); uint32_t htonl(uint32_t host_long); uint32_t ntohl(uint32_t network_long); 6. What is control connection and what is data connection? Explain with respect to socket() and accept() system calls. In server program of a TCP/IP connection we will get two socket fds. 1. From socket system call, which we need to bind with IP and port number. This socket fd is called as control socket. We use this socket to accept connections from multiple clients. With one control socket we can accept any number of clients. 2. When accept multiple connections we need one more fd to send/receive data with client. That fd we will receive from accept system call which called as data socket. 7. What is the difference between send() and sendto()? Send is using for TCP/IP connection where we only send data. Sendto using for UDP connection where we need send data as well as destination details (IP and PORT).
  • 9. Linux Interview Essentials – Part II (TCP/IP & Socket programming) Emertxe Information Technologies 8. Define iterative server and concurrent server. What are their advantages and disadvantages? Iterative server Con-current server Pros: – Simple – Reduced network overhead – Less CPU intensive – Higher single-threaded transaction throughput Cons: – Severely limits concurrent access – Server is locked while dealing with one client Pros: – Concurrent access – Can run longer since no one is waiting for completion – Only one listener for many clients Cons – Increased network overhead – More CPU and resource intensive 9. What is the importance of select () system call? Explain it in the context of synchronous I/O Select is a system call which help to write a concurrent server in one process. It also used to examine the status of file descriptors of open input/output channels. The select system call is similar to the polling in operating systems. Select loop uses the select system call to sleep until a condition occurs on a file descriptor (e.g., when data is available for reading) or a timeout occurs. By examining the return parameters of the select call, the loop finds out which file descriptor has changed and executes the appropriate code to read/write to file descriptor. 10. What is a RAW socket? Explain its importance Using RAW packet we can read the packet directly from physical layer. Means it will by-pass transport and network layer and directly passed application layer. If you want implement your own protocols on top of physical layer, we can use RAW packet data. 5 Application specific: 1. I type www.google.com in Chrome. Explain various protocols that helps to make browsing happen  The browser extracts the domain name from the URL.  The browser queries DNS for the IP address of the URL. If neither the browser nor the OS have a cached copy of the IP address, then a request is sent off to the system's configured DNS server.  If that DNS server has the address for that domain, it will return it. Otherwise, it will forward the query along to DNS server it is configured to defer to.  The web browser then assembles an HTTP request, which consists of a header and optional content.  This HTTP request is sent off to the web server host (via TCP/IP/MAC layer protocols) as some number of packets, each of which is routed in the same way as the earlier DNS query. (The packets have sequence numbers that allow them to be reassembled in order even if they take different paths.)  In the routing side there are a set of routing protocols (RIP, IGMP, OSPF etc..) which routes the packet from the source (your machine) to the web-server. This follows complex routing algorithm  Once the request arrives at the webserver, it generates a response (this may be a static page, served as-is, or a more dynamic response, generated in any number of ways.) The web server software sends the generated page back to the client in the similar way. 2. List of protocols that doesn’t use IP address DHCP, ICMP, IGRP, ARP etc