Some checks failed
Test / test (push) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
163 lines
3.5 KiB
Markdown
163 lines
3.5 KiB
Markdown
# Simple DHCP Deployment - All NICs with IP Detection
|
|
|
|
## Simplified Approach
|
|
|
|
Instead of trying to detect interface speeds, we now:
|
|
1. **Detect all physical NICs**
|
|
2. **Configure all with DHCP** (or first two for vmbr0/vmbr1)
|
|
3. **Let DHCP assign IPs** to connected interfaces
|
|
4. **Detect which interfaces got IP addresses**
|
|
|
|
## Scripts Available
|
|
|
|
### Option 1: Configure All NICs with DHCP (Recommended)
|
|
|
|
```bash
|
|
./network-config-dhcp-all.sh
|
|
```
|
|
|
|
This script:
|
|
- Detects ALL physical NICs
|
|
- Creates a DHCP bridge for EACH NIC (vmbr0, vmbr1, vmbr2, etc.)
|
|
- Shows which bridges got IP addresses
|
|
- Works for any number of NICs
|
|
|
|
**Use this if you want to configure all NICs and see which ones get IPs.**
|
|
|
|
### Option 2: Configure Two NICs (vmbr0/vmbr1) with DHCP
|
|
|
|
```bash
|
|
./network-config.sh
|
|
```
|
|
|
|
This script:
|
|
- Detects all physical NICs
|
|
- Uses first two NICs for vmbr0 (LAN) and vmbr1 (WAN)
|
|
- Both configured with DHCP
|
|
- Shows which ones got IP addresses
|
|
|
|
**Use this if you only want vmbr0 and vmbr1 configured.**
|
|
|
|
## Quick Deployment
|
|
|
|
### On R630 (pve2)
|
|
|
|
```bash
|
|
cd /opt/proxmox-network-config
|
|
|
|
# Option A: Configure all NICs
|
|
./network-config-dhcp-all.sh
|
|
|
|
# Option B: Configure just vmbr0/vmbr1
|
|
./network-config.sh
|
|
```
|
|
|
|
### On ML110 (pve)
|
|
|
|
```bash
|
|
cd /opt/proxmox-network-config
|
|
./network-config.sh
|
|
```
|
|
|
|
## How It Works
|
|
|
|
1. **Detects all physical NICs** (excludes bridges, bonds, VLANs)
|
|
2. **Configures bridges with DHCP** on all (or first two)
|
|
3. **Applies configuration** and waits for DHCP
|
|
4. **Shows IP detection results** - which interfaces got IPs
|
|
|
|
## IP Detection Results
|
|
|
|
After deployment, the script shows:
|
|
|
|
```
|
|
✓ vmbr0 (nic0): 192.168.1.49/24
|
|
✗ vmbr1 (nic1): No IP address assigned
|
|
✓ vmbr2 (nic2): 203.0.113.10/24
|
|
```
|
|
|
|
This tells you:
|
|
- Which interfaces are connected and have DHCP
|
|
- Which interfaces got IP addresses
|
|
- Which ones to use for LAN vs WAN
|
|
|
|
## Example Usage
|
|
|
|
### Step 1: Preview Configuration
|
|
|
|
```bash
|
|
DRY_RUN=true ./network-config-dhcp-all.sh
|
|
```
|
|
|
|
Review the configuration to see which NICs will be configured.
|
|
|
|
### Step 2: Apply Configuration
|
|
|
|
```bash
|
|
./network-config-dhcp-all.sh
|
|
```
|
|
|
|
### Step 3: Check IP Detection
|
|
|
|
The script automatically shows which bridges got IP addresses. You can also check manually:
|
|
|
|
```bash
|
|
ip addr show
|
|
```
|
|
|
|
### Step 4: Verify Routing
|
|
|
|
```bash
|
|
ip route show
|
|
```
|
|
|
|
The default route should go through the interface with the public IP (WAN).
|
|
|
|
## Advantages
|
|
|
|
✅ **Simple** - No complex speed detection
|
|
✅ **Reliable** - DHCP determines connectivity
|
|
✅ **Flexible** - Works with any number of NICs
|
|
✅ **Clear** - Shows exactly which interfaces got IPs
|
|
✅ **Automatic** - Let DHCP decide which interfaces are active
|
|
|
|
## Troubleshooting
|
|
|
|
### No IPs Assigned
|
|
|
|
If no interfaces get IP addresses:
|
|
- Check cables are connected
|
|
- Verify DHCP servers are available
|
|
- Wait a few moments - DHCP can take time
|
|
- Check: `dhclient -v vmbr0`
|
|
|
|
### Wrong Interfaces Selected
|
|
|
|
If you want specific NICs:
|
|
```bash
|
|
# For network-config.sh (two NICs only)
|
|
NIC1_OVERRIDE=nic2 NIC2_OVERRIDE=nic3 ./network-config.sh
|
|
```
|
|
|
|
For `network-config-dhcp-all.sh`, it configures all NICs, so you can see which ones get IPs.
|
|
|
|
### Check Interface Status
|
|
|
|
```bash
|
|
# See all interfaces
|
|
ip link show
|
|
|
|
# See IPs on all bridges
|
|
for br in vmbr0 vmbr1 vmbr2 vmbr3; do
|
|
ip addr show $br 2>/dev/null | grep "inet " || echo "$br: No IP"
|
|
done
|
|
```
|
|
|
|
## Which Script to Use?
|
|
|
|
- **`network-config-dhcp-all.sh`**: Configure ALL NICs, see which ones get IPs
|
|
- **`network-config.sh`**: Configure just vmbr0/vmbr1 with first two NICs
|
|
|
|
Both use DHCP and detect IP addresses automatically!
|
|
|