i have a simple question here
I'm kind of newbie on solaris development
currently i'm trying to add static route to solaris environment
and i got error, each time i add this static route to it
btw this is my command :
root@xxxxxx # ping 1.2.3.1
1.2.3.1 is alive
echo "1.2.3.0 255.255.255.0" >> /etc/netmasks
root@xxxxxx # route add net 1.2.3.0 1.2.3.1
add net 1.2.3.0: gateway 1.2.3.1: Network is unreachable
root@xxxxxx # netstat -rn
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
if this is your default route, use route add default <route_IP> and also include the entry<route_IP> in the /etc/defaultrouter file
if your defaultgateway is already present and you want to add a static route, use this:-
EG
can you check the netmask file? should have a tab in between the 2 entries and not space.
btw, you mentioned that your default route is there?? but how come the netstat -rn returns nothing? should not be the case.
its still on the same result
i put all output here
bash-3.00# netstat -rn
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------
192.168.252.0 192.168.252.155 U 1 0 e1000g0
224.0.0.0 192.168.252.155 U 1 0 e1000g0
127.0.0.1 127.0.0.1 UH 4 81 lo0
bash-3.00# more /etc/netmasks
#
# The netmasks file associates Internet Protocol (IP) address
# masks with IP network numbers.
#
# network-number netmask
#
# The term network-number refers to a number obtained from the Internet Network
# Information Center.
#
# Both the network-number and the netmasks are specified in
# "decimal dot" notation, e.g:
#
# 128.32.0.0 255.255.255.0
#
192.168.252.0 255.255.255.0
172.168.192.0 255.255.255.0
bash-3.00# route add -net 172.168.192.0 255.255.255.0 172.168.192.1 2
add net 172.168.192.0: gateway 255.255.255.0: Network is unreachable
bash-3.00#
root@xxxx # less /etc/netmasks
#
# The netmasks file associates Internet Protocol (IP) address
# masks with IP network numbers.
#
# network-number netmask
#
# The term network-number refers to a number obtained from the Internet Network
# Information Center.
#
# Both the network-number and the netmasks are specified in
# "decimal dot" notation, e.g:
#
# 128.32.0.0 255.255.255.0
#
1.4.125.0 255.255.255.0
2.15.246.0 255.255.255.0
root@xxxx # less /etc/defaultrouter
1.4.125.1
root@xxxx # netstat -nr
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ---------- ---------
default 1.4.125.1 UG 1 227
1.4.125.0 1.4.125.123 U 1 505 ce0
224.0.0.0 1.4.125.123 U 1 0 ce0
127.0.0.1 127.0.0.1 UH 36 74784 lo0
root@xxxx # ping 2.15.246.253
no answer from 2.15.246.253
root@xxxx # ping 2.15.246.1
2.15.246.1 is alive
root@xxxx # traceroute 2.15.246.1
traceroute to 2.15.246.1 (2.15.246.1), 30 hops max, 40 byte packets
1 1.4.125.3 (1.4.125.3) 0.317 ms 0.252 ms 0.233 ms
2 1.4.113.75 (1.4.113.75) 0.552 ms 0.431 ms 0.421 ms
3 1.4.113.21 (1.4.113.21) 0.471 ms 0.477 ms 0.509 ms
4 1.4.113.142 (1.4.113.142) 3.176 ms 3.174 ms 3.120 ms
5 1.1.126.121 (1.1.126.121) 3.392 ms 3.227 ms 3.321 ms
6 1.1.126.50 (1.1.126.50) 3.303 ms 3.367 ms 3.306 ms
7 2.15.246.1 (2.15.246.1) 3.359 ms 3.481 ms 3.373 ms
root@xxxx # traceroute 2.15.246.253
traceroute to 2.15.246.253 (2.15.246.253), 30 hops max, 40 byte packets
1 1.4.125.3 (1.4.125.3) 0.352 ms 0.228 ms 0.246 ms
2 1.4.113.75 (1.4.113.75) 0.526 ms 0.439 ms 0.450 ms
3 1.4.113.13 (1.4.113.13) 0.545 ms 0.482 ms 0.466 ms
4 1.4.113.138 (1.4.113.138) 3.326 ms 3.153 ms 3.128 ms
5 1.2.201.138 (1.2.201.138) 3.293 ms 3.302 ms 3.304 ms
6 1.1.126.50 (1.1.126.50) 3.282 ms 3.363 ms 3.232 ms
7 1.6.4.7 (1.6.4.7) 3.429 ms 3.377 ms 3.384 ms
8 * * *
9 *^C
root@xxxx # route add -net 2.15.246.0 255.255.255.0 2.15.246.1 2
add net 2.15.246.0: gateway 255.255.255.0: Network is unreachable
You are giving it a route to the 2.15.246.0 network via the gateway 2.15.246.1.
But if it already knows how to get the 2.15.246.1 then it already knows how to get to the whole net (if your subnet is 255.255.255.0) so it wont allow the route.
Also I believe, your gateway needs to be on a network that is already specifically listed in the routing table, NOT just available from the default route (otherwise it assumes the default router can handle it, because thats its job)
It seems that the router 1.1.126.50 has a different subnetmask for the 2.15.246.x network as its routing .1 correctly but not .253 - Im pretty sure you cant override this route using the local routing table.
Also you cannot always use "ping" to test routes. "ping" uses "icmp" NOT "ip" and therefore is not constrained to the same routing protocols (icmp can be redirected amoungst other things).