Configuracion TCP/IP, DNS, routing, interfaces de red, CFGTCP, NETSTAT, line descriptions, virtual IPs, servicios TCP y packet rules en IBM i.
IBM i soporta TCP/IP de forma nativa desde hace decadas. La pila TCP/IP esta integrada en el sistema operativo y se gestiona con un conjunto de comandos CL dedicados. A diferencia de Linux, donde la configuracion de red se distribuye entre archivos como /etc/network/interfaces, netplan o NetworkManager, en IBM i toda la configuracion de red se centraliza a traves del menu CFGTCP y sus comandos asociados.
Linux / x86
IBM i
El comando CFGTCP abre un menu interactivo que es el punto central para toda la configuracion TCP/IP del sistema. Desde ahi se pueden gestionar interfaces, rutas, DNS, tabla de hosts, atributos TCP/IP y servicios de red.
Opcion 1Work with TCP/IP interfaces — agregar, cambiar, activar/desactivar interfaces
Opcion 2Work with TCP/IP routes — tabla de rutas estaticas y gateway por defecto
Opcion 3Change TCP/IP attributes — hostname, domain, forwarding, keepalive
Opcion 4Work with TCP/IP port restrictions — reservar puertos para usuarios especificos
Opcion 10Work with TCP/IP host table entries — tabla local de hosts (como /etc/hosts)
Opcion 12Change TCP/IP domain — servidor DNS, orden de busqueda, domain name
Opcion 20Configure TCP/IP applications — FTP, Telnet, SMTP, HTTP, etc.
CFGTCP
Menu interactivo de configuracion TCP/IP
CHGTCPA HOSTNAME('IBMPROD') DMNNAME('miempresa.com')
Cambiar hostname y domain name del sistema
CHGTCPA IPDTGFWD(*YES)
Habilitar IP datagram forwarding (routing entre subredes)
CHGTCPA TCPKEEPALV(600)
Keepalive cada 600 segundos para conexiones TCP inactivas
DSPTCPA
Ver todos los atributos TCP/IP actuales
STRTCP
Iniciar stack TCP/IP (normalmente arranca con el IPL)
ENDTCP
Detener stack TCP/IP (corta todas las conexiones de red)La configuracion de red en IBM i tiene dos capas: la line description (capa fisica/enlace) y la interfaz TCP/IP (capa de red). Primero se crea la line description para el adaptador Ethernet, y luego se agrega la interfaz TCP/IP sobre esa linea.
Una line description describe la conexion fisica o virtual con la red. En servidores modernos Power, casi siempre se usa Ethernet. Es equivalente a configurar un adaptador de red en Linux antes de asignarle una IP.
CRTLINETH LIND(ETH01) RSRCNAME(CMN03) LINESPEED(1G) DUPLEX(*FULL) FRAMESIZE(8996) Crear line description Ethernet sobre recurso fisico CMN03 con Jumbo Frames (MTU 8996) CRTLINETH LIND(ETH02) RSRCNAME(CMN04) LINESPEED(10G) DUPLEX(*FULL) VLANID(100) Crear linea Ethernet con VLAN tagging (802.1Q) WRKLIND Trabajar con todas las line descriptions del sistema WRKLIND *ELAN Trabajar solo con line descriptions Ethernet DSPLIND ETH01 Ver detalle de una line description VRYCFG CFGOBJ(ETH01) CFGTYPE(*LIN) STATUS(*ON) Activar la line description (equivalente a "ip link set eth0 up") VRYCFG CFGOBJ(ETH01) CFGTYPE(*LIN) STATUS(*OFF) Desactivar la line description
Una vez creada la line description, se asocia una o mas direcciones IP. IBM i soporta multiples IPs por linea, similar a como Linux soporta alias de interfaces o IPs secundarias.
ADDTCPIFC INTNETADR('10.1.1.50') LIND(ETH01)
SUBNETMASK('255.255.255.0')
Agregar interfaz IP sobre la linea ETH01
ADDTCPIFC INTNETADR('10.1.1.51') LIND(ETH01)
SUBNETMASK('255.255.255.0')
Segunda IP en la misma linea (IP aliasing)
ADDTCPIFC INTNETADR('10.1.1.100') LIND(*VIRTUALIP)
SUBNETMASK('255.255.255.255')
Crear virtual IP (no asociada a hardware, para HA/clustering)
CHGTCPIFC INTNETADR('10.1.1.50') SUBNETMASK('255.255.254.0')
Cambiar mascara de subred de una interfaz existente
STRTCPIFC INTNETADR('10.1.1.50')
Activar la interfaz (equivalente a "ip addr add ... dev eth0")
ENDTCPIFC INTNETADR('10.1.1.50')
Desactivar la interfaz
RMVTCPIFC INTNETADR('10.1.1.51')
Eliminar una interfaz TCP/IPLIND(*VIRTUALIP) no estan asociadas a ningun adaptador fisico. Se usan para alta disponibilidad, clustering y balanceo de carga. Si el adaptador fisico falla, la IP virtual puede moverse a otra linea sin cambiar la configuracion de los clientes.VLANID. Cada VLAN necesita su propia line description y su propia interfaz TCP/IP asociada.IBM i resuelve nombres de host usando dos mecanismos: la tabla de hosts local (equivalente a /etc/hosts) y servidores DNS externos (equivalente a /etc/resolv.conf). El orden de busqueda se configura con el comando CHGTCPDMN.
CHGTCPDMN HOSTNAME('IBMPROD') DMNNAME('miempresa.com')
HOSTSCHPTY(*LOCAL)
INTNETADR('10.1.1.10' '10.1.1.11')
Configurar hostname, dominio, orden de busqueda (*LOCAL primero)
y dos servidores DNS
*LOCAL = Buscar primero en la tabla de hosts local
*REMOTE = Buscar primero en DNS externo
DSPTCPDMN
Ver configuracion actual de DNSADDTCPHTE INTNETADR('10.1.1.50') HOSTNAME(('ibmprod'
'ibmprod.miempresa.com'))
Agregar entrada en la tabla de hosts local
RMVTCPHTE INTNETADR('10.1.1.50')
Eliminar entrada de la tabla de hosts
WRKTCPHTE
Trabajar con la tabla de hosts (ver, agregar, cambiar, borrar)
CFGTCP (opcion 10)
Menu interactivo de host tableIBM i puede actuar como servidor DNS autoritativo para la red interna usando BIND. La configuracion se hace a traves de IBM Navigator for i o editando los archivos de zona directamente en el IFS.
STRTCPSVR *DNS
Iniciar el servidor DNS de IBM i (BIND)
ENDTCPSVR *DNS
Detener el servidor DNS
TNAMESERV HOSTNAME('www.ibm.com')
Resolver nombre usando DNS configurado
Equivalente a "nslookup" o "dig" en Linux
Los archivos de zona se ubican en:
/QIBM/UserData/OS400/DNS//QIBM/UserData/OS400/TCPIP/HOSTS con el mismo formato que /etc/hosts de Linux.IBM i ofrece un comando NETSTAT nativo con opciones especificas para el sistema, ademas de herramientas clasicas como PING y TRACERT. Tambien se pueden consultar las estadisticas de red via SQL para integracion con scripts y monitoreo.
NETSTAT *CNN / WRKTCPSTS *CNNVer conexiones TCP/UDP activas. Muestra IP local/remota, puerto, estado. Equivale a 'ss -tuln' o 'netstat -an' en Linux.
NETSTAT *IFC / WRKTCPSTS *IFCVer estado de interfaces de red (IP, mascara, linea, estado up/down). Equivale a 'ip addr show'.
NETSTAT *RTEVer tabla de rutas. Equivale a 'ip route show' o 'netstat -rn'.
PINGPing ICMP a una IP o hostname. Funciona igual que en Linux.
TRACERTTrazar ruta de paquetes a un destino. Equivale a 'traceroute' en Linux.
VFYTCPCNNVerify TCP/IP Connection. Test completo de conectividad incluyendo resolucion DNS y conexion a puerto.
PING RMTSYS('10.1.1.1')
Ping a una IP remota
PING RMTSYS('servidor.miempresa.com')
Ping usando nombre de host
TRACERT RMTSYS('10.1.1.1')
Traceroute (equivalente a traceroute en Linux)
VFYTCPCNN RMTSYS('10.1.1.50') RMTPORT(22)
LCLIFC(*AUTOSELECT)
Verificar que se puede conectar al puerto 22 de un servidor
NETSTAT *CNN
Menu interactivo de conexiones activas
WRKTCPSTS *CNN
Forma alternativa (identico resultado)
TRCTCPAPP APP(*TELNET) SET(*ON)
Activar tracing de la aplicacion Telnet
CFGTCPTRC
Configurar captura de paquetes a nivel IP (como tcpdump)Linux / x86
IBM i
-- Conexiones TCP activas (equivalente a WRKTCPSTS *CNN)
SELECT LOCAL_ADDRESS, LOCAL_PORT, REMOTE_ADDRESS, REMOTE_PORT,
TCP_STATE, BYTES_SENT, BYTES_RECEIVED, IDLE_TIME
FROM QSYS2.NETSTAT_INFO
WHERE TCP_STATE = 'ESTABLISHED'
ORDER BY BYTES_RECEIVED DESC
FETCH FIRST 20 ROWS ONLY;
-- Puertos en estado LISTEN (servicios activos)
SELECT LOCAL_PORT, LOCAL_ADDRESS, BOUND_USER
FROM QSYS2.NETSTAT_INFO
WHERE TCP_STATE = 'LISTEN'
ORDER BY LOCAL_PORT;
-- Estado de las interfaces de red
SELECT INTERNET_ADDRESS, LINE_DESCRIPTION,
INTERFACE_STATUS, MTU, INTERFACE_TYPE,
PACKETS_SENT, PACKETS_RECEIVED
FROM QSYS2.NETSTAT_INTERFACE_INFO
ORDER BY INTERNET_ADDRESS;
-- Tabla de rutas via SQL
SELECT ROUTE_DESTINATION, SUBNET_MASK, NEXT_HOP,
ROUTE_STATUS, ROUTE_TYPE
FROM QSYS2.NETSTAT_ROUTE_INFO
ORDER BY ROUTE_DESTINATION;TRCTCPAPP que permite capturar trafico de aplicaciones TCP especificas (FTP, Telnet, HTTP), y CFGTCPTRC para captura general de paquetes (similar a tcpdump). Los resultados se imprimen con PRTTRCRPT.La tabla de rutas de IBM i funciona igual que en cualquier sistema TCP/IP. Se pueden definir rutas estaticas y un default gateway. IBM i tambien soporta IP forwarding para actuar como router entre subredes (aunque no es un caso de uso comun).
ADDTCPRTE RTEDEST('0.0.0.0') SUBNETMASK('0.0.0.0')
NEXTHOP('10.1.1.1')
Agregar ruta por defecto (default gateway)
Equivalente a "ip route add default via 10.1.1.1"
ADDTCPRTE RTEDEST('172.16.0.0') SUBNETMASK('255.255.0.0')
NEXTHOP('10.1.1.254')
Ruta estatica hacia la red 172.16.0.0/16
ADDTCPRTE RTEDEST('192.168.100.0') SUBNETMASK('255.255.255.0')
NEXTHOP('10.1.1.253') MTU(1500)
Ruta estatica con MTU especifico
RMVTCPRTE RTEDEST('172.16.0.0') SUBNETMASK('255.255.0.0')
NEXTHOP('10.1.1.254')
Eliminar una ruta estatica
CHGTCPA IPDTGFWD(*YES)
Habilitar IP forwarding (para actuar como router)ip route add se pierden al reiniciar, en IBM i las rutas agregadas con ADDTCPRTE son persistentes y sobreviven un IPL (reinicio del sistema). No hay necesidad de archivos de configuracion adicionales.IBM i incluye multiples servidores TCP integrados que se gestionan con un par de comandos universales: STRTCPSVR para iniciar y ENDTCPSVR para detener. Cada servidor tiene tambien su propio comando de configuracion.
*SSHDPuerto 22Servidor SSH (OpenSSH portado). Permite acceso remoto seguro, SFTP y tuneles SSH.
*TELNETPuerto 23/992Servidor Telnet 5250 (TN5250). Es la forma clasica de conectar emuladores de terminal al sistema.
*FTPPuerto 21Servidor FTP nativo. Permite transferencia de archivos, incluyendo save files y miembros de archivos fisicos.
*HTTPPuerto 80/443Servidor HTTP Apache (powered by IBM HTTP Server). Sirve aplicaciones web, servicios REST y IBM Navigator.
*SMTPPuerto 25Servidor SMTP para envio y recepcion de correo electronico.
*DIRSRVPuerto 389/636Servidor LDAP (Directory Server). Para autenticacion centralizada y directorio de usuarios.
*RMTCMDPuerto N/ARemote Command Server. Permite ejecutar comandos CL desde otro sistema IBM i.
STRTCPSVR *SSHD Iniciar servidor SSH STRTCPSVR *HTTP HTTPSVR(ADMIN) Iniciar instancia HTTP especifica (para Navigator) STRTCPSVR *ALL Iniciar todos los servidores TCP configurados para autostart ENDTCPSVR *FTP Detener servidor FTP ENDTCPSVR *ALL Detener todos los servidores TCP CHGTELNA AUTOSTART(*YES) Configurar Telnet para inicio automatico en IPL CHGSSHD AUTOSTART(*YES) Configurar SSH para inicio automatico
Archivos de configuracion SSH: /QOpenSys/QIBM/ProdData/SC1/OpenSSH/etc/sshd_config Comandos CL: STRTCPSVR *SSHD Iniciar servidor SSH ENDTCPSVR *SSHD Detener servidor SSH Desde QSH o PASE shell: ssh usuario@servidor Conectar a otro sistema sftp usuario@servidor Transferir archivos via SFTP scp archivo user@host:/ruta Copiar archivos via SCP Claves publicas: /home/USUARIO/.ssh/authorized_keys
IBM i incluye un sistema de filtrado de paquetes IP integrado, similar en concepto a iptables/nftables en Linux. Las reglas de filtrado se definen en archivos de reglas y se activan con comandos CL. Permiten controlar el trafico de entrada y salida por IP, puerto, protocolo y direccion.
Linux / x86
IBM i
RMVTCPTBL *ALL
Eliminar todas las reglas activas (dejar el firewall abierto)
ACTTCPRULES FILE('/QIBM/UserData/OS400/TCPIP/PacketRules/myrules.i3')
Activar un archivo de reglas de filtrado
CHKPKTFTR FILE('/QIBM/UserData/OS400/TCPIP/PacketRules/myrules.i3')
Verificar la sintaxis de un archivo de reglas antes de activar
DSPACTPRF
Ver reglas de filtrado actualmente activas# Permitir SSH (puerto 22) desde la red interna FILTER SET AllowSSH ACTION(PERMIT) DIRECTION(INBOUND) SRCADDR(RANGE(10.1.1.0 10.1.1.255)) DSTPORT(EQUAL(22)) PROTOCOL(TCP) JRN(OFF) ; # Permitir HTTPS (puerto 443) desde cualquier origen FILTER SET AllowHTTPS ACTION(PERMIT) DIRECTION(INBOUND) SRCADDR(ALL) DSTPORT(EQUAL(443)) PROTOCOL(TCP) JRN(OFF) ; # Bloquear Telnet (puerto 23) desde redes externas FILTER SET BlockTelnet ACTION(DENY) DIRECTION(INBOUND) SRCADDR(ALL) DSTPORT(EQUAL(23)) PROTOCOL(TCP) JRN(ON) ; # Regla final: denegar todo lo demas FILTER SET DenyAll ACTION(DENY) DIRECTION(INBOUND) SRCADDR(ALL) JRN(ON) ;
CHKPKTFTR antes de activar, y ten acceso a la consola fisica o HMC como plan de contingencia. Usa JRN(ON) para journalear paquetes denegados y poder diagnosticar problemas.IBM i soporta VPN IPSec de forma nativa, permitiendo establecer tuneles seguros entre el servidor IBM i y otros sistemas (otros IBM i, firewalls, routers o servidores Linux/Windows). La configuracion se realiza a traves de IBM Navigator for i o mediante comandos CL.
IKE (Key Exchange)
Internet Key Exchange para negociacion de claves. Soporta IKEv1 e IKEv2. Se configura con politicas de intercambio de claves.
IPSec Policies
Politicas de datos que definen algoritmos de cifrado (AES, 3DES), autenticacion (SHA, MD5) y protocolos (ESP, AH).
VPN Connections
Definicion de conexiones punto a punto, incluyendo endpoints locales y remotos, y subredes protegidas.
Connection Profiles
Perfiles que agrupan la configuracion IKE + IPSec + Connection para facilitar el inicio y gestion.
STRTCPSVR *VPN Iniciar el servidor VPN (Virtual Private Network) ENDTCPSVR *VPN Detener el servidor VPN STRVPNCNN VPNID(1) Iniciar una conexion VPN especifica por ID ENDVPNCNN VPNID(1) Detener una conexion VPN especifica WRKVPNCNN Trabajar con todas las conexiones VPN (ver estado, iniciar, detener) La configuracion detallada de VPN se realiza mejor desde: IBM Navigator for i > Network > IP Policies > VPN
| Comando IBM i | Equivalente Linux | Funcion |
|---|---|---|
| CFGTCP | nmtui / nmcli | Menu central de configuracion TCP/IP |
| ADDTCPIFC | ip addr add | Agregar interfaz TCP/IP |
| STRTCPIFC / ENDTCPIFC | ip link set up/down | Activar/desactivar interfaz |
| CRTLINETH | ethtool + ip link | Crear line description Ethernet |
| WRKTCPSTS *CNN | ss -tuln / netstat -an | Ver conexiones activas |
| WRKTCPSTS *IFC | ip addr show | Ver estado de interfaces |
| PING | ping | Test de conectividad ICMP |
| TRACERT | traceroute | Trazar ruta de paquetes |
| TNAMESERV | nslookup / dig | Resolver nombre DNS |
| ADDTCPRTE | ip route add | Agregar ruta estatica |
| CHGTCPDMN | /etc/resolv.conf | Configurar servidores DNS |
| STRTCPSVR *SSHD | systemctl start sshd | Iniciar servidor SSH |
| STRTCPSVR *HTTP | systemctl start apache2 | Iniciar servidor HTTP |
| TRCTCPAPP | tcpdump (a nivel app) | Tracing de aplicaciones TCP |
| ACTTCPRULES | iptables-restore | Activar reglas de filtrado |
| STRTCPSVR *VPN | ipsec start | Iniciar servidor VPN IPSec |
-- Resumen rapido de interfaces activas
SELECT INTERNET_ADDRESS, LINE_DESCRIPTION, INTERFACE_STATUS
FROM QSYS2.NETSTAT_INTERFACE_INFO
WHERE INTERFACE_STATUS = 'ACTIVE';
-- Top 10 conexiones por trafico
SELECT REMOTE_ADDRESS, REMOTE_PORT, LOCAL_PORT,
BYTES_RECEIVED, BYTES_SENT, TCP_STATE
FROM QSYS2.NETSTAT_INFO
WHERE TCP_STATE = 'ESTABLISHED'
ORDER BY BYTES_RECEIVED + BYTES_SENT DESC
FETCH FIRST 10 ROWS ONLY;
-- Servicios escuchando en puertos
SELECT LOCAL_PORT, BOUND_USER
FROM QSYS2.NETSTAT_INFO
WHERE TCP_STATE = 'LISTEN'
ORDER BY LOCAL_PORT;