[PVE-User] promox 2 2nic, 2 nets, 2 gateway

Giuliano Natali diaolin at diaolin.com
Fri Feb 24 11:26:56 CET 2012


Jose Maria Ramirez wrote:
> auto vmbr1
> iface vmbr1 inet static
>     address  xxx.xxx.xxx.60
>     netmask  255.255.255.0
>     gateway  xxx.xxx.xxx.9
> up route add -net xxx.xxx.xx.0 netmask 255.255.255.0 gw xxx.xxx.xxx.254
> down route del -net xxx.xxx.xxx.0 netmask 255.255.255.0 gw xxx.xxx.xxx.254
>     bridge_ports eth1
>     bridge_stp off
>     bridge_fd 0
>
> And i can see ok, in the proxmox interface.


probably is ok in the proxmox interface but not in the routing...

You add two default gateways in the main routing table and?

This is not correct.
If you want to use multiple gateways you should create multiple tables
in /etc/iproute2/rt_tables and so on.

Writing like you did is possible but does not work



Simple example with multiple gateway
    auto eth0
    iface eth0 inet static
    address 1.1.1.2
    netmask 255.255.255.0
    broadcast 1.1.1.255
    #gateway 1.1.1.1 REMOVED
    network 1.1.1.0

    auto eth1
    iface eth1 inet static
    address 2.2.2.2
    netmask 255.255.255.0
    broadcast 2.2.2.255
    #gateway 2.2.2.1 REMOVED
    network 2.2.2.0

/etc/iproute2/rt_tables 2 routing tables:

    200     hdsl
    201     wifi

Populating routing tables

Routes for our networks:

    ip route add 1.1.1.0/24 dev eth0 src 1.1.1.2 table hdsl
    ip route add default via 1.1.1.1 table hdsl
    ip route add 2.2.2.0/24 dev eth1 src 2.2.2.2 table wifi
    ip route add default via 2.2.2.1 table wifi

Using rules:

    ip rule add from 1.1.1.2 table hdsl
    ip rule add from 2.2.2.2 table wifi

Add loopback:

    ip route add 127.0.0.0/8 dev lo   table hdsl
    ip route add 127.0.0.0/8 dev lo   table wifi

Now we can set the default routing table:

    ip route add default scope global nexthop via 1.1.1.1 dev eth0 weight
1 nexthop via 2.2.2.1 dev eth1 weight 1

With the weight set to 1 we have a balancing system


Sorry, Diaolin






More information about the pve-user mailing list