Networking Flashcards

1
Q

What’s the difference between a domain and a host?

A

Domain is the “entity/site” and host is where it runs.

for example: www.google.com is domain which runs on multiple hosts(servers).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Can a domain be associated with multiple hosts?

A

yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Can a host be associated with more then one IP?

A

Yes. e.g. wireless and wired connection.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Can an IP correspond to more then one host?

A

No. every IP is corresponding to a single host.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How many bits are in each octet of the IP?

A

8 bits.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are sockets?

A

Special FDs created via the socket() syscall instead of open(), which allows parties to communicate through the network.

read()-ing and write()-ing through socket fds
– Translate to receiving & sending data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are ports and why are they needed?

A

• Simultaneously, on the same host, there can be
– Multiple communicating processes, each utilizing multiple sockfds
– So IP addresses aren’t a sufficient identifier for transmitted data chunks

• To avoid ambiguity, each sockfd is associated with a
– Port, unsigned 16-bit integer that uniquely identifies the sockfd
– Every transmitted chunk is associated with IP address + port

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What types of ports exist?

A

• Ports can be either
– Ephemeral = dynamically allocated by the kernel, or
– Well-known = standard, predetermined, known values
• Ports ≤ 1023 are “reserved” (for privileged processes)

• For example, http & https traffic flows via ports 80 & 443

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How are the TCP socket fds created?

A

• Different for
– Client and server

• But for starters, both need to
– Properly initialize a struct addrinfo via the getaddrinfo() syscall
– Invoke socket() using values from addrinfo
• Which returns the sockfd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the params for getaddrinfo function?

A

int getaddrinfo( const char* node, const char* service /the port in our case/, const struct addrinfo* hint, struct addrinfo** res);

node is the host (if server then null (this host), if client then servers name)
service is the port (same for both server and client).
res is the result struct containing all the info (ai_family + ai_addr (encapsulates IP+port) + ai_addrlen specifically).
hint contains:
hint.ai_family
hint.ai_protocol
hint.ai_socktype
hint.ai_flags

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In hint Why do we need both ai_protocol and ai_socktype?

A
  • Other protocols may implement a stream abstraction too

* Notably, non-default TCP versions specialized for data centers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What’s ethernet?

A

• Ethernet is both a link-layer (L2) protocol
– Allows nodes (not processes) to communicate within the LAN
– By sending “frames” (how byte-chunks are called in the link-layer)

• And a physical-layer (L1) protocol
– Lowest protocol layer (EE realm)
– Defines how raw bits (rather than frames) are transmitted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What’s MAC (media access control) address?

A

• A unique 48-bits number
– Identifying each Ethernet component
– Burned in ROM of NIC / Switch / AP
– Used to switch Ethernet frames to their destination within the LAN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What’s the ethernet header is used for? and how the frame is divided?

A

• Using frame’s header
– Switches know where to
send the frame, and
– Receiver can identify sender

The entire frame is called the physical-layer Ethernet packet.
without the preamble and sdf its called link-layer Ethernet frame.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are routers?

A

A routers is hardware components that physically stands at the edge of
(at least) two networks, LAN1 and LAN2,
• And can communicate with both

LAN1 and LAN2 might be using two different protocols and therefore can’t communicate.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Describe the different network layers. and who implements each.

A

• L1 = physical-layer
– How bits transmitted (EE level)
implemented by hardware.

• L2 = link-layer
– Ethernet (frequently)
– Logical communication between hosts across a LAN, with MACs
implemented by OS.

• L3 = network-layer
– IP, which provides global address space
– Logical communication between hosts across the WAN, with IPs
implemented by OS.

• L4 = transport-layer
– TCP & UDP, stream abstraction
– Logical communication between processes across the WAN
implemented by OS.

• L5 = application-layer
– Numerous protocols that utilize L4 (e.g. http)
implemented by application.