Update docs/tech_docs/OPENwrt.md

This commit is contained in:
2024-04-18 21:04:00 +00:00
parent e45ca2034a
commit 11247568fb

View File

@@ -86,4 +86,89 @@ After updating the configuration files, you should apply the changes:
- **Testing**: Verify connectivity by accessing SSH and HTTPS from a network outside your LAN.
- **Backup Configurations**: Always back up your configurations before making significant changes.
This streamlined guide provides a clear and effective method for deploying Proxmox containers with OpenWRT, configured for remote management access through SSH and HTTPS on the WAN interface.
This streamlined guide provides a clear and effective method for deploying Proxmox containers with OpenWRT, configured for remote management access through SSH and HTTPS on the WAN interface.
---
### Creating a Virtual Bridge (vmbr) in Proxmox via CLI
To create a new virtual bridge (`vmbrX`) on Proxmox using the command line, you need to edit the network configuration file located at `/etc/network/interfaces`. Heres how you can do it:
1. **Access the Proxmox Host**:
Connect to your Proxmox server via SSH.
2. **Edit the Network Configuration File**:
Open the `/etc/network/interfaces` file in a text editor, such as `nano` or `vim`.
```bash
vim /etc/network/interfaces
```
3. **Add Configuration for a New Bridge**:
Add the following lines to the file to create a new bridge. Replace `X` with the appropriate number for your new bridge.
```bash
auto vmbrX
iface vmbrX inet static
address 192.168.X.1
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
```
4. **Save and Apply Changes**:
Save the changes and restart the networking service to apply them.
```bash
systemctl restart networking
```
This setup creates a bridge with no physical interfaces attached (isolated bridge). If you want to attach physical interfaces, replace `none` in `bridge_ports` with the name of the interface (e.g., `eth0`).
### Adjusting Network Interface Configuration in OpenWRT
To swap interfaces or change the DHCP setting to static IP or vice versa in OpenWRT, you can modify the `/etc/config/network` file. Here's how to make these adjustments:
#### **Changing Interface Assignment (Swapping Interfaces)**
If you want to change which physical interface (e.g., from `eth0` to `eth1`) is used for WAN, modify the `option ifname` line under the corresponding section:
```bash
config interface 'wan'
option ifname 'eth1' # Changed from eth0 to eth1
option proto 'dhcp'
```
#### **Changing DHCP to Static IP (or Vice Versa)**
To change an interface from DHCP to static IP:
1. Change the `option proto 'dhcp'` to `option proto 'static'`.
2. Specify the `option ipaddr` and `option netmask` (and optionally, `option gateway` and `option dns`).
Example for a static IP configuration:
```bash
config interface 'wan'
option ifname 'eth0'
option proto 'static'
option ipaddr '192.168.1.2'
option netmask '255.255.255.0'
option gateway '192.168.1.1'
option dns '192.168.1.1'
```
To revert to DHCP:
```bash
config interface 'wan'
option ifname 'eth0'
option proto 'dhcp'
```
#### **Applying Changes in OpenWRT**
After making changes to the `/etc/config/network` file:
1. **Restart the Network Service** to apply the changes:
```bash
/etc/init.d/network restart
```
2. **Test Connectivity** to ensure that your network configurations work as expected.
These steps allow you to flexibly configure and manage network settings directly from the CLI, accommodating changes in network design or infrastructure requirements efficiently.