Tags: iSCSI · Storage · SAN · Windows Server · Linux · MPIO · Target · Initiator

Por Duarte Spínola · 5 de Julho de 2026

iSCSI: Configurar Storage em Rede para PMEs em 2026

O iSCSI (Internet Small Computer Systems Interface) permite aceder a storage remota através de uma rede IP padrão, sem precisar de Fibre Channel. É a tecnologia SAN (Storage Area Network) mais acessível para PMEs — usa switches Ethernet normais em vez de hardware proprietário. Este guia cobre configuração de Target e Initiator em Windows Server 2025 e Linux, MPIO, VLANs, Jumbo Frames e segurança, com base na documentação oficial Microsoft.

Para complementar, consulta os artigos sobre Hyper-V, DFS Namespaces, Azure File Sync, Windows Server 2025 e Windows Admin Center.

Conteúdos

1. O Que é iSCSI e Quando Usar

O iSCSI transporta comandos SCSI (o mesmo protocolo usado em discos físicos) sobre TCP/IP. O resultado: um disco remoto aparece no sistema operativo como se fosse um disco local. Não é um filesystem partilhado (como SMB) — cada LUN (Logical Unit Number) é acessível por um initiator de cada vez.

Quando usar iSCSI:

  • Hyper-V / VMware com storage centralizado
  • Cluster de failover (CSV — Cluster Shared Volume)
  • SQL Server com storage dedicado
  • Backup de discos virtuais (VHD remoto)
  • SAN para PME sem orçamento para Fibre Channel

2. iSCSI vs Fibre Channel vs SMB

Característica iSCSI Fibre Channel SMB 3.x
Transporte TCP/IP Fibre Channel TCP/IP
Hardware Ethernet standard FC switches/HBAs Ethernet standard
Bloco vs Ficheiro Bloco (LUN) Bloco (LUN) Ficheiro
Partilha múltipla Não (1 initiator/LUN) Não (1 initiator/LUN) Sim (multi-host)
Custo Baixo Elevado Baixo
Performance Alta (com Jumbo) Máxima Alta (SMB Multichannel)

3. Arquitetura: Target e Initiator

  • Target — o servidor de storage. Tem os discos físicos e expõe LUNs via iSCSI
  • Initiator — o cliente que consome o storage. Liga-se ao Target e monta o LUN como disco local
  • Portal — endereço IP + porta (3260 por defeito) do Target
  • IQN (iSCSI Qualified Name) — identificador único (ex: iqn.1991-05.com.microsoft:ws2025-target)
  • LUN — Logical Unit Number — o disco lógico exposto pelo Target

4. Configurar Target no Windows Server 2025

# Instalar a função iSCSI Target Server
Install-WindowsFeature -Name FS-iSCSITarget-Server -IncludeManagementTools

# Criar iSCSI Virtual Disk (VHD para iSCSI)
New-IscsiVirtualDisk -Path "D:\iSCSI\hyper-v-lun01.vhdx" `
  -SizeBytes 500GB -Description "LUN para Hyper-V VMs"

# Criar Target
New-IscsiServerTarget -TargetName "hyper-v-target" `
  -InitiatorIds @("Iqn:iqn.1991-05.com.microsoft:hyperv01","Iqn:iqn.1991-05.com.microsoft:hyperv02")

