Debian: standard outgoing IP / route


On a debian squeeze server I got 2 IPs on eth0 (eth0 and eth0:1). When opening TCP connections the server uses the eth0:1 IP by default.
However I want it to use the primary (eth0) IP because I want the other to be used for (listening) daemons only.

    auto eth0
    iface eth0 inet static

    auto eth0:1
    iface eth0:1 inet static

#ip route show dev eth0  proto kernel  scope link  src dev eth0  proto kernel  scope link  src
    default via dev eth0  src
    default via dev eth0

What can I do to make debian use the 92. IP for outgoing connections? The other one should still work of course.

Best Answer

You should almost certainly only have one gateway parameter in your networking config (basically, if you don't know why you need two, you don't). The gateway parameter specifies the default gateway for your machine -- the router that traffic which doesn't have a more-specific route should be sent. On most networks, there's only one router that fits that criteria, even though you may have several other (more specific) routes for other networks.