assigning alias ip address

Jose Maria Lopez jkerouac at bgsec.com
Fri Sep 10 18:37:55 CEST 2004


El vie, 10 de 09 de 2004 a las 05:10, John Black escribió:
> How does assigning alias IP address work?
> 
> I have one network jack coming into my server room. 
> eth0  10.10.10.10
> 
> I have two servers with public IP address.
> this assigns them, right?
> ifconfig eth0:10 192.168.1.10 netmask 255.255.255.0
> ifconfig eth0:11 192.168.2.11 netmask 255.255.255.0
> 
> iptables -t nat -A PREROUTING -d 192.168.1.10 -i eth0 \
>                 -j DNAT --to-destination 10.10.10.11
> iptables -t nat -A PREROUTING -d 192.168.2.11 -i eth0 \
>                 -j DNAT --to-destination 10.10.10.12
> 
> When a mail or web request is made from the internet.  
> How does it know where the servers are?
> 
> thanks
> John

The new kernel networking code named iproute2 doesn't make
any differences between IPs assigned to an interfaces or
aliased IPs. You can assign any number of IPs to an interface,
and this can be primary IPs or secundary IPs, but for the
kernel it's just another IP assigned to the machine (really
it's more complex, the IPs are assigned to services, not any
hardware in particular).

So when a request is made from the internet the routing code
just looks in it's tables what routes it have to use, and
as the IPs are assigned to the same machine it sends the
request to the machine you have assigned the IPs.

-- 
Jose Maria Lopez Hernandez
Director Tecnico de bgSEC
jkerouac at bgsec.com
bgSEC Seguridad y Consultoria de Sistemas Informaticos
http://www.bgsec.com
ESPAÑA

The only people for me are the mad ones -- the ones who are mad to live,
mad to talk, mad to be saved, desirous of everything at the same time,
the ones who never yawn or say a commonplace thing, but burn, burn, burn
like fabulous yellow Roman candles.
                -- Jack Kerouac, "On the Road"




More information about the netfilter mailing list