[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Wie zweite IP-Adresse einrichten?



also sprach Juergen Christoffel <jc.debian14@unser.net> [2014-11-04 00:02 +0100]:
> Aber: was muss ich tun bzw. installieren, um das System mit der zweiten
> Adresse zu versehen? Reicht es, in /etc/network/interfaces einfach noch ein
> virtuelles Interface a la
> 
> iface eth0:0 inet static
>   adress ...
>   broadcast ...
>  netmask ...
>  gateway ...

Hierfür brauchst Du Policy Routing, denn nur damit läßt sich
auswählen, über welchen Router die Pakete das System wieder
verlassen. Dazu sind unten die "ip rule" hooks eingefügt.

Vermutlich gibt es hierfür mittlerweile auch schon bessere Lösungen.
Würde mich freuen, wenn jemand hiervon etwas weiß und uns mitteilt.

auto eth0
iface eth0 inet static
  address 128.66.253.163
  netmask 255.255.255.224
  network 128.66.253.160
  broadcast 128.66.253.191
  gateway 128.66.253.161
  up   ip route add default via $IF_GATEWAY table $IFACE
  up   ip route add $IF_NETWORK/$IF_NETMASK dev $IFACE table $IFACE
  up   ip rule  add to   $IF_NETWORK/$IF_NETMASK lookup $IFACE
  up   ip rule  add from $IF_NETWORK/$IF_NETMASK lookup $IFACE
  ## by the time this gets called, the iface is already gone, so not necessary:
  #down ip route del default via $IF_GATEWAY table $IFACE || :
  down ip rule  del from $IF_NETWORK/$IF_NETMASK lookup $IFACE
  down ip rule  del to   $IF_NETWORK/$IF_NETMASK lookup $IFACE

auto eth1
iface eth1 inet static
  address 128.66.21.162
  netmask 255.255.255.224
  network 128.66.21.160
  broadcast 128.66.21.191
  xgateway 128.66.21.161
  up   ip route add default via $IF_XGATEWAY table $IFACE
  up   ip route add $IF_NETWORK/$IF_NETMASK dev $IFACE table $IFACE
  up   ip rule  add to   $IF_NETWORK/$IF_NETMASK lookup $IFACE
  up   ip rule  add from $IF_NETWORK/$IF_NETMASK lookup $IFACE
  ## by the time this gets called, the iface is already gone, so not necessary:
  #down ip route del default via $IF_XGATEWAY table $IFACE || :
  down ip rule  del from $IF_NETWORK/$IF_NETMASK lookup $IFACE
  down ip rule  del to   $IF_NETWORK/$IF_NETMASK lookup $IFACE

-- 
 .''`.   martin f. krafft <madduck@d.o> @martinkrafft
: :'  :  proud Debian developer
`. `'`   http://people.debian.org/~madduck
  `-  Debian - when you have better things to do than fixing systems
 
* Overfiend came out of the womb complaining.
                                                    -- #debian-devel

Attachment: digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)


Reply to: