Am Dienstag, 29. Mai 2007 10:47:23 schrieb Andrew Beverley: > I'm trying to add a second IP address to the eth0 interface. Having done > a lot of searching, it seems that the traditional method is to add > another interface called eth0:0 with the second ip address. This works > fine as a one-off, but if I try to make it permanent by adding > a /etc/sysconfig/network-devices/ifconfig.eth0:0 directory then it > doesn't come up on boot. > > The only reference I can find in LFS documentation is in the Changelog > for LFS-BOOK-6.1-pre2 which states "January 5, 2005 [jeremy]: Minor > textual correction in network configuration, since iproute will not > recognize the old eth0:1 format for ip aliasing. Closes bug 1013." > > So, can anyone tell me the 'new' method? > > Thanks, > > Andy Beverley
Hi Andy, don't know the new method, but i need this too. So i made a hack to services/ipv4-static and put a file for every eth0:n named alias-n into ifconfig.eth0. ipv4-static.diff: --- services/ipv4-static.orig 2007-06-01 12:05:46.000000000 +0200 +++ services/ipv4-static 2007-06-01 12:06:57.000000000 +0200 @@ -39,6 +39,12 @@ args="${args} ${IP} peer ${PEER}" fi +# IP-Aliasing +if [ -n "${ALIAS}" ]; then + args="${args} label ${1}:1" +fi +# ----------- + if [ -n "${BROADCAST}" ]; then args="${args} broadcast ${BROADCAST}" fi @@ -58,6 +64,10 @@ ip route add default via ${GATEWAY} dev ${1} evaluate_retval fi + elif [ -n "${ALIAS_GW}" ]; then + boot_mesg "Setting up second gateway..." + ip route append ${NET_GW}/${PREFIX} via ${ALIAS_GW} + evaluate_retval fi ;; And the example alias-1: ONBOOT=yes SERVICE=ipv4-static IP=192.168.1.61 ALIAS=1 NET_GW=192.168.10.0 ALIAS_GW=192.168.1.12 PREFIX=24 BROADCAST=192.168.1.255 The ALIAS=n is for backward compatibility with ifconfig. To have eth0:n greetings rabenkind :)) -- Duisburger Linux User Group Free Software Foundation Europe /"\ ASCII Ribbon Campaign \ / No HTML/RTF in email x No Word docs in email / \ Respect for open standards
pgpXJMMTt8JzG.pgp
Description: PGP signature
-- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page