This may have been reported elsewhere but I couldn’t find a post here, I was configuring my server with multiple IP addresses that each have their own gateways (multi-homed) its important that connections from any of the IP addresses goes over its own gateway. A long story short I found a problem in /etc/conf.d/net.example In the postup function for adding rules using iproute2. In the for loop that iterates though rules_eth0 there is a line, Code: ip rule add ${x} dev "${IFACE}" this does NOT work the correct line should be Code: ip rule add ${x} No dev eth0. with the dev option the rules do not work even though they show up uing ip rule show’ and look correct. Using wire shark I could see they were going to the ‘main’ default gateway’s MAC address and not the individual gateways they were supposed to. On removing this option and rebooting it works fine. Reproducible: Always Steps to Reproduce: 1. setup server with multiple ip address and gateways 2. copy postup and post down functions from etc/conf.d/net.example 3. populate rules_eth0 4. reboot (or just restart net.eth0, i prefer reboot to make sure the routing tables are cleared and nothing is left over) 5. ping -I ${SRC_IP} www.google.com while runing tshark Actual Results: the packets are sent to the systems default gateway, you can see this by looking at the MAC address in the ethernet headder. Expected Results: it should send it to the default gateway defined for that SRC_IP Changing: ip rule add ${x} dev "${IFACE}" To: ip rule add ${x} makes it work as expected. http://www.policyrouting.org/iproute2.doc.html http://forums.gentoo.org/viewtopic.php?p=5782484
Please post your "emerge --info"
emerge --info Portage 2.1.6.11 (default/linux/amd64/2008.0, gcc-4.1.2, glibc-2.8_p20080602-r1, 2.6.28.9 x86_64) ================================================================= System uname: Linux-2.6.28.9-x86_64-Dual-Core_AMD_Opteron-tm-_Processor_2212-with-glibc2.2.5 Timestamp of tree: Thu, 28 May 2009 13:20:01 +0000 app-shells/bash: 3.2_p39 dev-lang/python: 2.4.4-r13, 2.5.4-r2 dev-python/pycrypto: 2.0.1-r8 sys-apps/baselayout: 1.12.11.1 sys-apps/sandbox: 1.6-r2 sys-devel/autoconf: 2.63 sys-devel/automake: 1.9.6-r2, 1.10.2 sys-devel/binutils: 2.18-r3 sys-devel/gcc-config: 1.4.1 sys-devel/libtool: 1.5.26 virtual/os-headers: 2.6.27-r2 ACCEPT_KEYWORDS="amd64" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=opteron -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/sandbox.d /etc/terminfo /etc/udev/rules.d" CXXFLAGS="-march=opteron -O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch" GENTOO_MIRRORS="http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo/" LANG="en_GB.UTF-8" LC_ALL="en_GB.UTF-8" LDFLAGS="-Wl,-O1" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.uk.gentoo.org/gentoo-portage" USE="acl amd64 berkdb bzip2 cli cracklib crypt cups dri fortran gdbm gpm iconv ipv6 isdnlog midi mmx mudflap multilib ncurses nls nptl nptlonly openmp pam pcre perl pppd python readline reflection session spl sse sse2 ssl sysfs tcpd unicode xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="fbdev glint i810 intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa vga via vmware voodoo" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
same line exists in openrc
http://roy.marples.name/projects/openrc/changeset/454bd460c491fd24ff03f686eb91bee7d37bd80f
http://sources.gentoo.org/baselayout/branches/baselayout-1_12/net-scripts/conf.d/net.example?r1=3152&r2=3153
Still still doesn't seem to pick up rules if you have VLAN subinterfaces in use: rules_eth0_990=( "to 1.2.3.4 iif eth0.920 table other" "from 1.2.3.4 iif eth0.990 table other"FW )