title: Bind outgoing traffic to eth0 instead of eth0:1
body: <p>We added a second IP-Adress to a linux (debian) machine to implement a second SSL-certificate to a new Apache vhost.</p>
  
  <p>Our <code>ifconfig</code> now looks like this:</p>
  
  <pre><code>eth0      Link encap:Ethernet  Hardware Adresse 00:0c:29:1b:ab:6c
            inet Adresse:999.999.999.39  Bcast:999.999.999.63  Maske:255.255.255.192
            inet6-Adresse: (...)/64 Gültigkeitsbereich:Verbindung
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
            RX packets:219336884 errors:0 dropped:0 overruns:0 frame:0
            TX packets:223169420 errors:0 dropped:0 overruns:0 carrier:0
            Kollisionen:0 Sendewarteschlangenlänge:1000
            RX bytes:1971307659 (1.8 GiB)  TX bytes:713489565 (680.4 MiB)
  
  eth0:1    Link encap:Ethernet  Hardware Adresse (...)
            inet Adresse:999.999.999.40  Bcast:999.999.999.63  Maske:255.255.255.192
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
  </code></pre>
  
  <p>Problem: All outgoing traffic (MySQL connections to external DB-server, outgoing SMTP connections from postfix) now seems to leave through eth0:1, hence the second (new) IP 999.999.999.40. </p>
  
  <p>How can we force all outgoing traffic to leave through eth0, IP-adress 999.999.999.39?</p>
  
  <p>Output of route:</p>
  
  <pre><code>[n1 ~ #] route
  Kernel-IP-Routentabelle
  Ziel            Router          Genmask         Flags Metric Ref    Use Iface
  localnet        *               255.255.255.192 U     0      0        0 eth0
  10.10.10.0      *               255.255.255.0   U     0      0        0 eth1
  default         gateway4.XXX    0.0.0.0         UG    0      0        0 eth0
  default         gateway4.XXX    0.0.0.0         UG    0      0        0 eth0
  </code></pre>
  
  <p><strong>Found solution:</strong></p>
  
  <p>Thanks for your hints, <code>ip route</code> was the way to go, now it works as desired.</p>
  
  <pre><code>ip rule add from 999.999.999.39 table t1
  ip rule add from 999.999.999.40 table t2
  ip route del default via 999.999.999.1
  ip route add default 999.999.999.1 dev eth0 table t1
  ip route flush cache
  </code></pre>