General Notes
Linux bootup sequence
BIOS
performs system integrity checks
loads Master boot loader
Master Boot Record MBR
located in /dev/sda
has info about GRUB
GRUB - Grand unified boot loader
select which kernel you want to load
/boot/grub/grub.conf contains config
Kernel
mounts root file system
executes /sbin/init
init process always has PID of 1
loads initrd - initial RAM disk
Init or SystemD
checks /etc/inittab to decide what to run
Newer kernels run systemd
Run Level programs
/etc/rc.d/
6 run levels + S start and K kill
Run application via X (centos 7)
yum install xauth
yum install xorg-x11-fonts-Type1
set /etc/ssh/sshd_config
set X11 Forwading yes in /etc/ssh/sshd_config,
X11UseLocalHost no
restart sshd service
touch ~/.Xauthority
xauth generate :0 . trusted
xauth add ${HOST}:0 . $(xxd -l 16 -p /dev/urandom)
xauth list
relogin, ssh -X user@host
check DISPLAY
echo $DISPLAY (should be localhost:10 or localhost:0)
7 Network Layers
Physical - cable, electrons, voltage, (transmission mode: simplex, half duplex, full duplex), network topology defined: bus,mesh,ring. Electrical signaling and raw bit stream.
Datalink - MAC address, node-to-node data transfer
Network - translates logical address to physical machine IP address (one step below UDP/TCP). Systems on different subnets and networks find each other on this layer
Transport - TCP, UDP. Breaks data into frames, checks for data errors in packets
Session - session control for incoming and outgoing packets, opens and closes connections via ports (controlled by applications)
Presentation - data encryption, conversion of data from one type to another (ie, TXT to XML)
Application - individual applications handle how and when they send and receive requests
File/Dir permissions chart
TCP Packet structure
[ ethernet header (MAC) | IP header (src | TCP header | payload | checksum (check corruption) ]
TCP vs UDP
TCP is a connection-oriented protocol, whereas UDP is a connectionless protocol.
The speed for TCP is slower while the speed of UDP is faster
TCP uses handshake protocol like SYN, SYN-ACK, ACK while UDP uses no handshake protocols
TCP does error checking and also makes error recovery, on the other hand, UDP performs error checking, but it discards erroneous packets.
TCP has acknowledgment segments, but UDP does not have any acknowledgment segment.
When we compare TCP vs UDP protocol, TCP is heavy-weight, and UDP is lightweight.
TCP
Supports bandwidth-intensive applications that tolerate packet loss
Less delay
It sends the bulk quantity of packets.
Possibility of the Data loss
Allows small transaction ( DNS lookup)
header size 20 bytes
arranges packets in seq order
does error check + recovery
3 way handshake
UDP
Supports bandwidth-intensive applications that tolerate packet loss
Less delay
It sends the bulk quantity of packets.
Possibility of the Data loss
Allows small transaction ( DNS lookup)
header size 8 bytes
packets are not arranged
error check, no recovery
no handshake
Kernel Bypass, bypass kernel and NIC to kernel interrupts, resulting in higher throughput and less latency, avoid shared datastructure overheads, no locks