blog‎ > ‎

ip route add

posted 18 Nov 2012, 22:15 by Kampau Ocu
misalkan kita tidak dapat memping ke subnet tertentu ...
root@XXX:/home/muhammad# ping 10.254.20.1
PING 10.254.20.1 (10.254.20.1) 56(84) bytes of data.
^C
--- 10.254.20.1 ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 5008ms

kita tahu bahwa subnet tersebut terhubung ke kartu kita yang kedua .. yang memiliki alamat network 10.254.40.0/24

root@XXX:/home/muhammad# ip route add 10.254.20.0/24 via 10.254.40.1

perintah diatas artinya, setiap ingin ke 10.254.20.0/24, kita kirimnya ke 10.254.40.1, nanti urusan si 10.254.40.1 yang akan meneruskan paket kita


root@XXX:/home/muhammad# ping 10.254.20.1
PING 10.254.20.1 (10.254.20.1) 56(84) bytes of data.
64 bytes from 10.254.20.1: icmp_seq=1 ttl=64 time=10.0 ms
64 bytes from 10.254.20.1: icmp_seq=2 ttl=64 time=0.229 ms
64 bytes from 10.254.20.1: icmp_seq=3 ttl=64 time=0.229 ms
^C
--- 10.254.20.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.229/3.515/10.088/4.647 ms


biar permanen, pada eth1nya, tambahkan up nya ...

root@XXX:/home/muhammad# vi /etc/network/interfaces
auto eth1
iface eth1 inet static
        address 10.254.40.2
        netmask 255.255.255.0
        broadcast 10.254.40.255
        network 10.254.40.0
        gateway 10.254.40.1
        up ip route add 10.254.20.0/24 via 10.254.40.1




Comments