# Mapear LUN ao Target
Add-IscsiVirtualDiskTargetMapping -TargetName "hyper-v-target" `
  -Path "D:\iSCSI\hyper-v-lun01.vhdx" -Lun 0

# Verificar
Get-IscsiServerTarget
Get-IscsiVirtualDisk

# Firewall: abrir porta 3260
Enable-NetFirewallRule -Name "iSCSITarget-In-TCP"

5. Configurar Initiator no Windows

# No servidor Hyper-V (Initiator)

# 1. Iniciar serviço iSCSI
Set-Service -Name MSiSCSI -StartupType Automatic
Start-Service MSiSCSI

# 2. Descobrir Target
New-IscsiSession -TargetPortalName "192.168.10.50" -Discovery

# 3. Ligar ao Target
$target = Get-IscsiTarget | Where-Object { $_.TargetName -eq "hyper-v-target" }
Connect-IscsiTarget -NodeAddress $target.NodeAddress `
  -TargetPortalName "192.168.10.50" `
  -IsPersistent $true

# 4. Verificar sessão
Get-IscsiSession
Get-IscsiConnection

# 5. O disco aparece como disco local:
Get-Disk | Where-Object { $_.BusType -eq "iSCSI" }

# 6. Inicializar, formatar e montar
$disk = Get-Disk | Where-Object { $_.BusType -eq "iSCSI" -and $_.PartitionStyle -eq "RAW" }
Initialize-Disk -Number $disk.Number -PartitionStyle GPT
New-Partition -DiskNumber $disk.Number -UseMaximumSize -AssignDriveLetter
Format-Volume -DriveLetter E -FileSystem NTFS -NewFileSystemLabel "Hyper-V-Storage"

6. Configurar iSCSI no Linux

# === TARGET (Linux) ===
# Instalar targetcli
sudo apt install targetcli-fb

# Criar block device (backstore)
sudo targetcli
# /> cd /backstores/block
# /backstores/block> create name=lun01 dev=/dev/sdb1
# /> cd /iscsi
# /iscsi> create iqn.2026-07.pt.empresa:storage-target
# /> cd /iscsi/iqn.../tpg1/luns
# /.../luns> create /backstores/block/lun01
# /> cd /iscsi/iqn.../tpg1/acls
# /.../acls> create iqn.2026-07.pt.empresa:client01
# /> cd /iscsi/iqn.../tpg1/portals
# /.../portals> create 192.168.10.50
# /> saveconfig
# /> exit

# ativar e persistir
sudo systemctl enable target
sudo systemctl start target

# Abrir firewall
sudo ufw allow 3260/tcp

# === INITIATOR (Linux) ===
sudo apt install open-iscsi
sudo systemctl enable iscsid
sudo systemctl start iscsid

# Descobrir Target
sudo iscsiadm -m discovery -t st -p 192.168.10.50
# Output: 192.168.10.50:3260,1 iqn.2026-07.pt.empresa:storage-target

# Ligar ao Target
sudo iscsiadm -m node -T iqn.2026-07.pt.empresa:storage-target -p 192.168.10.50 -l

# Persistir ligação (auto-connect no boot)
sudo iscsiadm -m node -T iqn.2026-07.pt.empresa:storage-target -p 192.168.10.50 --op update -n node.startup -v automatic

# Verificar disco
lsblk
# Deve mostrar novo disco (ex: sdc)

# Formatar e montar
sudo mkfs.ext4 /dev/sdc
sudo mkdir /mnt/iscsi
sudo mount /dev/sdc /mnt/iscsi

# FSTab para persistência
echo "/dev/sdc /mnt/iscsi ext4 _netdev 0 0" | sudo tee -a /etc/fstab

7. MPIO: Multipath para Redundância

# MPIO (Multipath I/O) fornece redundância e load balancing
# Se um caminho de rede falha, o tráfego continua pelo outro

# Instalar MPIO no Windows
Install-WindowsFeature -Name Multipath-IO

# Configurar MPIO para iSCSI
mpclaim -e -d "MSFT2005iSCSIBusType_0x9"
# Enable MPIO for iSCSI

# Configurar policy de load balancing
# Round Robin: alterna entre caminhos (recomendado para performance)
# Failover Only: usa caminho secundário só se primário falhar
mpclaim -l -d "MSFT2005iSCSIBusType_0x9" 2
# 2 = Round Robin

# No Linux, usar multipath-tools
sudo apt install multipath-tools

# /etc/multipath.conf
# defaults {
#     path_grouping_policy multibus
#     path_checker readsector0
#     failback immediate
# }

sudo systemctl enable multipathd
sudo systemctl start multipathd

# Verificar caminhos
sudo multipath -ll

8. VLANs para Tráfego iSCSI

💡 Dica: Usa sempre uma VLAN dedicada para tráfego iSCSI. Isto isola o tráfego de storage do resto da rede, reduz colisões e melhora performance.

# Exemplo de configuração de VLAN iSCSI no switch Cisco
conf t
vlan 100
  name iSCSI-STORAGE
exit

# Trunk port para servidor (2 NICs para MPIO)
interface Gi1/0/1
  switchport mode trunk
  switchport trunk allowed vlan 100,200
  spanning-tree portfast trunk
exit

# Access port para storage array
interface Gi1/0/2
  switchport mode access
  switchport access vlan 100
  spanning-tree portfast
exit

# No Windows Server (Initiator): configurar 2 NICs
# NIC1: 192.168.100.10/24 (VLAN 100 - caminho A)
# NIC2: 192.168.100.11/24 (VLAN 100 - caminho B)

# No Linux:
sudo ip link add link eth0 name eth0.100 type vlan id 100
sudo ip addr add 192.168.100.20/24 dev eth0.100
sudo ip link set eth0.100 up

9. Performance: MTU 9000, Jumbo Frames

# Jumbo Frames (MTU 9000) reduz overhead em transferências grandes
# Configurar em TODOS os dispositivos no caminho: NICs, switches, target

# Windows Server — configurar MTU na NIC
Set-NetAdapterAdvancedProperty -Name "NIC1" `
  -RegistryKeyword "JumboPacket" -RegistryValue 9000

# Verificar
Get-NetAdapterAdvancedProperty -Name "NIC1" -RegistryKeyword "JumboPacket"

# Linux — configurar MTU
sudo ip link set eth0 mtu 9000

# Persistente (netplan):
# eth0:
#   mtu: 9000

# Switch Cisco — ativar Jumbo Frames
interface Gi1/0/1
  mtu 9216
