Update docs/tech_docs/OpenWrt.md

This commit is contained in:
2024-04-22 00:21:48 +00:00
parent befbbdb2c2
commit a799c88499

View File

@@ -1,45 +1,47 @@
## Links
- [Split A GPU Between Multiple Computers - Proxmox LXC (Unprivileged)
](https://youtu.be/0ZDr5h52OOE?si=F4RVd5mA5IRjrpXU)
- [Must-Have OpenWrt Router Setup For Your Proxmox
](https://youtu.be/3mPbrunpjpk?si=WofNEJUZL4FAw7HP)
- [Docker on Proxmox LXC 🚀 Zero Bloat and Pure Performance!
](https://youtu.be/-ZSQdJ62r-Q?si=GCXOEsKnOdm6OIiz)
- [stuff](url)
## 'pct' commands
```markdown
[pct commands](https://git.crazystorm.xyz/medusa/the_information_nexus/src/branch/main/docs/tech_docs/pct.md)
```
- [pct commands](https://git.crazystorm.xyz/medusa/the_information_nexus/src/branch/main/docs/tech_docs/pct.md)
---
# Proxmox Container Setup Guide
This guide provides step-by-step instructions for setting up OpenWRT, Kali Linux, and Alpine Linux containers on Proxmox.
## Introduction
This guide provides detailed instructions for configuring OpenWRT, Alpine Linux, and Kali Linux containers on a Proxmox VE environment. Each section covers the creation, configuration, and basic setup steps necessary to get each type of container up and running, tailored for use in a lab setting.
## OpenWRT Container Setup
## Links
- [Split A GPU Between Multiple Computers - Proxmox LXC (Unprivileged)](https://youtu.be/0ZDr5h52OOE?si=F4RVd5mA5IRjrpXU)
- [Must-Have OpenWrt Router Setup For Your Proxmox](https://youtu.be/3mPbrunpjpk?si=WofNEJUZL4FAw7HP)
- [Docker on Proxmox LXC 🚀 Zero Bloat and Pure Performance!](https://youtu.be/-ZSQdJ62r-Q?si=GCXOEsKnOdm6OIiz)
### Create and Configure the OpenWRT Container
## Prerequisites
- Proxmox VE installed on your server
- Access to Proxmox web interface or command-line interface
- Container templates downloaded (OpenWRT, Alpine, Kali Linux)
## Container Configuration
### OpenWRT Container Setup
#### Description
This section details setting up an OpenWRT container designed for network routing and firewall tasks.
#### Create and Configure the OpenWRT Container
```bash
pct create 100 /var/lib/vz/template/cache/openwrt-rootfs.tar.xz --unprivileged 1 --arch amd64 --ostype unmanaged --hostname openwrt-0 --password password --tag network --storage local-lvm --memory 256 --swap 128 --rootfs local-lvm:1,size=512M --net0 name=eth0,bridge=vmbr0,firewall=1 --net1 name=eth1,bridge=vmbr1,firewall=1 --cores 1 --cpuunits 500 --onboot 1 --debug 0
pct create 100 /var/lib/vz/template/cache/openwrt-rootfs.tar.xz \
--unprivileged 1 --arch amd64 --ostype unmanaged --hostname openwrt-0 \
--password <password> --tag network --storage local-lvm --memory 256 --swap 128 \
--rootfs local-lvm:1,size=512M --net0 name=eth0,bridge=vmbr0,firewall=1 \
--net1 name=eth1,bridge=vmbr1,firewall=1 --cores 1 --cpuunits 500 --onboot 1 --debug 0
```
### Start the Container and Access the Console
#### Start the Container and Access the Console
```bash
pct start 100
pct console 100
```
### Update and Install Packages
#### Update and Install Packages
```bash
opkg update
opkg install qemu-ga
reboot
```
### Network and Firewall Configuration
#### Network and Firewall Configuration
Configure network settings and firewall rules:
```bash
vi /etc/config/network
/etc/init.d/network restart
@@ -47,6 +49,7 @@ vi /etc/config/network
vi /etc/config/firewall
/etc/init.d/firewall restart
# Setting up firewall rules using UCI
uci add firewall rule
uci set firewall.@rule[-1].name='Allow-SSH'
uci set firewall.@rule[-1].src='wan'
@@ -72,38 +75,47 @@ uci commit firewall
/etc/init.d/firewall restart
```
## Alpine Container Setup
### Alpine Container Setup
#### Description
Set up an Alpine Linux container optimized for running Docker, ensuring lightweight deployment and management of Docker applications.
### Create and Configure the Alpine Container
#### Create and Configure the Alpine Container
```bash
pct create 300 /var/lib/vz/template/cache/alpine-rootfs.tar.xz --unprivileged 1 --arch amd64 --ostype alpine --hostname alpine-0 --password password --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 <password> --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
```
### System Update and Package Installation
#### System Update and Package Installation
Enable community repositories and install essential packages:
```bash
sed -i '/^#.*community/s/^#//' /etc/apk/repositories
apk update && apk upgrade
apk add qemu-guest-agent docker openssh sudo
```
### Start and Enable Docker Service
#### Start and Enable Docker Service
```bash
rc-service docker start
rc-update add docker default
```
### Configure Network
#### Configure Network
Set up network interfaces and restart networking services:
```bash
setup-interfaces
service networking restart
```
### Configure and Start SSH Service
#### Configure and Start SSH Service
```bash
rc-update add sshd
service sshd start
@@ -111,23 +123,31 @@ vi /etc/ssh/sshd_config
service sshd restart
```
### Create a System User and Add to Docker Group and Sudoers
#### Create a System User and Add to Docker Group and Sudoers
```bash
adduser -s /bin/ash medusa
addgroup medusa docker
echo "medusa ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/medusa
```
### Test Docker Installation
#### Test Docker Installation
```bash
docker run hello-world
```
## Kali Linux Container Setup
### Kali Linux Container Setup
#### Description
Configure a Kali Linux container tailored for security testing and penetration testing tools.
### Create and Configure the Kali Linux Container
#### Create and Configure the Kali Linux Container
```bash
pct create 200 /var/lib/vz/template/cache/kali-default-rootfs.tar.xz --unprivileged 1 --arch amd64 --ostype debian --hostname kali-0 --password password --tag tools --storage local-lvm --cores 2 --memory 2048 --swap 1024 --rootfs local-lvm:1,size=10G --net0 name=eth0,bridge=vmbr0,firewall=1 --cpuunits 1500 --onboot 1 --debug 0 --features nesting=1,keyctl=1
pct create 200 /var/lib/vz/template/cache/kali-default-rootfs.tar.xz \
--unprivileged 1 --arch amd64 --ostype debian --hostname kali-0 \
--password <password> --tag tools --storage local-lvm --cores 2 \
--memory 2048 --swap 1024 --rootfs local-lvm:1,size=10G \
--net0 name=eth0,bridge=vmbr0,firewall=1 --cpuunits 1500 --onboot 1 \
--debug 0 --features nesting=1,keyctl=1
```
With these steps, you'll have OpenWRT, Alpine Linux with Docker, and Kali Linux containers set up on your Proxmox environment. Remember to adjust the configurations, usernames, and passwords according to your specific requirements and security best practices.
## Conclusion
Follow these steps to successfully set up and configure OpenWRT, Alpine, and Kali Linux containers on Proxmox. Adjust configurations according to your specific needs and ensure all passwords are secure before deploying containers in a production environment.