Está en la página 1de 3

VARIAS IPS CON LA MISMA TARJETA DE RED EN UNIX / LINUX

Existen diferencias para agregar más de una tanto en las distintas versiones de Linux, así como Unix.

SLACKWARE 10.2

IP Aliasing como se le conoce nos permite que una tarjeta de red tenga mas de una IP.

Para revisar que distribución estamos manejando con el comando cat revisar el archivo /proc/version:

$ cat /proc/version

Ahora que vemos que si estamos usando slackware para configurar un alias para una interfase necesitamos
asegurarnos que el kernel fue compilado con el soporte para IP alias, para ver que esto fue así necesitamos ver
que tenemos un archivo /proc/net/ip_alias; si no es así necesitamos recompilar nuestro kernel con soporte de
IP aliasing (en muchas distribuciones se encuentra habilitada por defecto pero en las versiones anteriores de
slackware no era el caso).

Una vez hecho lo anterior probablemente podemos en Slackware, usar la utilidad netconfig o bien necesitamos
modificar nuestros archivos de configuración de la tarjeta de red de manera manual.

En Slackware la interfase de red eth0 es habilitada en el script /etc/rc.d/rc.inetd1, aquí colocaremos los
comandos necesarios que habilitan nuestros IPs alias y se inicializaren de manera automática con arranque de
nuestro sistema Linux.

Solo es necesario agregar unas líneas al final del archivo /etc/rc.d/rc.inetd1 o desde /etc/rc.d/rc.local:

#!/bin/bash

#setting up IP alias interfaces


echo "Setting IP Aliases ..."
/sbin/ifconfig eth0:0 xxx.xxx.xxx.xxx
/sbin/ifconfig eth0:1 xxx.xxx.xxx.xxx
/sbin/ifconfig eth0:2 xxx.xxx.xxx.xxx
/sbin/ifconfig eth0:3 xxx.xxx.xxx.xxx
/sbin/ifconfig eth0:4 xxx.xxx.xxx.xxx

#setting up the routes


echo "Setting IP routes ..."
/sbin/route add -host xxx.xxx.xxx.xxx eth0:0
/sbin/route add -host xxx.xxx.xxx.xxx eth0:1
/sbin/route add -host xxx.xxx.xxx.xxx eth0:2
/sbin/route add -host xxx.xxx.xxx.xxx eth0:3
/sbin/route add -host xxx.xxx.xxx.xxx eth0:4

Por ejemplo si agregamos las líneas siguientes:

# IP alias - activando las interfaces "alias":


# IP real de eth0 = 10.100.4.100
#setting up IP alias interfaces
echo "Setting IP Aliases ..."
/sbin/ifconfig eth0:0 10.100.4.101
/sbin/ifconfig eth0:1 10.100.4.102
/sbin/ifconfig eth0:2 10.100.4.103
/sbin/ifconfig eth0:3 10.100.4.104
/sbin/ifconfig eth0:4 10.100.4.105
/sbin/ifconfig eth0:5 10.100.4.106

#setting up the routes


echo "Setting IP alias routes ..."
/sbin/route add -host 10.100.4.101 eth0:0
/sbin/route add -host 10.100.4.102 eth0:1
/sbin/route add -host 10.100.4.103 eth0:2
/sbin/route add -host 10.100.4.104 eth0:3
/sbin/route add -host 10.100.4.105 eth0:4
/sbin/route add -host 10.100.4.106 eth0:5
#

Ahora verificamos que realmente funciono lo anterior mediante reiniciando la configuración de la red, con lo
siguiente:

$ ifconfig eth0 down


$ /etc/rc.d/rc.inet1 restart
O bien reiniciamos la computadora y veremos que los alias son efectivamente reconocidos.

SUSE ENTERPRISE 10.2/NOVELL


En SuSe, hay que modificar el archivo de configuración principal para tu tarjeta ethernet.

Si entramos al directorio /etc/sysconfig/network y vemos que archivos tenemos, entonces encontraremos uno
similar a
'ifcfg-eth-id-00:0e:0c:3c:75:91' en donde 00:0e:0c:3c:75:91 es la dirección MAC de la tarjeta de red.

# cd /etc/sysconfig/network
# ls
config if-down.d ifcfg-eth-id-00:0e:0c:3c:75:91 ifcfg.template ifservices.template routes
scripts
dhcp if-up.d ifcfg-lo ifroute-lo providers
routes.YaST2save

Como ejemplo vamos a tener una dirección IP principal establecida a estática y con IP 10.100.2.1, y otras IPS
con 10.100.2.218, 10.100.2.219, 10.100.2.220 y 10.100.2.221

Tu configuración original probablemente es ésta:

# cat ifcfg-eth-id-00:0e:0c:3c:75:91

BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='201.147.155.194'
MTU=''
NAME='Intel 88E8050 PCI-E ASF Gigabit Ethernet Controller'
NETMASK='255.255.255.0'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
UNIQUE='JNkJ.GrWO6CeXt16'
USERCONTROL='no'
_nm_name='bus-pci-0000:02:00.0'

# vi ifcfg-eth-id-00:0e:0c:3c:75:91

Entonces hay que cambiar a esto:

BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='10.100.2.1'
MTU=''
NAME='Intel 88E8050 PCI-E ASF Gigabit Ethernet Controller'
NETMASK='255.0.0.0'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
UNIQUE='JNkJ.GrWO6CeXt16'
USERCONTROL='no'
_nm_name='bus-pci-0000:02:00.0'
IPADDR1='10.100.2.218'
NETMASK1='255.0.0.0'
LABEL1='0'
IPADDR1='10.100.2.219'
NETMASK1='255.0.0.0'
LABEL1='1'
IPADDR2='10.100.2.220'
NETMASK2='255.0.0.0'
LABEL2='2'
IPADDR3='10.100.2.221'
NETMASK3='255.0.0.0'
LABEL3='3'

Guardamos y reiniciamos la red con

# /etc/init.d/network restart

Entonces veremos que ya se establecieron las nuevas IPs

eth0 set to 10.100.2.1


eth0:0 set to 10.100.2.218
eth0:1 set to 10.100.2.219
eth0:2 set to 10.100.2.220
eth0:3 set to 10.100.2.221

'LABELx' Es la etiqueta alias que veremos en 'eth0:'

Con esto ya tenemos 4 IPs con la misma tarjeta

OPENSOLARIS (SOLARIS 11)


Primero configuramos adecuadamente opensolaris.

CONFIGURAR DIRECCION IP EN SOLARIS 11

Antes de agregar mas de una ip en unix – opensolaris, tenemos que saber que archivos modificar para poder
conectarlo a la red y a Internet.

vi /etc/hosts
127.0.0.1 localhost
192.168.1.50 webcsc loghost

vi /etc/netmasks
192.168.1.50 255.255.255.0

vi /etc/hostname.bge0
webcsc

vi /etc/resolv.conf
nameserver 216.231.41.2

vi /etc/defaultrouter
192.168.1.1

vi /etc/nsswitch.conf
hosts: files dns

AGREGAR MAS IPS

# ifconfig interface:N plumb


# ifconfig interface:N ip_adress up

Ejemplo:
# ifconfig bge0:1 plumb
# ifconfig bge0:1 192.168.1.1 netmask 255.255.255.0 up

Y para habilitarlo desde el arranque del sistema

1. creamos /etc/hostname.bge0:1 y tecleamos un nombre para esta IP

# cat /etc/hostname.bge0:1
host_1
#

2. Agregamos la ip para el anterior nombre en /etc/hosts

192.168.1.1 host_1 # IP alias for bge0 interface

También podría gustarte