Network Hardware Fundamentals
Switches: These devices enable communication among multiple hosts within a network. All hosts connected to a single switch form a local area network (LAN).
For communication to occur:
- Each host must have a MAC address (physical address) conssiting of 12 hexadecimal characters (0-9, A-F)
- Communication via switches may sometimes require broadcasting
- Excessive broadcasting can impact host performance
- Note: Communication always involves both sending and receiving data
Routers: These devices facilitate communication between hosts in different local networks.
For communication to occur:
- Each host must have an IP address (logical address) represented in decimal format (e.g., 192.168.10.1)
- IP addresses consist of network information (LAN identifier) + host address information
- Communication relies on routing tables within the router
Router Table Generation
Routing table information can be generated through several methods:
- Automatic generation from directly connected networks
- Manual configuration (static routing)
- Dynamic generation through routing protocols (dynamic routing)
Gateway: The essential path for a host to access other networks. The router's interface serves as the gateway intefrace, and the router's address is the gateway address.
Static Routing Configuration
Network Environment Setup
Consider a network with:
- Two hosts
- Two switches
- Three routers
Router Configuration
Initial router setup involves configuring interface addresses:
Router> enable # Enter privileged mode
Router# configure terminal # Enter global configuration mode
Router(config)# interface gigabitethernet 0/0 # Enter interface configuration mode
Router(config-if)# ip address 192.168.1.254 255.255.255.0 # Configure IP address
Router(config-if)# no shutdown # Enable interface
Router(config-if)# exit # Return to global configuration mode
Router(config)# interface gigabitethernet 0/1
Router(config-if)# ip address 192.168.2.1 255.255.255.0
Router(config-if)# no shutdown
To verify interface status:
Router# show ip interface brief
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 192.168.1.254 YES manual up up
GigabitEthernet0/1 192.168.2.1 YES manual up down
Static Route Configuration
To configure a static route, use the following syntax:
ip route destination_network subnet_mask next_hop_address
Example configuration for Router 1:
Router(config)# ip route 192.168.4.0 255.255.255.0 192.168.2.2
To verify the routing table:
Router# show ip route
S 192.168.4.0/24 [1/0] via 192.168.2.2
Removing Static Routes
To remove a static route:
Router(config)# no ip route 192.168.4.0 255.255.255.0 192.168.2.2
Dynamic Routing Configuration
Dynamic routing protocols enable routers to share routing information automatically. Common protocols include:
- RIP (Routing Information Protocol)
- OSPF (Open Shortest Path First)
- EIGRP (Enhanced Interior Gateway Routing Protocol)
- BGP (Border Gateway Protocol)
RIP Configuration Example
For Router 1:
Router(config)# router rip
Router(config-router)# network 192.168.1.0
Router(config-router)# network 192.168.2.0
To view learned routes:
Router# show ip route
R 192.168.3.0/24 [120/1] via 192.168.2.2, 00:00:09, GigabitEthernet0/1
R 192.168.4.0/24 [120/2] via 192.168.2.2, 00:00:20, GigabitEthernet0/1
Network Topology Hierarchy
Networks are typically designed in three hierarchical layers:
- Core Layer: Comprises routers (gateway interfaces) that handle external communication with built-in redundancy capabilities
- Distribution Layer: Contains layer 3 switches that provide redundancy and policy control
- Access Layer: Consists of layer 2 switches that connect end devices to the network
Network Models
OSI 7-Layer Model
From top to bottom:
- Application Layer: Defines application interfaces and standards (data generation)
- Presentation Layer: Handles data conversion, encryption, and compression
- Session Layer: Manages network connection establishment and termination
- Transport Layer: Ensures reliable data transmission
- Network Layer: Provides routing capabilities to find target networks (layer 3 devices)
- Data Link Layer: Provides switching capabilities to find target hosts (layer 2 devices)
- Physical Layer: Defines physical device standards (network cards, cables, fiber optics) and converts data to binary
TCP/IP Model (4-Layer)
- Application Layer
- Host-to-Host Layer
- Internet Layer
- Network Access Layer
TCP vs. UDP Protocols
TCP (Transmission Control Protocol): Connection-oriented protocol
- Establishes connection before data transfer (e.g., online file sending)
- Advantage: High data transmission reliability
- Disadvantage: Lower data transmission efficiency
UDP (User Datagram Protocol): Connectionless protocol
- Sends data without establishing a connection (e.g., offline file sending)
- Advantage: High data transmission efficiency
- Disadvantage: Lower data transmission reliability
TCP Connection Process
Three-way handshake:
- Host A sends a TCP packet with SYN flag set to 1 to request connection
- Host B responds with a TCP packet having both SYN and ACK flags set to 1
- Host A sends a TCP packet with ACK flag set to 1, confirming receipt of Host B's response
Four-way termination:
- First FIN: One host sends a FIN packet to request connection termination
- First ACK: The other host acknowledges the FIN request
- Second FIN: The other host sends its own FIN packet to terminate the connection
- Second ACK: The first host acknowledges the second FIN
System Routing Configuration
CentOS 6 (route command)
Default static route:
route add default gw 10.0.0.2
route del default gw 10.0.0.2
Network static route:
route add -net 10.0.3.0 netmask 255.255.255.0 gw 10.0.1.2
route del -net 10.0.3.0 netmask 255.255.255.0 gw 10.0.1.2
Host static route:
route add -host 10.0.3.201 dev eth1
route del -host 10.0.3.201 dev eth1
CentOS 7 (ip route command)
Default static route:
ip route add default via 10.0.0.2
ip route del default via 10.0.0.2
Network static route:
ip route add -net 10.0.3.0/24 via 10.0.1.2
ip route del -net 10.0.3.0/24 via 10.0.1.2
Host static route:
ip route add -host 10.0.3.201 via 10.0.1.2
ip route del -host 10.0.3.201 via 10.0.1.2