Saturday, December 22, 2012

Dual Gateway Linux

root@local-deb# /etc/network/interfaces

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.254
    post-up route add default gw 192.168.1.1 metric 1
    pre-down route del default gw 192.168.1.1

auto eth1
iface eth1 inet static
    address 192.168.2.10
    netmask 255.255.255.0
    network 192.168.2.0
    broadcast 192.168.2.254
    post-up route add default gw 192.168.2.1 metric 2
    pre-down route del default gw 192.168.2.1


Cek Routing Table

root@localdeb:/etc/network# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    1      0        0 eth0
0.0.0.0         192.168.2.1     0.0.0.0         UG    2      0        0 eth1

No comments:

Post a Comment