exit

# Verificar MTU end-to-end
ping 192.168.100.50 -f -l 8972
# -f = don't fragment
# -l 8972 = 9000 - 28 (headers)
# Se responder, Jumbo Frames está a funcionar

10. Segurança: CHAP e IPSec

# CHAP (Challenge Handshake Authentication Protocol)
# Autentica o Initiator com username/password

# No Target (Windows):
Set-IscsiServerTarget -TargetName "hyper-v-target" `
  -EnableChap $true `
  -ChapUsername "iscsi-user" `
  -ChapSecret "SubstituirPasswordForte16chars"

# No Initiator (Windows):
Connect-IscsiTarget -NodeAddress $target.NodeAddress `
  -TargetPortalName "192.168.10.50" `
  -AuthenticationType CHAP `
  -ChapUsername "iscsi-user" `
  -ChapSecret "SubstituirPasswordForte16chars"

# IPSec (encriptação completa do tráfego)
# Para ambientes onde a rede não é totalmente confiável
# Configurar via GPO ou PowerShell:
Set-NetIPsecRule -Name "iSCSI-IPSec" `
  -Enabled True `
  -InboundSecurity Require `
  -OutboundSecurity Require

11. Cenário Prático PME (Hyper-V sobre iSCSI)

# PME com cluster Hyper-V de 2 nós
# Storage: Synology com iSCSI Target

# Topologia:
# - 2x Hyper-V hosts (hyperv01, hyperv02)
# - 1x NAS Synology (iSCSI Target, 2x 10GbE)
# - 2x switches (redundância)
# - VLAN 100: iSCSI (192.168.100.0/24)
# - VLAN 200: CSV/Cluster (192.168.200.0/24)

# Synology (Target):
# - Criar LUN "CSV-LUN01" (1TB, thin provisioning)
# - Criar Target "hyper-v-csv"
# - Permitir IQN dos 2 hosts
# - CHAP: activado
# - MTU 9000

# Hyper-V hosts (Initiator):
# - NIC1: 192.168.100.10 (iSCSI A)
# - NIC2: 192.168.100.11 (iSCSI B)
# - MPIO activado (Round Robin)
# - MTU 9000 em todas as NICs

# Cluster:
# - LUN montado como CSV (Cluster Shared Volume)
# - VMs guardadas no CSV
# - Live Migration entre hosts sem downtime

# Custo: Synology 920+ (~600€) + 2x 10GbE NICs (~200€)
# vs SAN FC: ~15.000€+

12. Problemas Comuns

Problema Causa Solução
Initiator não consegue ligar Firewall, IQN errado, CHAP incorrecto Verificar porta 3260, IQN, CHAP
Performance baixa MTU não configurado, sem MPIO ativar Jumbo Frames, configurar MPIO
Disco desaparece após reboot Sessão não persistente IsPersistent $true (Windows) ou automatic (Linux)
MPIO não ativa Feature não instalada ou claim errado Install Multipath-IO, mpclaim
LUN cheio Thin provisioning expandiu ou discos virtuais grandes Expandir LUN no Target, verificar snapshots

13. Boas Práticas

  • VLAN dedicada para tráfego iSCSI
  • Jumbo Frames (MTU 9000) em todos os dispositivos do caminho
  • MPIO com 2 caminhos mínimo para redundância
  • CHAP activado para autenticação
  • NICs dedicadas para iSCSI (não partilhar com tráfego de dados)
  • Sessões persistentes — auto-reconnect após reboot
  • Monitoring — alertar se caminho MPIO cai
  • Snapshots regulares no Target para recuperação rápida
  • Thin provisioning para poupar espaço (com monitorização)
  • Não misturar iSCSI com SMB na mesma VLAN

14. Checklist de Implementação

  • ☐ Criar VLAN dedicada para iSCSI
  • ☐ Configurar MTU 9000 em switches, Target e Initiator
  • ☐ Instalar iSCSI Target Server
  • ☐ Criar LUN(s) e Target(s)
  • ☐ Configurar CHAP (username + password forte)
  • ☐ Adicionar IQN dos Initiators ao Target
  • ☐ Instalar MPIO no Initiator
  • ☐ Configurar 2 caminhos (2 NICs, 2 IPs)
  • ☐ Ligar Initiator ao Target
  • ☐ Verificar que disco aparece como local
  • ☐ Inicializar, formatar e montar
  • ☐ Configurar persistência (auto-connect no boot)
  • ☐ Testar failover (desligar um caminho)
  • ☐ Testar reboot (verificar auto-reconnect)
  • ☐ Configurar snapshots no Target
  • ☐ Documentar topologia e IQNs

Artigos Relacionados

Baseado na documentação oficial Microsoft sobre iSCSI Target Server e RFC 3720 (iSCSI). Licença: CC BY-SA 4.0.

← Voltar ao Índice

Este artigo foi útil?

Duarte Spínola

Deixe um Comentário