I want to use 10.1.16.189 as gateway to access 9.36.204.4 both on redhat 6.4. here is the network configuration of my machine:
eth0 Link encap:Ethernet HWaddr 06:FB:C1:7B:19:FD
inet addr:10.62.56.130 Bcast:10.62.56.255 Mask:255.255.255.128
inet6 addr: fe80::4fb:c1ff:fe7b:19fd/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:435639 errors:0 dropped:0 overruns:0 frame:0
TX packets:13729 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:46426471 (44.2 MiB) TX bytes:1502807 (1.4 MiB)
Interrupt:32
The network configuration of the machine I want to use as gateway:
eth0 Link encap:Ethernet HWaddr 52:54:00:EA:31:A2
inet addr:9.42.27.23 Bcast:9.42.27.255 Mask:255.255.252.0
inet6 addr: 2002:92a:111:430:5054:ff:feea:31a2/64 Scope:Global
inet6 addr: fe80::5054:ff:feea:31a2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:53655370 errors:0 dropped:0 overruns:0 frame:0
TX packets:21812264 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:30987415175 (28.8 GiB) TX bytes:27696977107 (25.7 GiB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.1.16.44 P-t-P:1.1.1.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1450 Metric:1
RX packets:480532 errors:0 dropped:0 overruns:0 frame:0
TX packets:887766 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:70276913 (67.0 MiB) TX bytes:1234059626 (1.1 GiB)
And here are my operations
route add -host 10.1.16.189 dev eth0 gw 10.62.56.129
add the way to access host 9.36.204.4 through 10.1.16.189
route add -host 9.36.204.4 gw 10.1.16.189
SIOCADDRT: Network is unreachable
But I'm able to ping and traceroute 10.1.16.189.
ping 10.1.16.189
PING 10.1.16.189 (10.1.16.189) 56(84) bytes of data.
64 bytes from 10.1.16.189: icmp_seq=1 ttl=54 time=76.2 ms
64 bytes from 10.1.16.189: icmp_seq=2 ttl=54 time=75.4 ms
64 bytes from 10.1.16.189: icmp_seq=3 ttl=54 time=75.5 ms
So I want to know why it reported the network is unreachable but I can ping and access it, I even can ssh it. And how to configure it to access 9.36.204.4(which can be reached in 10.1.16.189). And how to determine a gateway is reachable. thanks.