IP Alias

IP Alias

Post by Roland Toucha » Thu, 13 Jan 2000 04:00:00



I have a small Problem with the IP address used
in ougoing packets when using IP alias.

My Linux host have redhat 6.1 and kernel 2.2.12
compiled with IP alias support.

In dir /usr/sysconfig/network-scripts i have copied
the file ifcfg-eth0  as ifcfg-eth0:1 and i just change
IPADDR with a secund IP number in the same network.

After reboot I can ping the two IP.
"ifconfig -a" show :

eth0      Link encap:Ethernet  HWaddr 00:90:27:62:B9:08  
          inet addr:129.175.34.254  Bcast:129.175.34.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2617 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          Interrupt:10 Base address:0x1400

eth0:1    Link encap:Ethernet  HWaddr 00:90:27:62:B9:08  
          inet addr:129.175.34.34  Bcast:129.175.34.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:10 Base address:0x1400

BUT THE PROBLEM :

all outgoing IP packets (originated from clients programs
on this host as telnet or rsh) come from the Alias's IP
(129.175.34.34) ;

For me the good thing should be that packets come from the
Device's IP (129.175.34.254)

How can i choose the out-going IP number ?

In the file /etc/sysconfig/network :
NETWORKING=yes
FORWARD_IPV4=false
HOSTNAME=upsn254.cri.u-psud.fr
GATEWAY=129.175.34.1

In the file /etc/hosts :
127.0.0.1               localhost.localdomain localhost
129.175.34.254          upsn254.cri.u-psud.fr

In file /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=129.175.34.255
IPADDR=129.175.34.254
NETMASK=255.255.255.0
NETWORK=129.175.34.0
ONBOOT=yes

In file /etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE=eth0:1
BOOTPROTO=static
BROADCAST=129.175.34.255
IPADDR=129.175.34.34
NETMASK=255.255.255.0
NETWORK=129.175.34.0
ONBOOT=yes

(all IP are registered in my loocal DNS)

I have found no answers in HOWTO, FAQ, network-scripts comments...

Thank you for all your help
and excuse me for my very bad english.

    Roland Touchais

 
 
 

IP Alias

Post by Phil DeBecke » Thu, 13 Jan 2000 04:00:00



> I have a small Problem with the IP address used
> in ougoing packets when using IP alias.

> My Linux host have redhat 6.1 and kernel 2.2.12
> compiled with IP alias support.

> In dir /usr/sysconfig/network-scripts i have copied
> the file ifcfg-eth0  as ifcfg-eth0:1 and i just change
> IPADDR with a secund IP number in the same network.

> After reboot I can ping the two IP.
> "ifconfig -a" show :

> eth0      Link encap:Ethernet  HWaddr 00:90:27:62:B9:08
>           inet addr:129.175.34.254  Bcast:129.175.34.255  Mask:255.255.255.0
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:2617 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:100
>           Interrupt:10 Base address:0x1400

> eth0:1    Link encap:Ethernet  HWaddr 00:90:27:62:B9:08
>           inet addr:129.175.34.34  Bcast:129.175.34.255  Mask:255.255.255.0
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           Interrupt:10 Base address:0x1400

> BUT THE PROBLEM :

> all outgoing IP packets (originated from clients programs
> on this host as telnet or rsh) come from the Alias's IP
> (129.175.34.34) ;

> For me the good thing should be that packets come from the
> Device's IP (129.175.34.254)

> How can i choose the out-going IP number ?

I suspect this is due to a routing issue, since the ifcfg scripts establish
routes as well as configuring the interface.  Most likely the route to the
129.175.34.0 network is through eth0:1.  What you probably want to do to fix
this is issue the commands:

route del -net 129.175.34.0 netmask 255.255.255.0
route add -net 129.175.34.0 netmask 255.255.255.0 dev eth0

That should force all packets to the 129.175.34.0 network to go out throuth the
eth0 interface.

HTH
Phil