Sanitize Chapter 4
This commit is contained in:
parent
4bad49171e
commit
3e41580e35
@ -10,15 +10,11 @@ Linux uses network interfaces to communicate with networks. Common interfaces in
|
|||||||
|
|
||||||
To list network interfaces:
|
To list network interfaces:
|
||||||
|
|
||||||
```
|
`ip link show`
|
||||||
ip link show
|
|
||||||
```
|
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
```
|
`ifconfig -a`
|
||||||
ifconfig -a
|
|
||||||
```
|
|
||||||
|
|
||||||
## 2. IP Address Configuration
|
## 2. IP Address Configuration
|
||||||
|
|
||||||
@ -26,15 +22,11 @@ ifconfig -a
|
|||||||
|
|
||||||
- To set an IP address temporarily:
|
- To set an IP address temporarily:
|
||||||
|
|
||||||
```
|
`sudo ip addr add 192.168.1.100/24 dev eth0`
|
||||||
sudo ip addr add 192.168.1.100/24 dev eth0
|
|
||||||
```
|
|
||||||
|
|
||||||
- To remove an IP address:
|
- To remove an IP address:
|
||||||
|
|
||||||
```
|
`sudo ip addr del 192.168.1.100/24 dev eth0`
|
||||||
sudo ip addr del 192.168.1.100/24 dev eth0
|
|
||||||
```
|
|
||||||
|
|
||||||
### Permanent IP configuration:
|
### Permanent IP configuration:
|
||||||
|
|
||||||
@ -71,9 +63,7 @@ Many modern Linux distributions use Network Manager for easier network configura
|
|||||||
|
|
||||||
Set the hostname:
|
Set the hostname:
|
||||||
|
|
||||||
```
|
`sudo hostnamectl set-hostname new-hostname`
|
||||||
sudo hostnamectl set-hostname new-hostname
|
|
||||||
```
|
|
||||||
|
|
||||||
Update /etc/hosts file to include the new hostname.
|
Update /etc/hosts file to include the new hostname.
|
||||||
|
|
||||||
@ -92,15 +82,11 @@ Note: This file may be overwritten by DHCP. For permanent changes, configure you
|
|||||||
|
|
||||||
View routing table:
|
View routing table:
|
||||||
|
|
||||||
```
|
`ip route show`
|
||||||
ip route show
|
|
||||||
```
|
|
||||||
|
|
||||||
Add a static route:
|
Add a static route:
|
||||||
|
|
||||||
```
|
`sudo ip route add 10.0.0.0/24 via 192.168.1.1 dev eth0`
|
||||||
sudo ip route add 10.0.0.0/24 via 192.168.1.1 dev eth0
|
|
||||||
```
|
|
||||||
|
|
||||||
## 8. Firewall Configuration
|
## 8. Firewall Configuration
|
||||||
|
|
||||||
@ -108,15 +94,11 @@ Most Linux distributions use iptables or nftables. Ubuntu uses ufw (Uncomplicate
|
|||||||
|
|
||||||
Enable UFW:
|
Enable UFW:
|
||||||
|
|
||||||
```
|
`sudo ufw enable`
|
||||||
sudo ufw enable
|
|
||||||
```
|
|
||||||
|
|
||||||
Allow incoming SSH:
|
Allow incoming SSH:
|
||||||
|
|
||||||
```
|
`sudo ufw allow ssh`
|
||||||
sudo ufw allow ssh
|
|
||||||
```
|
|
||||||
|
|
||||||
## 9. Network Diagnostics
|
## 9. Network Diagnostics
|
||||||
|
|
||||||
@ -129,27 +111,22 @@ sudo ufw allow ssh
|
|||||||
|
|
||||||
Start/stop network service:
|
Start/stop network service:
|
||||||
|
|
||||||
```
|
`sudo systemctl start networking`
|
||||||
sudo systemctl start networking
|
`sudo systemctl stop networking`
|
||||||
sudo systemctl stop networking
|
|
||||||
```
|
|
||||||
|
|
||||||
Enable/disable network service at boot:
|
Enable/disable network service at boot:
|
||||||
|
|
||||||
```
|
`sudo systemctl enable networking`
|
||||||
sudo systemctl enable networking
|
`sudo systemctl disable networking`
|
||||||
sudo systemctl disable networking
|
|
||||||
```
|
|
||||||
|
|
||||||
## 11. Wireless Network Configuration
|
## 11. Wireless Network Configuration
|
||||||
|
|
||||||
Use 'iwconfig' to configure wireless interfaces:
|
Use 'iwconfig' to configure wireless interfaces:
|
||||||
|
|
||||||
```
|
`sudo iwconfig wlan0 essid "NetworkName" key s:password` #Not advised because it will leave your network password in the bash history!
|
||||||
sudo iwconfig wlan0 essid "NetworkName" key s:password
|
|
||||||
```
|
|
||||||
|
|
||||||
For WPA networks, use 'wpa_supplicant'.
|
For WPA networks, use 'wpa_supplicant'.
|
||||||
|
- `wpa_passphrase [ESSID] > /etc/wpa_supplicant/wpa_supplicanmt-[DEVICENAME].conf`. You will then be prompted to enter the password.
|
||||||
|
|
||||||
## 12. Network Bonding
|
## 12. Network Bonding
|
||||||
|
|
||||||
@ -167,10 +144,3 @@ iface bond0 inet static
|
|||||||
bond-primary eth0
|
bond-primary eth0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
- [(1) The Ultimate Guide to Linux Mint Network Configuration.](https://www.fosslinux.com/105545/the-ultimate-guide-to-linux-mint-network-configuration.htm.)
|
|
||||||
- [(2) How to set up an Internet Connection in Linux Mint?.](https://unix.stackexchange.com/questions/132747/how-to-set-up-an-internet-connection-in-linux-mint.)
|
|
||||||
- [(3) How to Share Files and Folders on a Linux Mint Network.](https://www.fosslinux.com/103443/how-to-easily-share-files-and-folders-on-a-linux-mint-network.htm.)
|
|
||||||
- [(4) Linux Mint - Community.](https://community.linuxmint.com/tutorial/view/1966.)
|
|
||||||
- [(5) Configure Network in Debian / Ubuntu / LinuxMint - ITzGeek.](https://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/configure-network-in-ubuntu-14-04-linux-mint.html.)
|
|
||||||
|
|
||||||
|
|||||||
@ -23,14 +23,16 @@ Key features:
|
|||||||
- IPv6 support
|
- IPv6 support
|
||||||
|
|
||||||
Basic UFW commands:
|
Basic UFW commands:
|
||||||
```
|
- `sudo ufw enable` # Enable the firewall
|
||||||
sudo ufw enable # Enable the firewall
|
- `sudo ufw disable` # Disable the firewall
|
||||||
sudo ufw disable # Disable the firewall
|
- `sudo ufw status` # Check firewall status
|
||||||
sudo ufw status # Check firewall status
|
`sudo ufw status numbered` # List the current ufw rules and their associated rule number
|
||||||
sudo ufw allow 22 # Allow incoming traffic on port 22 (SSH)
|
`sudo ufw delete RULENUM` # Delete the firewall rule by number
|
||||||
sudo ufw deny 80 # Deny incoming traffic on port 80 (HTTP)
|
- `sudo ufw allow 22` # Allow incoming traffic on port 22 (SSH)
|
||||||
sudo ufw allow from 192.168.1.0/24 # Allow traffic from a specific subnet
|
- `sudo ufw deny 80` # Deny incoming traffic on port 80 (HTTP)
|
||||||
```
|
- `sudo ufw allow from 192.168.1.0/24` # Allow traffic from a specific subnet
|
||||||
|
- `sudo ufw allow 32400/tcp` # Open port for Plex Server - ONLY accepting TCP traffic.
|
||||||
|
|
||||||
|
|
||||||
Advanced usage:
|
Advanced usage:
|
||||||
- Rate limiting: `sudo ufw limit 22/tcp`
|
- Rate limiting: `sudo ufw limit 22/tcp`
|
||||||
@ -46,14 +48,12 @@ Key features:
|
|||||||
- Runtime and permanent configuration options
|
- Runtime and permanent configuration options
|
||||||
- D-Bus interface for easy integration with other applications
|
- D-Bus interface for easy integration with other applications
|
||||||
|
|
||||||
Basic firewalld commands:
|
- Basic firewalld commands:
|
||||||
```
|
- `sudo systemctl start firewalld` # Start firewalld
|
||||||
sudo systemctl start firewalld # Start firewalld
|
- `sudo systemctl enable firewalld` # Enable firewalld to start on boot
|
||||||
sudo systemctl enable firewalld # Enable firewalld to start on boot
|
- `sudo firewall-cmd --state` # Check firewalld status
|
||||||
sudo firewall-cmd --state # Check firewalld status
|
- `sudo firewall-cmd --zone=public --add-service=http` # Allow HTTP traffic in the public zone
|
||||||
sudo firewall-cmd --zone=public --add-service=http # Allow HTTP traffic in the public zone
|
- `sudo firewall-cmd --zone=internal --add-source=192.168.1.0/24` # Add a source to the internal zone
|
||||||
sudo firewall-cmd --zone=internal --add-source=192.168.1.0/24 # Add a source to the internal zone
|
|
||||||
```
|
|
||||||
|
|
||||||
Advanced usage:
|
Advanced usage:
|
||||||
- Custom services: `sudo firewall-cmd --new-service=myapp`
|
- Custom services: `sudo firewall-cmd --new-service=myapp`
|
||||||
@ -66,6 +66,7 @@ Advanced usage:
|
|||||||
- Simpler, more straightforward for basic setups
|
- Simpler, more straightforward for basic setups
|
||||||
- Ideal for single-host systems or simple network configurations
|
- Ideal for single-host systems or simple network configurations
|
||||||
- Easier to learn for beginners
|
- Easier to learn for beginners
|
||||||
|
- Has a GUI (gufw) that can be installed. `sudo apt update && sudo apt install gufw`
|
||||||
|
|
||||||
### firewalld:
|
### firewalld:
|
||||||
- More flexible and powerful for complex network setups
|
- More flexible and powerful for complex network setups
|
||||||
@ -85,10 +86,8 @@ Advanced usage:
|
|||||||
- Test connections with tools like `netcat` or `telnet`
|
- Test connections with tools like `netcat` or `telnet`
|
||||||
- Temporarily disable the firewall to isolate issues
|
- Temporarily disable the firewall to isolate issues
|
||||||
|
|
||||||
## 8. Advanced Topics
|
## 8. Advanced Topics (Coming Soon)
|
||||||
- Stateful vs. stateless firewalls
|
- Stateful vs. stateless firewalls
|
||||||
- Network Address Translation (NAT) configuration
|
- Network Address Translation (NAT) configuration
|
||||||
- Setting up DMZ (Demilitarized Zone)
|
- Setting up DMZ (Demilitarized Zone)
|
||||||
- Integrating with intrusion detection/prevention systems (IDS/IPS)
|
- Integrating with intrusion detection/prevention systems (IDS/IPS)
|
||||||
|
|
||||||
This guide provides a comprehensive overview of Linux firewalls, focusing on UFW and firewalld. Each tool has its strengths, and the choice between them often depends on the specific requirements of your system and network configuration.
|
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
Certainly! Let's explore how to manage firewalls in **Linux Mint** using the terminal. There are a couple of options available:
|
|
||||||
|
|
||||||
## 1. **UFW (Uncomplicated Firewall)**:
|
|
||||||
- UFW is a straightforward and reliable firewall interface with both command-line and graphical tools.
|
|
||||||
- To install UFW, open the terminal and run:
|
|
||||||
```
|
|
||||||
sudo apt install ufw
|
|
||||||
```
|
|
||||||
- Verify if UFW is active with:
|
|
||||||
```
|
|
||||||
sudo systemctl status ufw
|
|
||||||
```
|
|
||||||
- To allow specific ports (e.g., OpenSSH), use:
|
|
||||||
```
|
|
||||||
sudo ufw allow 22/tcp
|
|
||||||
```
|
|
||||||
- To disable a port, run:
|
|
||||||
```
|
|
||||||
sudo ufw deny 22/tcp
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Gufw (GUI for UFW)**:
|
|
||||||
- Gufw provides a graphical interface for managing UFW.
|
|
||||||
- Install it with:
|
|
||||||
```
|
|
||||||
sudo apt install gufw
|
|
||||||
```
|
|
||||||
- Open it from the menu: "Firewall Configuration."
|
|
||||||
- For example: In Firewall configuration make sure Port TCP:32400 is open for Plex Server.
|
|
||||||
|
|
||||||
Remember, firewalls protect your network by filtering traffic based on predefined rules. Choose the method that suits your preference! 😊🔥
|
|
||||||
|
|
||||||
Source: Conversation with Copilot, 7/12/2024
|
|
||||||
- [(1) How to open a firewall on Linux Mint | FOSS Linux.](https://www.fosslinux.com/50961/open-a-firewall-on-linux-mint.htm.)
|
|
||||||
- [(2) Linux Mint - Community.](https://community.linuxmint.com/tutorial/view/1899.)
|
|
||||||
- [(3) LINUX Firewall - GeeksforGeeks.](https://www.geeksforgeeks.org/linux-firewall/.)
|
|
||||||
- [(4) firewalld-cmd Command in Linux: 24 Examples.](https://linuxhandbook.com/firewalld-cmd/.)
|
|
||||||
@ -3,220 +3,122 @@
|
|||||||
## 1. Basic Network Configuration Check:
|
## 1. Basic Network Configuration Check:
|
||||||
|
|
||||||
- Check IP address and network interface status:
|
- Check IP address and network interface status:
|
||||||
```
|
- `ip addr show` # This command displays all network interfaces, their IP addresses, and status.
|
||||||
ip addr show
|
|
||||||
```
|
|
||||||
This command displays all network interfaces, their IP addresses, and status.
|
|
||||||
|
|
||||||
- Verify default gateway:
|
- Verify default gateway:
|
||||||
```
|
- `ip route show` # Ensures your system knows how to route traffic outside the local network.
|
||||||
ip route show
|
|
||||||
```
|
|
||||||
Ensures your system knows how to route traffic outside the local network.
|
|
||||||
|
|
||||||
- Check DNS configuration:
|
- Check DNS configuration:
|
||||||
```
|
- `cat /etc/resolv.conf` # Displays the DNS servers your system is using.
|
||||||
cat /etc/resolv.conf
|
|
||||||
```
|
|
||||||
Displays the DNS servers your system is using.
|
|
||||||
|
|
||||||
## 2. Connectivity Tests:
|
## 2. Connectivity Tests:
|
||||||
|
|
||||||
- Ping test:
|
- Ping test:
|
||||||
```
|
- `ping -c 4 8.8.8.8` # Tests basic connectivity to Google's DNS server (or any other IP). Only pings 4 times (-c 4)
|
||||||
ping -c 4 8.8.8.8
|
|
||||||
```
|
|
||||||
Tests basic connectivity to Google's DNS server (or any other IP).
|
|
||||||
|
|
||||||
- Traceroute:
|
- Traceroute:
|
||||||
```
|
- `traceroute google.com` # Shows the path packets take to reach a destination.
|
||||||
traceroute google.com
|
|
||||||
```
|
|
||||||
Shows the path packets take to reach a destination.
|
|
||||||
|
|
||||||
- DNS resolution test:
|
- DNS resolution test:
|
||||||
```
|
- `nslookup google.com` # These test DNS resolution capabilities.
|
||||||
nslookup google.com
|
- `dig google.com` # These test DNS resolution capabilities.
|
||||||
```
|
|
||||||
or
|
|
||||||
```
|
|
||||||
dig google.com
|
|
||||||
```
|
|
||||||
These test DNS resolution capabilities.
|
|
||||||
|
|
||||||
## 3. Advanced Diagnostic Tools:
|
## 3. Advanced Diagnostic Tools:
|
||||||
|
|
||||||
- netstat or ss:
|
- netstat or ss:
|
||||||
```
|
- `netstat -tulpn` # Display active network connections and listening ports.
|
||||||
netstat -tuln
|
- `ss -tulpn` # Display active network connections and listening ports.
|
||||||
```
|
|
||||||
or
|
|
||||||
```
|
|
||||||
ss -tuln
|
|
||||||
```
|
|
||||||
Display active network connections and listening ports.
|
|
||||||
|
|
||||||
- tcpdump:
|
- tcpdump:
|
||||||
```
|
- `sudo tcpdump -i eth0` # eth0 is the Device name. Captures and displays packet data on a specified interface.
|
||||||
sudo tcpdump -i eth0
|
|
||||||
```
|
|
||||||
Captures and displays packet data on a specified interface.
|
|
||||||
|
|
||||||
- nmap:
|
- nmap:
|
||||||
```
|
- `nmap -p- localhost` # Scans every port on the local machine (or any specified target).
|
||||||
nmap -p- localhost
|
|
||||||
```
|
|
||||||
Scans for open ports on the local machine (or any specified target).
|
|
||||||
|
|
||||||
## 4. Firewall Configuration:
|
## 4. Firewall Configuration:
|
||||||
|
|
||||||
- Check iptables rules:
|
- Check iptables rules:
|
||||||
```
|
- `sudo iptables -L -v -n` # Displays current firewall rules.
|
||||||
sudo iptables -L -v -n
|
|
||||||
```
|
|
||||||
Displays current firewall rules.
|
|
||||||
|
|
||||||
- Temporarily disable firewall (for testing):
|
- Temporarily disable firewall (for testing):
|
||||||
```
|
- `sudo systemctl stop firewalld` # Stops firewalld on the current boot - will start at next boot if enabled
|
||||||
sudo systemctl stop firewalld # for systems using firewalld
|
- `sudo ufw disable` # Disables firewalld at system boot and stops it immedietely
|
||||||
```
|
|
||||||
or
|
|
||||||
```
|
|
||||||
sudo ufw disable # for systems using ufw
|
|
||||||
```
|
|
||||||
|
|
||||||
## 5. Network Service Diagnostics:
|
## 5. Network Service Diagnostics:
|
||||||
|
|
||||||
- Check service status:
|
- Check service status:
|
||||||
```
|
- `systemctl status networking`
|
||||||
systemctl status networking
|
- `systemctl status NetworkManager`
|
||||||
```
|
|
||||||
or
|
|
||||||
```
|
|
||||||
systemctl status NetworkManager
|
|
||||||
```
|
|
||||||
|
|
||||||
- Restart network service:
|
- Restart network service:
|
||||||
```
|
- `sudo systemctl restart networking`
|
||||||
sudo systemctl restart networking
|
- `sudo systemctl restart NetworkManager`
|
||||||
```
|
|
||||||
or
|
|
||||||
```
|
|
||||||
sudo systemctl restart NetworkManager
|
|
||||||
```
|
|
||||||
|
|
||||||
## 6. Network Interface Configuration:
|
## 6. Network Interface Configuration:
|
||||||
|
|
||||||
- Edit network interface configuration:
|
- Edit network interface configuration:
|
||||||
```
|
- `sudo nano /etc/network/interfaces` # for Debian-based systems
|
||||||
sudo nano /etc/network/interfaces # for Debian-based systems
|
- `sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0` # for Red Hat-based systems
|
||||||
```
|
|
||||||
or
|
|
||||||
```
|
|
||||||
sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0 # for Red Hat-based systems
|
|
||||||
```
|
|
||||||
|
|
||||||
- Restart specific network interface:
|
- Restart specific network interface:
|
||||||
```
|
- `sudo ifdown eth0 && sudo ifup eth0`
|
||||||
sudo ifdown eth0 && sudo ifup eth0
|
- `sudo ip link set eth0 down && sudo ip link set eth0 up`
|
||||||
```
|
|
||||||
or
|
|
||||||
```
|
|
||||||
sudo ip link set eth0 down && sudo ip link set eth0 up
|
|
||||||
```
|
|
||||||
|
|
||||||
## 7. Wireless Network Troubleshooting:
|
## 7. Wireless Network Troubleshooting:
|
||||||
|
|
||||||
- List available wireless networks:
|
- List available wireless networks:
|
||||||
```
|
- `sudo iwlist wlan0 scan`
|
||||||
sudo iwlist wlan0 scan
|
|
||||||
```
|
|
||||||
|
|
||||||
- Check wireless interface details:
|
- Check wireless interface details:
|
||||||
```
|
- `iwconfig`
|
||||||
iwconfig
|
|
||||||
```
|
|
||||||
|
|
||||||
- Monitor wireless connection in real-time:
|
- Monitor wireless connection in real-time:
|
||||||
```
|
- `watch -n 1 iwconfig`
|
||||||
watch -n 1 iwconfig
|
|
||||||
```
|
|
||||||
|
|
||||||
## 8. Advanced Network Analysis:
|
## 8. Advanced Network Analysis:
|
||||||
|
|
||||||
- Wireshark: GUI-based packet analyzer
|
- Wireshark: GUI-based packet analyzer
|
||||||
Install with:
|
Install with:
|
||||||
```
|
- `sudo apt-get install wireshark` # on Debian-based systems
|
||||||
sudo apt-get install wireshark # on Debian-based systems
|
- `sudo yum install wireshark` # on Red Hat-based systems
|
||||||
```
|
|
||||||
or
|
|
||||||
```
|
|
||||||
sudo yum install wireshark # on Red Hat-based systems
|
|
||||||
```
|
|
||||||
|
|
||||||
- iftop: Displays bandwidth usage on an interface
|
- iftop: Displays bandwidth usage on an interface
|
||||||
```
|
- `sudo iftop -i eth0`
|
||||||
sudo iftop -i eth0
|
|
||||||
```
|
|
||||||
|
|
||||||
- nethogs: Groups bandwidth by process
|
- nethogs: Groups bandwidth by process
|
||||||
```
|
- `sudo nethogs eth0`
|
||||||
sudo nethogs eth0
|
|
||||||
```
|
|
||||||
|
|
||||||
## 9. Performance Testing:
|
## 9. Performance Testing:
|
||||||
|
|
||||||
- iperf: Network performance measurement tool
|
- iperf: Network performance measurement tool
|
||||||
```
|
- `iperf -s` # on server
|
||||||
iperf -s # on server
|
- `iperf -c server_ip` # on client
|
||||||
iperf -c server_ip # on client
|
|
||||||
```
|
|
||||||
|
|
||||||
- speedtest-cli: Command-line interface for testing internet speed
|
- speedtest-cli: Command-line interface for testing internet speed
|
||||||
```
|
`speedtest-cli`
|
||||||
speedtest-cli
|
|
||||||
```
|
|
||||||
|
|
||||||
## 10. Log Analysis:
|
## 10. Log Analysis:
|
||||||
|
- `sudo tail -f /var/log/syslog` # on Debian-based systems
|
||||||
- System logs:
|
- `sudo tail -f /var/log/messages` # on Red Hat-based systems
|
||||||
```
|
- `sudo journalctl -b0`
|
||||||
sudo tail -f /var/log/syslog # on Debian-based systems
|
- `sudo dmesg -k`
|
||||||
```
|
|
||||||
or
|
|
||||||
```
|
|
||||||
sudo tail -f /var/log/messages # on Red Hat-based systems
|
|
||||||
```
|
|
||||||
or
|
|
||||||
```
|
|
||||||
sudo journalctl -b0
|
|
||||||
```
|
|
||||||
or
|
|
||||||
```
|
|
||||||
sudo dmesg -k
|
|
||||||
```
|
|
||||||
|
|
||||||
- Network-specific logs:
|
- Network-specific logs:
|
||||||
```
|
- `sudo tail -f /var/log/daemon.log`
|
||||||
sudo tail -f /var/log/daemon.log
|
|
||||||
```
|
|
||||||
|
|
||||||
## 11. Network Configuration Backup and Restore:
|
## 11. Network Configuration Backup and Restore:
|
||||||
|
|
||||||
- Backup network configuration:
|
- Backup network configuration:
|
||||||
```
|
- `sudo tar -czvf network_config_backup.tar.gz /etc/network` # Create a file called network_config_backup.tar.gz from the /etc/network directory
|
||||||
sudo tar -czvf network_config_backup.tar.gz /etc/network
|
|
||||||
```
|
|
||||||
|
|
||||||
- Restore network configuration:
|
- Restore network configuration:
|
||||||
```
|
- `sudo tar -xzvf network_config_backup.tar.gz -C /`
|
||||||
sudo tar -xzvf network_config_backup.tar.gz -C /
|
|
||||||
```
|
|
||||||
|
|
||||||
## 12. Troubleshooting Specific Issues:
|
## 12. Troubleshooting Specific Issues:
|
||||||
|
|
||||||
- High latency: Use ping and traceroute to identify where delays occur.
|
- High latency: Use ping and traceroute to identify where delays occur.
|
||||||
- Packet loss: Use mtr (My TraceRoute) for a combination of ping and traceroute.
|
- Packet loss: Use mtr (My TraceRoute) for a combination of ping and traceroute.
|
||||||
- DNS issues: Check /etc/hosts file and DNS server configurations.
|
- DNS issues: Check /etc/hosts file and DNS server configurations.
|
||||||
- IP conflicts: Use arping to detect duplicate IP addresses on the network.
|
- IP conflicts: Use arping to detect duplicate IP addresses on the network.
|
||||||
|
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
## Certainly! To use SSH in **Linux Mint**, follow these steps:
|
|
||||||
|
|
||||||
1. **Install OpenSSH Server**:
|
|
||||||
- Open a terminal by clicking the terminal icon in the taskbar.
|
|
||||||
- Install the OpenSSH server package with this command (use root privileges): `sudo apt-get install openssh-server -y`.
|
|
||||||
|
|
||||||
2. **Check SSH Status**:
|
|
||||||
- SSH should be configured to start automatically on boot. Confirm this with:
|
|
||||||
```
|
|
||||||
systemctl is-enabled ssh
|
|
||||||
```
|
|
||||||
- If it's disabled, enable it using: `sudo systemctl enable ssh`.
|
|
||||||
|
|
||||||
3. **Test SSH Access**:
|
|
||||||
- Find your Linux Mint machine's IP address (e.g., `192.168.1.20`) using `ip a`.
|
|
||||||
- Use PuTTY or any SSH client to connect: `ssh username@192.168.1.20`.
|
|
||||||
- Enter your password when prompted¹.
|
|
||||||
|
|
||||||
Feel free to ask if you need further assistance! 😊🚀
|
|
||||||
|
|
||||||
Source: Conversation with Copilot, 7/12/2024
|
|
||||||
- [(1) How To Enable SSH in Linux Mint - RootUsers.](https://www.rootusers.com/enable-ssh-linux-mint/.)
|
|
||||||
- [(2) How-to Guide Linux Networking with SSH - Linux Mint Forums.](https://forums.linuxmint.com/viewtopic.php?t=13695.)
|
|
||||||
- [(3) Linux Mint - Community.]( https://community.linuxmint.com/tutorial/view/83.)
|
|
||||||
- [(4) How to Install and Enable SSH on Linux Mint 21 – LinuxWays.](https://linuxways.net/mint/install-enable-ssh-linux-mint-21/.)
|
|
||||||
- [(5) Linux Mint - Community.](https://community.linuxmint.com/tutorial/view/244.)
|
|
||||||
- [(6) en.wikipedia.org.](https://en.wikipedia.org/wiki/Linux_Mint.)
|
|
||||||
@ -29,7 +29,7 @@ SSH operates on a client-server model. The process typically involves:
|
|||||||
|
|
||||||
## 5. SSH Key Management
|
## 5. SSH Key Management
|
||||||
|
|
||||||
- Generating Keys: Use `ssh-keygen` to create key pairs.
|
- Generating Keys: Use `ssh-keygen -t ed25519 -a 32` to create key pairs. (stored in ~/.ssh/ by default)
|
||||||
- Key Types: RSA, DSA, ECDSA, Ed25519 (Ed25519 is recommended for new deployments).
|
- Key Types: RSA, DSA, ECDSA, Ed25519 (Ed25519 is recommended for new deployments).
|
||||||
- Key Size: Larger keys are more secure but slower (e.g., 4096-bit RSA).
|
- Key Size: Larger keys are more secure but slower (e.g., 4096-bit RSA).
|
||||||
- Passphrase: An extra layer of security for private keys.
|
- Passphrase: An extra layer of security for private keys.
|
||||||
@ -37,10 +37,10 @@ SSH operates on a client-server model. The process typically involves:
|
|||||||
## 6. Common SSH Commands
|
## 6. Common SSH Commands
|
||||||
|
|
||||||
- `ssh user@hostname`: Basic connection command.
|
- `ssh user@hostname`: Basic connection command.
|
||||||
- `scp`: Secure copy files between hosts.
|
- `scp user@hostname:/full/source/path ~/destination`: Secure copy files between hosts.
|
||||||
- `sftp`: Secure file transfer protocol.
|
- `sftp user@hostname`: Secure file transfer protocol.
|
||||||
- `ssh-keygen`: Generate SSH key pairs.
|
- `ssh-keygen`: Generate SSH key pairs.
|
||||||
- `ssh-copy-id`: Copy public key to a remote host.
|
- `ssh-copy-id user@hostname`: Copy your public key to a remote host.
|
||||||
|
|
||||||
## 7. SSH Configuration
|
## 7. SSH Configuration
|
||||||
|
|
||||||
@ -48,16 +48,16 @@ SSH operates on a client-server model. The process typically involves:
|
|||||||
- Server Configuration: `/etc/ssh/sshd_config`
|
- Server Configuration: `/etc/ssh/sshd_config`
|
||||||
- Important settings:
|
- Important settings:
|
||||||
- Port (default 22)
|
- Port (default 22)
|
||||||
- PermitRootLogin
|
- PermitRootLogin : Usually commented out to disable root from using SSH.
|
||||||
- PasswordAuthentication
|
- PasswordAuthentication: Set to no if you want to only use RSA keys
|
||||||
- PubkeyAuthentication
|
- PubkeyAuthentication: Set to yes if you want to use RSA keys for authentication.
|
||||||
|
|
||||||
## 8. SSH Security Best Practices
|
## 8. SSH Security Best Practices
|
||||||
|
|
||||||
- Use key-based authentication instead of passwords.
|
- Use key-based authentication instead of passwords.
|
||||||
- Disable root login.
|
- Disable root login.
|
||||||
- Use non-standard ports.
|
- Use non-standard ports.
|
||||||
- Implement fail2ban or similar intrusion prevention systems.
|
- Implement fail2ban or similar intrusion prevention systems. (sudo apt install fail2ban).
|
||||||
- Keep software up-to-date.
|
- Keep software up-to-date.
|
||||||
- Use SSH protocol version 2.
|
- Use SSH protocol version 2.
|
||||||
- Limit user access with AllowUsers or AllowGroups.
|
- Limit user access with AllowUsers or AllowGroups.
|
||||||
@ -65,21 +65,21 @@ SSH operates on a client-server model. The process typically involves:
|
|||||||
## 9. Advanced SSH Features
|
## 9. Advanced SSH Features
|
||||||
|
|
||||||
- Port Forwarding: Local, Remote, and Dynamic.
|
- Port Forwarding: Local, Remote, and Dynamic.
|
||||||
- X11 Forwarding: Run graphical applications remotely.
|
- X11 Forwarding: Run graphical applications remotely. (Virtual Network Connections among others)
|
||||||
- SSH Agent: Manage multiple SSH keys.
|
- SSH Agent: Manage multiple SSH keys.
|
||||||
- ProxyJump: Easily connect through a jump host.
|
- ProxyJump: Easily connect through a jump host.
|
||||||
|
|
||||||
## 10. Troubleshooting SSH
|
## 10. Troubleshooting SSH
|
||||||
|
|
||||||
- Connection Issues: Check network, firewall, and SSH service status.
|
- Connection Issues: Check network, firewall, and SSH service status.
|
||||||
- Authentication Problems: Verify credentials, key permissions, and server configuration.
|
- Authentication Problems: Verify credentials, key permissions (`chmod 600 ~/.ssh/id_rsa*`), and server configuration.
|
||||||
- Performance Issues: Consider compression or alternative ciphers.
|
- Performance Issues: Consider compression or alternative ciphers.
|
||||||
|
|
||||||
## 11. SSH Alternatives and Related Protocols
|
## 11. SSH Alternatives and Related Protocols
|
||||||
|
|
||||||
- Telnet: Older, unencrypted protocol (not recommended).
|
- Telnet: Older, unencrypted protocol (not recommended - INSECURE).
|
||||||
- RDP: Remote Desktop Protocol (mainly for Windows).
|
- RDP: Remote Desktop Protocol - allows a full desktop (mainly for Windows).
|
||||||
- VNC: Virtual Network Computing (graphical desktop sharing).
|
- VNC: Virtual Network Computing - allows a full desktop (graphical desktop sharing).
|
||||||
|
|
||||||
## 12. SSH in Enterprise Environments
|
## 12. SSH in Enterprise Environments
|
||||||
|
|
||||||
@ -87,4 +87,3 @@ SSH operates on a client-server model. The process typically involves:
|
|||||||
- Integration with LDAP or Active Directory.
|
- Integration with LDAP or Active Directory.
|
||||||
- Auditing and logging considerations.
|
- Auditing and logging considerations.
|
||||||
- Bastion hosts for added security.
|
- Bastion hosts for added security.
|
||||||
|
|
||||||
|
|||||||
@ -8,22 +8,17 @@ VPNs (Virtual Private Networks) provide secure, encrypted connections over publi
|
|||||||
OpenVPN is one of the most popular and secure VPN protocols. To set it up:
|
OpenVPN is one of the most popular and secure VPN protocols. To set it up:
|
||||||
|
|
||||||
- 1. Install OpenVPN:
|
- 1. Install OpenVPN:
|
||||||
```
|
`sudo apt install openvpn`
|
||||||
sudo apt install openvpn
|
|
||||||
```
|
|
||||||
|
|
||||||
- 2. Obtain configuration files from your VPN provider.
|
- 2. Obtain configuration files from your VPN provider.
|
||||||
|
Varies on each provider
|
||||||
|
|
||||||
- 3. Connect to the VPN:
|
- 3. Connect to the VPN:
|
||||||
```
|
`sudo openvpn --config /path/to/your/config.ovpn`
|
||||||
sudo openvpn --config /path/to/your/config.ovpn
|
|
||||||
```
|
|
||||||
|
|
||||||
- 4. For automatic connection, create a systemd service:
|
- 4. For automatic connection, create a systemd service:
|
||||||
```
|
`sudo nano /etc/systemd/system/openvpn.service`
|
||||||
sudo nano /etc/systemd/system/openvpn.service
|
- Add the following content:
|
||||||
```
|
|
||||||
Add the following content:
|
|
||||||
```
|
```
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=OpenVPN connection to YOUR_VPN
|
Description=OpenVPN connection to YOUR_VPN
|
||||||
@ -38,34 +33,23 @@ WantedBy=multi-user.target
|
|||||||
```
|
```
|
||||||
|
|
||||||
Enable and start the service:
|
Enable and start the service:
|
||||||
```
|
- `sudo systemctl enable --now openvpn.service` # Starts OpenVPN right "now" and "enable"s it on next boot as well
|
||||||
sudo systemctl enable openvpn.service
|
- `sudo systemctl start openvpn.service` # Just "start"s OpenVPN for the current boot.
|
||||||
sudo systemctl start openvpn.service
|
|
||||||
```
|
|
||||||
|
|
||||||
### WireGuard:
|
### WireGuard:
|
||||||
WireGuard is a newer, faster VPN protocol. To set it up:
|
WireGuard is a newer, faster VPN protocol. To set it up:
|
||||||
|
|
||||||
- a. Install WireGuard:
|
- a. Install WireGuard: `sudo apt install wireguard`
|
||||||
```
|
|
||||||
sudo apt install wireguard
|
|
||||||
```
|
|
||||||
|
|
||||||
- b. Create a configuration file:
|
- b. Create a configuration file: `sudo nano /etc/wireguard/wg0.conf`
|
||||||
```
|
-Add your WireGuard configuration details specific to your vendor.
|
||||||
sudo nano /etc/wireguard/wg0.conf
|
|
||||||
```
|
|
||||||
Add your WireGuard configuration details.
|
|
||||||
|
|
||||||
- c. Start the WireGuard connection:
|
- c. Start the WireGuard connection:
|
||||||
```
|
- sudo wg-quick up wg0`
|
||||||
sudo wg-quick up wg0
|
|
||||||
```
|
|
||||||
|
|
||||||
- d. To enable automatic connection on boot:
|
- d. To "enable" automatic connection on boot and right "now":
|
||||||
```
|
- `sudo systemctl enable --now wg-quick@wg0`
|
||||||
sudo systemctl enable wg-quick@wg0
|
|
||||||
```
|
|
||||||
|
|
||||||
### Built-in VPN clients:
|
### Built-in VPN clients:
|
||||||
Many Linux distributions include built-in VPN clients in their network managers, supporting protocols like OpenVPN, L2TP/IPsec, and PPTP.
|
Many Linux distributions include built-in VPN clients in their network managers, supporting protocols like OpenVPN, L2TP/IPsec, and PPTP.
|
||||||
@ -76,6 +60,7 @@ Proxies route your traffic through an intermediary server. There are several way
|
|||||||
|
|
||||||
### Environment variables:
|
### Environment variables:
|
||||||
Set these variables in your shell configuration file (e.g., ~/.bashrc):
|
Set these variables in your shell configuration file (e.g., ~/.bashrc):
|
||||||
|
|
||||||
```
|
```
|
||||||
export http_proxy="http://proxy_server:port"
|
export http_proxy="http://proxy_server:port"
|
||||||
export https_proxy="http://proxy_server:port"
|
export https_proxy="http://proxy_server:port"
|
||||||
@ -102,41 +87,29 @@ Many applications have their own proxy settings. For example:
|
|||||||
Use proxychains to route terminal commands through a proxy:
|
Use proxychains to route terminal commands through a proxy:
|
||||||
|
|
||||||
#### 1. Install proxychains:
|
#### 1. Install proxychains:
|
||||||
```
|
`sudo apt install proxychains`
|
||||||
sudo apt install proxychains
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 2. Configure proxychains:
|
#### 2. Configure proxychains:
|
||||||
```
|
`sudo nano /etc/proxychains.conf`
|
||||||
sudo nano /etc/proxychains.conf
|
|
||||||
```
|
|
||||||
Add your proxy server details.
|
Add your proxy server details.
|
||||||
|
|
||||||
#### 3. Use proxychains:
|
#### 3. Use proxychains:
|
||||||
```
|
`proxychains command_to_run`
|
||||||
proxychains command_to_run
|
|
||||||
```
|
|
||||||
|
|
||||||
### SOCKS proxy with SSH:
|
### SOCKS proxy with SSH:
|
||||||
Create a SOCKS proxy using SSH:
|
Create a SOCKS proxy using SSH:
|
||||||
```
|
- `ssh -D 1080 -f -C -q -N username@remote_host`
|
||||||
ssh -D 1080 -f -C -q -N username@remote_host
|
- Then configure applications to use SOCKS5 proxy at 127.0.0.1:1080.
|
||||||
```
|
|
||||||
Then configure applications to use SOCKS5 proxy at 127.0.0.1:1080.
|
|
||||||
|
|
||||||
## 3. Testing and Verification
|
## 3. Testing and Verification
|
||||||
|
|
||||||
To verify your VPN or proxy configuration:
|
To verify your VPN or proxy configuration:
|
||||||
|
|
||||||
- Check your IP address:
|
- Check your IP address:
|
||||||
```
|
`curl ifconfig.me`
|
||||||
curl ifconfig.me
|
|
||||||
```
|
|
||||||
|
|
||||||
- DNS leak test:
|
- DNS leak test:
|
||||||
```
|
`dig +short myip.opendns.com @resolver1.opendns.com`
|
||||||
dig +short myip.opendns.com @resolver1.opendns.com
|
|
||||||
```
|
|
||||||
|
|
||||||
- WebRTC leak test (in browsers)
|
- WebRTC leak test (in browsers)
|
||||||
|
|
||||||
@ -155,8 +128,3 @@ dig +short myip.opendns.com @resolver1.opendns.com
|
|||||||
- Verify DNS settings
|
- Verify DNS settings
|
||||||
- Ensure correct permissions on configuration files
|
- Ensure correct permissions on configuration files
|
||||||
- Check for conflicting network settings
|
- Check for conflicting network settings
|
||||||
|
|
||||||
- [(1) Setting Up a VPN on Linux Mint: A Step-by-Step Guide - FOSS Linux.](https://www.fosslinux.com/102356/how-to-set-up-a-vpn-on-linux-mint.htm.)
|
|
||||||
- [(2) How to Configure OpenVPN in Linux Mint? – IPVanish.](https://support.ipvanish.com/hc/en-us/articles/360001738513-How-to-Configure-OpenVPN-in-Linux-Mint.)
|
|
||||||
- [(3) How to configure OpenVPN on Linux Mint - FastVPN - Namecheap.](https://www.namecheap.com/support/knowledgebase/article.aspx/10416/2271/how-to-configure-openvpn-on-linux-mint/.)
|
|
||||||
- [(4) How to Set up an OpenVPN Connection in Linux Mint - Comparitech.](https://www.comparitech.com/blog/vpn-privacy/openvpn-connection-linux-mint/.)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user