# 🌐 DNS Access Setup Guide

## Current Status

✅ **Firewall Fixed**: Ports 3000 and 8080 are now open  
⚠️ **DNS Configuration**: Needs to be updated to point to public IP

## The Problem

Your DNS `houseofprayer.ddns.net` is currently pointing to:

- **Internal IP**: 192.168.10.130 (only works on your local network)
- **Should point to**: 170.254.17.146 (your public IP for external access)

## Solution: Update No-IP DNS

### Option 1: Using No-IP Website (Recommended)

1. **Login to No-IP**:
   - Go to <https://www.noip.com/login>
   - Login with your account

2. **Update Your Hostname**:
   - Go to "My Services" → "DNS Records"
   - Find `houseofprayer.ddns.net`
   - Click "Modify"
   - Update the IP address to: **170.254.17.146**
   - Click "Update"

3. **Wait for DNS Propagation** (5-15 minutes)

### Option 2: Install No-IP Dynamic Update Client (DUC)

This automatically updates your DNS when your public IP changes:

```bash
# Download and install No-IP DUC
cd /usr/local/src/
sudo wget http://www.noip.com/client/linux/noip-duc-linux.tar.gz
sudo tar xzf noip-duc-linux.tar.gz
cd noip-2.1.9-1/
sudo make
sudo make install

# Configure (enter your No-IP username and password when prompted)
sudo /usr/local/bin/noip2 -C

# Start the service
sudo /usr/local/bin/noip2

# Make it start on boot
echo '@reboot /usr/local/bin/noip2' | sudo tee -a /etc/crontab
```

## Router Configuration

You MUST configure port forwarding on your router:

### Port Forwarding Rules Needed

1. **Frontend Access**:
   - External Port: 3000
   - Internal IP: 192.168.10.130
   - Internal Port: 3000
   - Protocol: TCP

2. **Backend API**:
   - External Port: 8080
   - Internal IP: 192.168.10.130
   - Internal Port: 8080
   - Protocol: TCP

### How to Configure (General Steps)

1. Login to your router (usually <http://192.168.10.1> or <http://192.168.1.1>)
2. Find "Port Forwarding" or "Virtual Server" section
3. Add the rules above
4. Save and reboot router if needed

### Common Router URLs

- **Netgear**: <http://192.168.1.1> or routerlogin.net
- **TP-Link**: <http://192.168.0.1> or <http://tplinkwifi.net>
- **Linksys**: <http://192.168.1.1>
- **ASUS**: <http://192.168.1.1> or router.asus.com
- **D-Link**: <http://192.168.0.1>

## Testing After Setup

### 1. Test from Server (Local)

```bash
curl http://localhost:3000
curl http://localhost:8080/api/songs
```

### 2. Test from Local Network

```bash
curl http://192.168.10.130:3000
curl http://192.168.10.130:8080/api/songs
```

### 3. Test DNS Resolution

```bash
nslookup houseofprayer.ddns.net
# Should show: 170.254.17.146
```

### 4. Test External Access (from phone/another network)

- <http://houseofprayer.ddns.net:3000>
- <http://houseofprayer.ddns.net:8080/api/songs>

## Current Configuration

### Server Information

- **Public IP**: 170.254.17.146
- **Internal IP**: 192.168.10.130
- **DNS**: houseofprayer.ddns.net
- **Backend Port**: 8080 ✅ (Firewall Open)
- **Frontend Port**: 3000 ✅ (Firewall Open)

### Services Running

- Backend: <http://0.0.0.0:8080> (listening on all interfaces)
- Frontend: <http://0.0.0.0:3000> (listening on all interfaces)

## Quick Checklist

- [ ] Update No-IP DNS to point to 170.254.17.146
- [ ] Configure router port forwarding for port 3000
- [ ] Configure router port forwarding for port 8080
- [ ] Wait 5-15 minutes for DNS propagation
- [ ] Test from external network (phone with WiFi off)

## Troubleshooting

### If DNS still shows old IP

```bash
# Clear DNS cache (if on Windows)
ipconfig /flushdns

# Check what IP DNS resolves to
nslookup houseofprayer.ddns.net

# Test direct IP access
curl http://170.254.17.146:3000
```

### If you can't access even with direct IP

1. Check your ISP doesn't block ports 3000 or 8080
2. Verify router port forwarding is saved and active
3. Check if router needs reboot after port forwarding changes
4. Some ISPs block incoming connections - may need to contact them

### Check if your ISP blocks ports

```bash
# From another network/phone:
telnet 170.254.17.146 3000
telnet 170.254.17.146 8080
```

## Alternative: Use Standard Port 80/443

If port 3000/8080 are blocked, you can:

1. **Use Nginx as reverse proxy on port 80**:
   - <http://houseofprayer.ddns.net> → redirects to port 3000 internally

2. **Get SSL certificate with Let's Encrypt**:
   - <https://houseofprayer.ddns.net> → secure access

Would you like help setting up Nginx reverse proxy?

---

**Need Help?** If you get stuck, I can help you set up the No-IP client or configure a reverse proxy.
