| Understanding Network Fundamentals: IP Addresses, Subnets, and Gateways |
|
IP Address
identifies device on network
Subnet Mask
is the network ID
255.255.255.0first 3/4s of the dotted quad identify the network (192.168.1) the last number identifies the computer on the network computers on the network can communicate directly with each other computers on different networks can communicate through a gateway Gateway
gateway connects network to the Internettypically sits at .1 (192.168.1.1) Interface
physical or virtual hardware
|
| Network Configuration Commands: ip, ifconfig |
|
standard command for networking was ifconfig officially deprecated modern replacement is the ip command Viewing Interfaces (ip addr)
to view IP addresses use command
ip addrprints a block of text for each interface ifconfig provides the same information in a more readable format Viewing the Routing Table (ip route)
command
ip routeoutput default via 192.168.1.1 dev eth0 192.168.1.0/24 dev eth0 proto kernel...the first line sends packets with unknown addresses to the gateway via device eth0 |
| Testing Network Connectivity: ping, traceroute |
|
The Pulse Check: ping
sends ICMP Echo Request packet to a server and waits for a responsea simple Linux ping command will execute continuously unless the -c flag is used ping -c <count> <target IP address>trouble shooting steps using ping
The Map: traceroute
if ping fails where was the point of failure
traceroute <target IP address>prints every hop the packet takes flags
|
| DNS Resolution: nslookup, dig, host |
|
DNS translates names to numbers
The Simple Check: host
host google.com google.com has address 142.250.180.14 The Standard Tool: nslookup
provides more information
nslookup google.com The Power Tool: dig
dig is Domain Information Gropershows the raw query and response dig google.com |
| Network Configuration Files: /etc/network/interfaces, NetworkManager, netplan |
|
how a Linux computer's IP address is permanently changed depends on the distribution
The Modern Ubuntu Way: Netplan
Netplan uses YAML config files found in/etc/netplan/
ls /etc/netplanto set a static IP edit the file 00-installer-config.yaml file is indentation-sensitive, use spaces and not tabs example network:
version: 2
ethernets:
enp3s0:
dhcp4: no
addresses:
- 192.168.1.50/24
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
to apply changes
sudo netplan apply |
| Connecting to Networks: Ethernet and Wi-Fi |
|
Ethernet
plug and playkernel detects carrier when cable is plugged in, DHCP runs automatically IP address is set check the link status ip link show Wi-Fi
harder because of encryptioneasy to do using graphical tool nmtui (Network Manager Terminal UI) run in terminal |
| Understanding Network Services: DHCP and Static IP Configuration |
| DHCP - Dynamic Host Configuration Protocol servers should always have a static IP |
| Summary |
covered
|