# Network Requirements

To successfully host GPU servers on Clore.ai, your network must meet these requirements.

## Minimum Requirements

| Parameter      | Requirement                          |
| -------------- | ------------------------------------ |
| Download speed | 100 Mbps minimum                     |
| Upload speed   | 100 Mbps minimum                     |
| Latency        | < 100ms to major regions             |
| IP type        | Static or Dynamic (static preferred) |

> **Note:** Higher bandwidth results in better server ratings and more rentals.

## Required Ports

The following ports must be accessible from the internet:

| Port      | Protocol | Purpose                          |
| --------- | -------- | -------------------------------- |
| 22        | TCP      | SSH access (or custom SSH port)  |
| 8080      | TCP      | Jupyter Notebook (if enabled)    |
| 3000-4000 | TCP      | Application ports (configurable) |
| Custom    | TCP/UDP  | As defined in server settings    |

## Firewall Configuration

### UFW (Ubuntu)

```bash
# Allow SSH
sudo ufw allow 22/tcp

# Allow Jupyter
sudo ufw allow 8080/tcp

# Allow port range for applications
sudo ufw allow 3000:4000/tcp

# Enable firewall
sudo ufw enable
```

### iptables

```bash
# Allow SSH
iptables -A INPUT -p tcp --dport 22 -j ACCEPT

# Allow Jupyter
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT

# Allow port range
iptables -A INPUT -p tcp --dport 3000:4000 -j ACCEPT

# Save rules
iptables-save > /etc/iptables/rules.v4
```

## NAT / Port Forwarding

If your server is behind a router:

1. **Access router admin panel** (usually 192.168.1.1)
2. **Find Port Forwarding section**
3. **Forward required ports** to your server's internal IP
4. **Set static internal IP** for your server

### Example Port Forwarding Rules

| External Port | Internal IP   | Internal Port | Protocol |
| ------------- | ------------- | ------------- | -------- |
| 22022         | 192.168.1.100 | 22            | TCP      |
| 8080          | 192.168.1.100 | 8080          | TCP      |

## Static vs Dynamic IP

### Static IP (Recommended)

* Consistent connection for renters
* Better for DNS and bookmarks
* Higher server reliability rating

### Dynamic IP

* Works but requires DDNS service
* IP changes may briefly interrupt rentals
* Configure DDNS client on your server:

```bash
# Example with ddclient
sudo apt install ddclient
sudo nano /etc/ddclient.conf
```

## Bandwidth Considerations

### Impact on Earnings

| Speed    | Impact                                |
| -------- | ------------------------------------- |
| 100 Mbps | Minimum - basic rentals               |
| 500 Mbps | Good - suitable for most ML workloads |
| 1 Gbps+  | Excellent - attracts premium renters  |

### Monitoring Bandwidth

```bash
# Install monitoring tool
sudo apt install iftop

# Monitor in real-time
sudo iftop -i eth0
```

## Network Testing

### Speed Test

```bash
# Install speedtest
sudo apt install speedtest-cli

# Run test
speedtest-cli
```

### Latency Test

```bash
# Test to common regions
ping -c 10 8.8.8.8        # Google DNS
ping -c 10 1.1.1.1        # Cloudflare
```

### Port Accessibility Test

From outside your network, verify ports are open:

```bash
# Using nmap from another machine
nmap -p 22,8080 YOUR_PUBLIC_IP

# Or use online port checker
# https://www.yougetsignal.com/tools/open-ports/
```

## Troubleshooting

### Ports Not Accessible

1. Check firewall rules on server
2. Verify router port forwarding
3. Contact ISP - some block hosting
4. Try different port numbers

### Slow Connection

1. Run speed test
2. Check for bandwidth throttling
3. Consider upgrading internet plan
4. Optimize server network settings:

```bash
# Increase network buffer sizes
sudo sysctl -w net.core.rmem_max=16777216
sudo sysctl -w net.core.wmem_max=16777216
```

### Connection Drops

1. Check for IP address changes
2. Verify router stability
3. Monitor system logs: `dmesg | grep -i network`
4. Consider using ethernet instead of WiFi
