Forgot your password?
typodupeerror

Comment Routing of IP aliases on RedHat (Score 1) 58

Webdude asked: "I run a server that has many IP aliases and have found a very strange thing: all the aliases receive data but all data is sent out through eth0."

Maybe you use a RedHat distrib, are you?
They are especially designed not to set routing on aliases (don't know for other distribs) :

  1. Linuxconf don't set any routing through alias interfaces.
  2. Unless you removed Linuxconf, aliases scripts are not parsed.
  3. ifup script contains special added code not to set routing through aliases (about as clever as the code which were added to trash the eighth bit on text).

If you consider this as a problem, you can return to a more normal operation by commenting those lines in /sbin/ifup (in RedHat 5.2):

ifconfig ${DEVICE} ${MACADDR:+hw ether $MACADDR} ${IPADDR} \
netmask ${NETMASK} broadcast ${BROADCAST}
# if [ "$ISALIAS" = no ] ; then
route add -net ${NETWORK} netmask ${NETMASK} ${DEVICE}
# else
# route add -host ${IPADDR} ${DEVICE}
# fi
those ones in /etc/sysconfig/network-scripts/ifup-aliases:
#if [ -x /bin/linuxconf ] ; then
# ask linuxconf for lines like:
# add
# del
# reload
# linuxconf --hint ipalias $1 | while read verb arg1 arg2 ; do
# case $verb in
# add)
# /sbin/ifconfig $arg1 $arg2
# /sbin/route add $arg2 $arg1
# ;;
# del)
# # the - 0.0.0.0 tells the kernel to remove the device
# # it is necessary to remove it in order for reload to work.
# /sbin/ifconfig ${arg1}- 0.0.0.0
# ;;
# reload)
# echo $arg1 > /proc/sys/net/core/net_alias_max
# ;;
# esac
# done
#
#else
# we don't have linuxconf to fall back on, so presumably we do
# not have to parse linuxconf ipalias ranges, either.
allow_null_glob_expansion=foo
for alias in /etc/sysconfig/network-scripts/ifcfg-$1:* ; do
/etc/sysconfig/network-scripts/ifup $alias
done
unset allow_null_glob_expansion
#fi
and defining your IP aliases in /etc/sysconfig/network-scripts/ifcfg-eth0:0, ifcfg-eth1:1... just like the other interfaces are defined.

I haven't yet tried in RedHat 6.0, but I think your have to remove [ "$ISALIAS" = no ] && from this line in /sbin/ifup (ifup-aliases is the same):

if [ "$ISALIAS" = no ] && [ -z "`route -n | sed "s/ .*//" | grep ${NETWORK}`" ]; then

Note the way the init scripts rely on config informations that Linuxconf stores nobody knows were... Since I seen that, I removed this thing.
Afterall, if I wanted such crap, I would use Windows or Solaris...

One of the major design choices of Unix was to use simple text files for configuration, and that's a feature I especially care about

Slashdot Top Deals

"Your attitude determines your attitude." -- Zig Ziglar, self-improvement doofus

Working...