# Add VLAN 11 Secondary IP - WSL2 Guide **Last Updated:** 2026-01-15 **Status:** Active Documentation **System:** WSL2 (Ubuntu 24.04) **Purpose:** Configure machine to have both current IP and VLAN 11 IP --- ## Current Configuration - **System:** WSL2 (Ubuntu 24.04.3 LTS) - **Primary Interface:** eth0 - **Current IP:** 192.168.0.4/24 - **Target VLAN 11 IP:** 192.168.11.23/24 - **VLAN 11 Gateway:** 192.168.11.1 (✅ Reachable) --- ## Quick Setup (Immediate) **Run these commands:** ```bash # Add VLAN 11 IP address sudo ip addr add 192.168.11.4/24 dev eth0 # Add route to VLAN 11 network sudo ip route add 192.168.11.0/24 dev eth0 src 192.168.11.4 # Verify ip addr show eth0 | grep "inet " ``` **Expected Output:** ``` inet 192.168.0.4/24 ... (current IP) inet 192.168.11.23/24 ... (VLAN 11 IP) ``` --- ## Using Scripts ### Option 1: Simple Script (Temporary) ```bash sudo ./scripts/unifi/add-vlan11-secondary-ip-simple.sh ``` This adds the IP immediately but will be lost on reboot. ### Option 2: Auto-Configuration on Login (WSL2 Recommended) ```bash # Add to ~/.bashrc for auto-configuration ./scripts/unifi/add-vlan11-ip-to-bashrc.sh ``` This will automatically add the VLAN 11 IP every time you log in. **Or manually add to ~/.bashrc:** ```bash # Add this to the end of ~/.bashrc if [ -n "$(ip link show eth0 2>/dev/null)" ] && ! ip addr show eth0 | grep -q "192.168.11.23"; then sudo ip addr add 192.168.11.23/24 dev eth0 2>/dev/null || true sudo ip route add 192.168.11.0/24 dev eth0 src 192.168.11.23 2>/dev/null || true fi ``` --- ## Verification After adding the IP: ```bash # Check IP addresses ip addr show eth0 | grep "inet " # Should show both: # inet 192.168.0.4/24 ... (current) # inet 192.168.11.23/24 ... (VLAN 11) # Test connectivity ping -c 3 192.168.11.1 # VLAN 11 gateway ping -c 3 192.168.11.10 # ml110 ping -c 3 192.168.11.11 # r630-01 ping -c 3 192.168.11.12 # r630-02 ``` --- ## WSL2 Notes **Important for WSL2:** 1. **No netplan:** WSL2 doesn't use netplan by default 2. **No systemd:** WSL2 may not have systemd running 3. **Best solution:** Add to ~/.bashrc for auto-configuration on login **Persistence Options:** 1. **~/.bashrc (Recommended):** Auto-configures on each login 2. **Manual:** Run commands manually after each reboot 3. **Windows Task Scheduler:** Can run a script on Windows startup --- ## Troubleshooting ### Issue: Cannot add IP address **Error:** `RTNETLINK answers: File exists` **Solution:** IP already exists, skip this step. ### Issue: Route already exists **Error:** `RTNETLINK answers: File exists` **Solution:** Route already configured, skip this step. ### Issue: IP lost after reboot **Solution:** This is normal for WSL2. Use ~/.bashrc auto-configuration. --- ## Summary **Quick Start:** ```bash # Add IP immediately sudo ip addr add 192.168.11.23/24 dev eth0 sudo ip route add 192.168.11.0/24 dev eth0 src 192.168.11.23 # Make persistent (WSL2) ./scripts/unifi/add-vlan11-ip-to-bashrc.sh ``` **Result:** - ✅ Keep current IP: 192.168.0.4 - ✅ Add VLAN 11 IP: 192.168.11.23 - ✅ Access both networks simultaneously - ✅ Auto-configure on login (if bashrc script used) --- **Last Updated:** 2026-01-15