Loading W Code...
Routers, Switches, Hubs, Bridges, Gateways, Firewalls, WAPs & Modems
Network Hardware: Physical and virtual devices operating across OSI layers to forward, switch, filter, and secure data traffic.
A Router connects two or more distinct IP networks (e.g., local home LAN to global ISP WAN). It evaluates destination IP addresses against an internal routing table to determine the optimal hop for forwarding packets.
# Linux Router Routing Table & IP Configuration
$ ip route show
default via 192.168.1.1 dev eth0 proto dhcp metric 100
10.0.0.0/8 via 192.168.1.254 dev eth0 proto static
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.105
# Cisco IOS Static Route Configuration Command
Router(config)# ip route 10.0.0.0 255.0.0.0 192.168.1.254A Network Switch connects multiple devices on the same local network (LAN). It inspects 48-bit destination MAC addresses and dynamically forwards Ethernet frames only to the specific port connected to the recipient node.
# Cisco IOS Switch CAM (MAC Address) Table Query
Switch# show mac address-table
Vlan Mac Address Type Ports
---- ----------- -------- -----
10 001a.2b3c.4d5e DYNAMIC Fa0/1
10 aabb.cc11.2233 DYNAMIC Fa0/2
1 0011.2233.4455 DYNAMIC Gi0/1 (Trunk)
# Configuring Access Port on VLAN 10
Switch(config)# interface FastEthernet 0/1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10A Hub is an obsolete Layer-1 multiport repeater. When an electrical signal bit arrives on one port, the hub blindly amplifies and broadcasts it out to all other connected ports, regardless of recipient.
| Feature | Layer 1 Network Hub | Layer 2 Network Switch |
|---|---|---|
| Operational Layer | Layer 1 (Physical Layer) | Layer 2 (Data Link Layer) |
| Traffic Forwarding | Blind broadcast to all ports | Selective unicast matching CAM MAC table |
| Collision Domains | 1 Shared Collision Domain for all ports | Isolated Collision Domain per port |
| Duplex Mode | Half-Duplex (Collisions possible) | Full-Duplex (Simultaneous send & receive) |
| Security | Vulnerable to network sniffing | Secure port-level frame delivery |
# Linux Software Bridge Setup (Replaces Hub Behavior)
$ sudo ip link add name br0 type bridge
$ sudo ip link set dev eth0 master br0
$ sudo ip link set dev eth1 master br0
$ bridge link show
eth0 state forwarding : <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0
eth1 state forwarding : <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0A Bridge connects two separate physical local area network (LAN) segments into a single logical network. It inspects destination MAC addresses in software to decide whether to forward a frame across the bridge or filter it.
// C Transparent Bridge Forwarding Logic Algorithm
if (mac_table_contains(frame->dest_mac)) {
int target_port = mac_table_lookup(frame->dest_mac);
if (target_port == frame->ingress_port) {
// Frame belongs to local segment -- Drop/Filter
drop_frame(frame);
} else {
// Forward frame across bridge to specific segment port
forward_frame(frame, target_port);
}
} else {
// Unknown Unicast -- Flood frame to all other bridge ports
flood_frame_to_all_ports(frame, frame->ingress_port);
}A Gateway operates across higher OSI layers (Layers 4 to 7) to join two network systems operating on completely incompatible communication protocols, data structures, or security models.
// Reverse Proxy / API Gateway Nginx Configuration
server {
listen 443 ssl;
server_name api.wcode.edu;
location /api/v1/ {
proxy_pass http://internal_backend_cluster:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}A Firewall acts as a protective barrier between trusted internal networks and untrusted external networks (the Internet), enforcing strict security policies on inbound and outbound traffic.
# Linux iptables Stateful Firewall Rule Setup
$ sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
$ sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
$ sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
$ sudo iptables -P INPUT DROPA Wireless Access Point (AP) acts as a bridge between wireless Wi-Fi devices (smartphones, laptops) and a wired Ethernet infrastructure network.
# Enterprise WPA3 hostapd Access Point Configuration
interface=wlan0
driver=nl80211
ssid=WCode_Campus_5G
hw_mode=a
channel=36
wpa=2
wpa_key_mgmt=WPA-EAP-SHA256
rsn_pairwise=CCMPA Modem (Modulator-Demodulator) translates digital binary data from local computer routers into analog signals suitable for transmission over ISP physical infrastructure (fiber cables, coaxial lines, copper phone lines).
# Inspecting Cable Modem Signal Quality via CLI
$ modem-cli --status
DOCSIS Version : 3.1
Downstream Channels : 32 Locked (QAM256)
Upstream Channels : 8 Locked (QAM64)
SNR Ratio : 38.5 dB (Excellent)Router vs Switch: Router operates at L3 using IP addresses to connect different subnets. Switch operates at L2 using MAC addresses to connect nodes in the same LAN.
Hub vs Switch: Hub broadcasts traffic to all ports (1 shared collision domain). Switch sends unicast frames directly to destination port (micro-segmented collision domains).