# Datacom Configuratie Handleiding

## Inhoudsopgave
- [Basis Commando's](#basis-commandos)
- [IP Subnetting](#ip-subnetting)
- [Router Configuratie](#router-configuratie)
- [DHCP Configuratie](#dhcp-configuratie)
- [DNS Configuratie](#dns-configuratie)
- [Routing](#routing)
- [IPv6 Configuratie](#ipv6-configuratie)
- [VLAN Netwerken](#vlan-netwerken)
- [LACP](#lacp)
- [HSRP](#hsrp)
- [NAT/PAT](#natpat)
- [Access Control Lists (ACLs)](#access-control-lists-acls)

## Basis Commando's

### DNS Lookup
```bash
nslookup (website naam)  # Vind IP adressen van websites
```

## IP Subnetting

### Subnetting Stappen

| Stap | Actie |
|------|--------|
| 1 | IP naar binair converteren |
| 2 | Subnetmask naar binair converteren |
| 3 | Lijn trekken waar 1 overgaat naar 0 in subnetmask |
| 4 | Rechts van de streep wordt 0 |

### Binaire Referentie
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|-----|----|----|----|----|----|----|---|
| 2⁷  | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ |

### Voorbeeld Berekening
**IP adres:** 192.168.168.129/29

| Component | Binair | Decimaal |
|-----------|---------|----------|
| IP adres | 11000000.10101000.10101000.10000\|001 | 192.168.168.129 |
| Subnetmask | 11111111.11111111.11111111.11111\|000 | 255.255.255.248 |
| Network ID | 11000000.10101000.10101000.10000000 | 192.168.168.128/29 |
| First Host | Network ID + 1 | 192.168.168.129 |
| Last Host | Broadcast - 1 | 192.168.168.134 |
| Broadcast | Rechts van streep alle 1 | 192.168.168.135 |

> **Default Gateway:** Het IP-adres van de router

## Router Configuratie

### Basis Router Setup

| Stap | Commando | Beschrijving |
|------|----------|--------------|
| 1 | `enable` | Privileged EXEC mode |
| 2 | `configure terminal` | Global configuration mode |
| 3 | `show ip interface brief` | Toon interface status |
| 4 | `interface gigabitEthernet X/Y` | Selecteer interface |
| 5 | `ip address [IP] [SUBNETMASK]` | Configureer IP adres |
| 6 | `no shutdown` | Activeer interface |

### Voorbeeld Configuratie
```cisco
Router> enable
Router# configure terminal
Router(config)# interface gigabitEthernet 0/0
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Router(config-if)# no shutdown
Router(config-if)# exit
```

## DHCP Configuratie

### DHCP Server op Router

```cisco
Router(config)# ip dhcp pool [POOL_NAME]
Router(dhcp-config)# dns-server 1.1.1.1
Router(dhcp-config)# network [NETWORK_IP] [SUBNETMASK]
Router(dhcp-config)# default-router [GATEWAY_IP]
Router(dhcp-config)# exit
```

### DHCP Server op Dedicated Server

| Configuratie Item | Beschrijving |
|-------------------|--------------|
| **Server IP** | Geef de DHCP server een eigen IP adres |
| **DHCP Pools** | Maak voor elk netwerk een aparte DHCP pool |
| **IP Helper** | Gebruik `ip helper-address [DHCP_SERVER_IP]` voor externe netwerken |

#### DHCP Helper Configuratie
```cisco
Router(config)# interface [INTERFACE]
Router(config-if)# ip helper-address [DHCP_SERVER_IP]
```

### Client Configuratie
1. Ga naar computer/apparaat
2. Open desktop/netwerk instellingen
3. Selecteer DHCP optie

## DNS Configuratie

### DNS Server Setup
- **Locatie:** Configureer op dezelfde server als DHCP
- **Functie:** IP adressen koppelen aan namen

### Voorbeeld DNS Entries
| Apparaat | IP Adres | DNS Naam |
|----------|----------|----------|
| PC1 | 192.168.10.2 | pc1.local |
| Server | 192.168.10.10 | server.local |
| Printer | 192.168.10.20 | printer.local |

## Routing

### Statische Routing

#### Configuratie Overzicht
Voor communicatie tussen netwerken moet op beide routers een statische route worden geconfigureerd.

| Router | Doel Netwerk | Next Hop |
|--------|--------------|----------|
| Links | Rechter netwerk + subnetmask | IP van rechter router |
| Rechts | Linker netwerk + subnetmask | IP van linker router |

#### Voorbeeld Configuratie
```cisco
# Linker Router
Router(config)# ip route [RECHTER_NETWORK] [SUBNETMASK] [RECHTER_ROUTER_IP]

# Rechter Router  
Router(config)# ip route [LINKER_NETWORK] [SUBNETMASK] [LINKER_ROUTER_IP]
```

### OSPF (Open Shortest Path First)

#### OSPF Configuratie Steps
```cisco
Router(config)# router ospf 1
Router(config-router)# network [NETWORK_IP] [WILDCARD_MASK] area 0
```

#### Wildcard Mask Berekening
| Subnetmask | Wildcard Mask |
|------------|---------------|
| 255.255.255.0 | 0.0.0.255 |
| 255.255.0.0 | 0.0.255.255 |
| 255.0.0.0 | 0.255.255.255 |

> **Tip:** Wildcard mask = 255.255.255.255 - Subnetmask

#### Voorbeeld OSPF Setup
```cisco
Router(config)# router ospf 1
Router(config-router)# network 192.168.10.0 0.0.0.255 area 0
Router(config-router)# network 10.0.0.0 0.0.0.255 area 0
```

> **Belangrijk:** Configureer dit op beide routers voor alle aangesloten netwerken.

## IPv6 Configuratie

### Basis IPv6 Router Setup

#### Standaard IPv6 Configuratie
```cisco
Router(config)# ipv6 unicast-routing
Router(config)# interface gigabitEthernet 0/0
Router(config-if)# ipv6 address [IPv6_ADDRESS/PREFIX]
Router(config-if)# ipv6 address fe80::1 link-local
Router(config-if)# no shutdown
```

#### Voorbeeld IPv6 Adressen
| Type | Format | Voorbeeld |
|------|--------|-----------|
| Globaal | 2001:acad:db8:x::x/64 | 2001:acad:db8:1::1/64 |
| Link-Local | fe80::x | fe80::1 |

### IPv6 Routing

#### OSPF voor IPv6
```cisco
Router(config)# ipv6 router ospf 1
Router(config-if)# ipv6 ospf 1 area 0
```

#### Router-on-a-Stick met IPv6
```cisco
Router(config)# interface gigabitEthernet 0/1.10
Router(config-subif)# encapsulation dot1Q 10
Router(config-subif)# ipv6 address 2001:acad:db8:10::1/64
Router(config-subif)# ipv6 address fe80::1 link-local
Router(config-subif)# ipv6 nd other-config-flag
Router(config-subif)# ipv6 ospf 1 area 0
```

> **Netwerkconventie:** Gebruik altijd netwerk IDs die beginnen met `2001:acad:db8:x`

## VLAN Netwerken

### Router Configuratie (Router-on-a-Stick)

#### Sub-interface Setup
```cisco
Router(config)# interface gigabitEthernet 0/1.10
Router(config-subif)# encapsulation dot1Q 10
Router(config-subif)# ip address 192.168.10.1 255.255.255.0
Router(config-subif)# exit

Router(config)# interface gigabitEthernet 0/1.20
Router(config-subif)# encapsulation dot1Q 20
Router(config-subif)# ip address 192.168.20.1 255.255.255.0
Router(config-subif)# exit

Router(config)# interface gigabitEthernet 0/1
Router(config-if)# no shutdown
```

### Switch Configuratie

#### VLAN Aanmaken
```cisco
Switch(config)# vlan 10
Switch(config-vlan)# name CLIENTS
Switch(config-vlan)# exit

Switch(config)# vlan 20
Switch(config-vlan)# name SERVERS
Switch(config-vlan)# exit
```

#### Port Assignment Table
| Port Type | Gebruik | Configuratie |
|-----------|---------|--------------|
| **Access** | Eén VLAN per poort | `switchport mode access` |
| **Trunk** | Meerdere VLANs | `switchport mode trunk` |

#### Access Port Configuratie
```cisco
Switch(config)# interface fastEthernet 0/1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10

Switch(config)# interface fastEthernet 0/2
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 20
```

#### Trunk Port Configuratie
```cisco
Switch(config)# interface gigabitEthernet 0/1
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20
```

## LACP

### Link Aggregation Control Protocol

LACP zorgt ervoor dat al het netwerkverkeer over meerdere kabels kan lopen. Als één kabel uitvalt, blijft het netwerk functioneren via de andere kabels.

#### Vereisten
- Minimaal 2 switches
- Meerdere fysieke verbindingen tussen switches

#### LACP Configuratie

**Switch 1 en Switch 2:**
```cisco
Switch> enable
Switch# configure terminal
Switch(config)# interface range fastEthernet 0/1-8
Switch(config-if-range)# channel-group 1 mode active
Switch(config-if-range)# exit
Switch(config)# interface port-channel 1
Switch(config-if)# switchport mode trunk
Switch(config-if)# exit
```

#### LACP Verificatie

| Commando | Functie |
|----------|---------|
| `show etherchannel summary` | Toon EtherChannel status |
| `show lacp neighbors` | Toon LACP buren |
| **Fysieke test** | Trek een kabel uit en ping |

#### LACP met Router-on-a-Stick

**Belangrijke Configuratie Punten:**

| Component | Configuratie | Opmerking |
|-----------|--------------|-----------|
| **Router naar Switch** | Interface trunk | Hoofdverbinding |
| **Beide Switches** | VLANs aanmaken | Consistent op beide |
| **Switch naar Switch** | Mode trunk | Voor VLAN verkeer |
| **VLAN Allowlist** | `switchport trunk allowed vlan 10,20` | Specifieke VLANs |
| **Computer Poorten** | Mode access | Eindapparaten |

```cisco
# Router trunk configuratie
Router(config)# interface gigabitEthernet 0/1
Router(config-if)# switchport mode trunk

# Switch VLAN configuratie  
Switch(config)# switchport mode trunk
Switch(config)# switchport trunk allowed vlan 10,20
```

## HSRP

### Hot Standby Router Protocol

HSRP zorgt voor redundantie door twee routers hetzelfde virtuele IP-adres te geven. Bij uitval neemt de backup router automatisch over.

#### HSRP Configuratie Tabel

| Parameter | Router 1 (Primary) | Router 2 (Secondary) |
|-----------|-------------------|---------------------|
| **Virtual IP** | 192.168.1.254 | 192.168.1.254 |
| **Priority** | 110 (hoger = primary) | 100 (standaard) |
| **Preempt** | Enabled | Enabled |

#### HSRP Commands

**Router 1 (Primary):**
```cisco
Router(config)# interface gigabitEthernet 0/0
Router(config-if)# standby 1 ip 192.168.1.254
Router(config-if)# standby 1 priority 110
Router(config-if)# standby 1 preempt
```

**Router 2 (Secondary):**
```cisco
Router(config)# interface gigabitEthernet 0/0
Router(config-if)# standby 1 ip 192.168.1.254
Router(config-if)# standby 1 priority 100
Router(config-if)# standby 1 preempt
```

#### HSRP Parameter Uitleg

| Parameter | Functie |
|-----------|---------|
| `standby 1 ip` | Virtual IP (default gateway voor clients) |
| `standby 1 priority` | Bepaalt welke router primary is (hoger = primary) |
| `standby 1 preempt` | Automatische failover en failback |

### IPv6 Router-on-a-Stick

#### Complete IPv6 VLAN Setup

**Router Configuratie:**
```cisco
Router# enable
Router# configure terminal
Router(config)# ipv6 unicast-routing
Router(config)# interface gigabitEthernet 0/1

# VLAN 10 sub-interface
Router(config)# interface gigabitEthernet 0/1.10
Router(config-subif)# encapsulation dot1Q 10
Router(config-subif)# ipv6 address 2001:acad:db8:10::1/64
Router(config-subif)# ipv6 address fe80::1 link-local
Router(config-subif)# ipv6 nd other-config-flag
Router(config-subif)# ipv6 ospf 1 area 0

# Hoofdinterface activeren
Router(config)# interface gigabitEthernet 0/1
Router(config-if)# no shutdown
```

**Switch Configuratie met LACP:**
```cisco
Switch# enable
Switch# configure terminal

# VLANs aanmaken
Switch(config)# vlan 10
Switch(config-vlan)# name IPv6_CLIENTS
Switch(config-vlan)# vlan 20
Switch(config-vlan)# name IPv6_SERVERS

# LACP configuratie
Switch(config)# interface range fastEthernet 0/1-8
Switch(config-if-range)# channel-group 1 mode active
Switch(config-if-range)# exit
Switch(config)# interface port-channel 1
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20
```

> **IPv6 Netwerk Conventie:** Gebruik altijd netwerk IDs die starten met `2001:acad:db8:x`  
> **DHCP Helper:** Voor computers aan de andere kant van de DHCP/DNS server zonder OSPF: `ip helper-address [DHCP_SERVER_IP]`

## NAT/PAT

### Network Address Translation / Port Address Translation

NAT/PAT wordt gebruikt om privé IP-adressen te vertalen naar publieke IP-adressen voor internetverbinding.

#### NAT/PAT Configuratie

```cisco
# Access List aanmaken
Router(config)# access-list 101 permit ip any any

# NAT overload (PAT) configureren
Router(config)# ip nat inside source list 101 interface gigabitEthernet 0/0 overload

# Outside interface configureren
Router(config)# interface gigabitEthernet 0/0
Router(config-if)# ip nat outside
Router(config-if)# exit

# Inside interface configureren  
Router(config)# interface gigabitEthernet 0/1
Router(config-if)# ip nat inside
Router(config-if)# exit
```

#### Port Forwarding

Voor specifieke services (zoals Proxmox) gebruik port forwarding:

```cisco
Router(config)# ip nat inside source static tcp 192.168.10.x 8006 [OUTSIDE_IP] 8006
Router(config)# ip nat inside source static tcp 192.168.10.y 8006 [OUTSIDE_IP] 8008
Router(config)# ip nat inside source static tcp 192.168.10.z 8006 [OUTSIDE_IP] 8009
```

#### Port Forwarding Tabel

| Internal IP | Internal Port | External Port | Service |
|-------------|---------------|---------------|---------|
| 192.168.10.10 | 8006 | 8006 | Proxmox Server 1 |
| 192.168.10.11 | 8006 | 8008 | Proxmox Server 2 |
| 192.168.10.12 | 8006 | 8009 | Proxmox Server 3 |

> ⚠️ **Belangrijk:** Gebruik NOOIT poort 8007 voor Proxmox - dit veroorzaakt conflicten!

## Access Control Lists (ACLs)

### ACL Types

| ACL Type | Nummer Range | Gebruik |
|----------|--------------|---------|
| **Standard** | 1-99, 1300-1999 | Bron IP filtering |
| **Extended** | 100-199, 2000-2699 | Geavanceerde filtering |

### Extended ACL Voorbeeld

```cisco
# Named Extended ACL
Router(config)# ip access-list extended BLOCK_HTTP_ALLOW_HTTPS
Router(config-ext-nacl)# permit tcp host 192.168.1.10 host 192.168.2.10 eq 443
Router(config-ext-nacl)# deny tcp host 192.168.1.10 host 192.168.2.10 eq 80  
Router(config-ext-nacl)# permit ip any any
Router(config-ext-nacl)# exit

# ACL toepassen op interface
Router(config)# interface gigabitEthernet 0/1
Router(config-if)# ip access-group BLOCK_HTTP_ALLOW_HTTPS in
```

### ACL Best Practices

| Regel | Beschrijving |
|-------|--------------|
| **Placement** | Extended ACLs zo dicht mogelijk bij de bron |
| **Standard** | Standard ACLs zo dicht mogelijk bij bestemming |
| **Implicit Deny** | Elke ACL eindigt met `deny ip any any` |
| **Permit All** | Voeg `permit ip any any` toe als laatste regel indien nodig |

### ACL Configuratie Tips

1. **Analyseer vereisten:** Gebruik ChatGPT voor complexe ACL vereisten
2. **Test configuratie:** Verificeer met ping en traceroute  
3. **Documenteer regels:** Voeg comments toe aan ACL entries
4. **Volgorde belangrijk:** ACLs worden van boven naar beneden verwerkt

### Voorbeeld ACL Scenario's

#### HTTP Blokkeren, HTTPS Toestaan
```cisco
Router(config)# ip access-list extended WEB_FILTER
Router(config-ext-nacl)# permit tcp any any eq 443
Router(config-ext-nacl)# deny tcp any any eq 80
Router(config-ext-nacl)# permit ip any any
```

#### Specifiek Host Blokkeren
```cisco
Router(config)# ip access-list extended BLOCK_HOST
Router(config-ext-nacl)# deny ip host 192.168.1.100 any
Router(config-ext-nacl)# permit ip any any
```

---

## Hulpbronnen

### Verificatie Commands

| Commando | Functie |
|----------|---------|
| `show ip interface brief` | Interface status en IP |
| `show ip route` | Routing tabel |
| `show vlan brief` | VLAN configuratie |
| `show etherchannel summary` | LACP status |
| `show standby brief` | HSRP status |
| `show access-lists` | ACL configuratie |
| `show ip nat translations` | NAT vertalingen |

### Troubleshooting Tips

1. **Connectiviteit:** Start met `ping` en `traceroute`
2. **Interfaces:** Controleer `show ip interface brief`
3. **Routing:** Verificeer met `show ip route` 
4. **VLANs:** Check `show vlan brief`
5. **Logs:** Gebruik `show logging` voor foutmeldingen

> 💡 **Pro Tip:** Gebruik ChatGPT voor complexe ACL vereisten en netwerk troubleshooting scenario's!
