structure updates

This commit is contained in:
2024-05-01 12:28:44 -06:00
parent a689e58eea
commit aeba9bdb34
461 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,136 @@
Sure, here's a condensed version with two sections: a step-by-step guide and a list of helpful commands.
**Step-by-Step Guide**
1. **Create the first bridge network (br-my-lan0) for Kubernetes DEV**
```
sudo ip link add name br-my-lan0 type bridge
sudo ip addr add 10.154.2.1/24 dev br-my-lan0
sudo ip link set dev br-my-lan0 up
```
2. **Create the second bridge network (br-my-lan1) for Docker DEV**
```
sudo ip link add name br-my-lan1 type bridge
sudo ip addr add 172.50.50.1/24 dev br-my-lan1
sudo ip link set dev br-my-lan1 up
```
3. **Persist the connections**
```
sudo vi /etc/sysconfig/network-scripts/ifcfg-br-my-lan0
```
Add the following:
```
DEVICE=br-my-lan0
TYPE=Bridge
BOOTPROTO=static
IPADDR=10.154.2.1
NETMASK=255.255.255.0
ONBOOT=yes
```
```
sudo vi /etc/sysconfig/network-scripts/ifcfg-br-my-lan1
```
Add the following:
```
DEVICE=br-my-lan1
TYPE=Bridge
BOOTPROTO=static
IPADDR=172.50.50.1
NETMASK=255.255.255.0
ONBOOT=yes
```
4. **Restart NetworkManager**
```
sudo systemctl restart NetworkManager
```
**Helpful Commands**
**Network Verification Commands**
- `ip a` - Show IP addresses and network interfaces
- `ping <IP_address>` - Test connectivity to a specific IP address
- `traceroute <IP_address>` - Trace the route to a specific IP address
- `mtr <IP_address>` - Combine traceroute and ping functionalities
**Common Network Commands**
- `ifconfig` - View and configure network interfaces
- `netstat` - Display network connections, routing tables, and more
- `route` - Manage routing tables
- `iptables` - Configure firewall rules
- `nmap` - Network exploration and security auditing
**Advanced Network Commands**
- `tcpdump` - Network packet capture and analysis
- `wireshark` - Graphical network protocol analyzer
- `ncat` - Versatile network debugging and data transfer tool
- `iperf` - Network performance measurement tool
- `lsof` - List open files, including network connections
These commands can help you verify network configurations, troubleshoot issues, and perform advanced network analysis and debugging tasks.
---
### 1. Folder Structure Best Practices
For a well-organized virtualization environment, consider the following directory structure:
- **VM Images Directory:**
- Default path: `/var/lib/libvirt/images/`
- This is the default location where the disk images of your VMs are stored. However, if you have a dedicated storage device or partition for VMs, you can create a directory there and symlink it to this path.
- **ISOs Directory:**
- Suggested path: `/var/lib/libvirt/isos/`
- Store all your downloaded ISO files here. This helps in easily locating and managing different OS installation media.
- **Cloud Images:**
- Suggested path: `/var/lib/libvirt/cloud-images/`
- If you plan to use cloud-init images for VMs, it's good to keep them separate from standard ISOs for clarity.
- **Snapshots and Backups:**
- Suggested path: `/var/lib/libvirt/snapshots/` and `/var/lib/libvirt/backups/`
- Having dedicated directories for snapshots and backups is crucial for easy management and recovery.
**Note:** Always ensure that these directories have appropriate permissions and are accessible by the `libvirt` group.
### 2. Networking Setup
For networking, you typically have a few options:
- **NAT Network (Default):**
- This is the default network (`virbr0`) set up by libvirt, providing NAT (Network Address Translation) to the VMs. VMs can access external networks through the host but are not accessible from outside by default.
- **Bridged Network:**
- A bridge network connects VMs directly to the physical network, making them appear as physical hosts in your network. This is useful if you need VMs accessible from other machines in the network.
- To set up a bridge, you can use `nmcli` (NetworkManager command-line interface) or manually edit network interface configuration files.
- **Host-Only Network:**
- For VMs that only need to communicate with the host and other VMs, a host-only network is suitable.
**Verifying Network:**
- Check the default network is active: `virsh net-list --all`
- For custom network configurations, validate using `ip addr` and `brctl show`.
### 3. Storage Setup
For VM storage, consider the following:
- **LVM (Logical Volume Management):**
- Ideal for production environments. LVM allows for flexible management of disk space, easy resizing, and snapshotting capabilities.
- You can create a dedicated volume group for your VMs for better management.
- **Standard Partitions:**
- If you dont use LVM, ensure that you have a partition or a separate disk with sufficient space for your VM images.
- **External/NAS Storage:**
- For larger setups, you might consider network-attached storage (NAS). Ensure the NAS is mounted properly on your system and has the necessary read/write permissions.
- **Storage Pools:**
- Libvirt can manage various types of storage pools. You can create and manage them using `virsh` or Virt-Manager.
### Final Checks and Tips
- **Permissions:** Ensure the `libvirt` group has proper permissions on all these directories.
- **Security:** If your VMs are exposed to the internet, implement necessary security measures (firewalls, updates, secure passwords).
- **Monitoring and Maintenance:** Regularly monitor the performance and storage usage. Tools like `virt-top` and `nmon` can be handy.
- **Documentation:** Keep a record of your setup and configurations for future reference or troubleshooting.