Update docs/tech_docs/OpenWrt.md

This commit is contained in:
2024-04-21 23:58:37 +00:00
parent 76268ac765
commit 52b26edbe7

View File

@@ -16,22 +16,8 @@
--- ---
Here are the structured sections for your document that cover the setup of OpenWRT, Alpine, and Kali Linux containers on Proxmox:
---
## OpenWRT Container Setup ## OpenWRT Container Setup
### Description
This section details the process of setting up an OpenWRT container in a Proxmox environment. OpenWRT is optimized for network operations, making it ideal for routing and firewall tasks within a virtualized setup. The configuration provided keeps resource allocation minimal due to the constraints of an older hardware setup in a lab environment.
### Step-by-Step Configuration
1. Create the container using the provided template and specify initial settings like hostname, network tags, and storage options.
2. Start the container and access its console.
3. Update the container's package list and install necessary packages.
4. Modify network configurations and restart network services to apply the changes.
5. Set up firewall rules to secure the container's network interfaces.
### Commands ### Commands
```bash ```bash
# Create and configure the OpenWRT container # Create and configure the OpenWRT container
@@ -118,48 +104,84 @@ uci commit firewall
## Alpine Container Setup ## Alpine Container Setup
### Description
This section outlines the configuration for an Alpine Linux container, which is lightweight and suitable for running Docker containers. The settings are designed to optimize Docker performance with adequate CPU and memory allocation, while also ensuring that system resources are not overly taxed.
### Step-by-Step Configuration
1. Set up the Alpine container with specified resources and networking capabilities.
2. Enter the container to configure the system and Docker settings.
3. Update system packages and enable community repositories.
4. Install Docker and related tools, and configure network settings.
5. Set up a non-root user for Docker management.
### Commands ### Commands
```bash ```bash
# Create and configure the Alpine container # Create and configure the Alpine container
pct create 300 /var/lib/vz/template/cache/alpine-rootfs.tar.xz --unprivileged 1 --arch amd64 --ostype alpine --hostname alpine-0 --password changeme --tag docker --storage local-lvm --cores 2 --memory 1024 --swap 256 --rootfs local-lvm:1,size=8G --net0 name=eth0,bridge=vmbr0,firewall=1 --keyctl 1 --nesting 1 --cpuunits 1000 --onboot 1 --debug 0 pct create 300 /var/lib/vz/template/cache/alpine-rootfs.tar.xz --unprivileged 1 --arch amd64 --ostype alpine --hostname alpine-0 --password changeme --tag docker --storage local-lvm --cores 2 --memory 1024 --swap 256 --rootfs local-lvm:1,size=8G --net0 name=eth0,bridge=vmbr0,firewall=1 --keyctl 1 --nesting 1 --cpuunits 1000 --onboot 1 --debug 0
```
# Enter the container # Enter the container
```bash
pct enter 300 pct enter 300
```
# System update and Docker installation # System update and Docker installation
```bash
sed -i '/^#.*community/s/^#//' /etc/apk/repositories sed -i '/^#.*community/s/^#//' /etc/apk/repositories
```
```bash
apk update && apk upgrade apk update && apk upgrade
```
```bash
apk add qemu-guest-agent newt curl openssh mc sudo build-base gcc abuild binutils binutils-doc gcc-doc docker apk add qemu-guest-agent newt curl openssh mc sudo build-base gcc abuild binutils binutils-doc gcc-doc docker
```
```bash
rc-service docker start rc-service docker start
```
```bash
rc-update add docker default rc-update add docker default
```
# Configure network and SSH # Configure network and SSH
```bash
setup-interfaces setup-interfaces
```
```bash
service networking restart service networking restart
```
```bash
apk add openssh apk add openssh
```
```bash
rc-update add sshd rc-update add sshd
```
```bash
service sshd start service sshd start
```
# Configure and start SSH service # Configure and start SSH service
```bash
vi /etc/ssh/sshd_config vi /etc/ssh/sshd_config
```
```bash
service sshd restart service sshd restart
```
# Create a system user and add them to the docker group and sudoers # Create a system user and add them to the docker group and sudoers
```bash
adduser -s /bin/ash medusa adduser -s /bin/ash medusa
```
```bash
addgroup medusa docker addgroup medusa docker
```
```bash
visudo visudo
```
# Test Docker installation # Test Docker installation
```bash
docker run hello-world docker run hello-world
``` ```