Operating System - HP-UX
1825775 Members
2287 Online
109687 Solutions
New Discussion

netconf route_destination

 
SOLVED
Go to solution
Patrick Farho
Occasional Advisor

netconf route_destination

I was wondering how you determine what the route_destination will be if you have multiple IP addresses with different route_gateway addresses.

I understand the [n] information, but I just do not know what to put in the route_destination. Any insight would be helpful.

Thank you,
10 REPLIES 10
RAC_1
Honored Contributor

Re: netconf route_destination

Route destination is what use when you do route command. Like route add host/network.

Also /etc/rc.config.d/netconf gives explaination about it. so if you are going to define a route to a host it will look like follows.

ROUTE_DESTINATION[x]="host_ip_address"
ROUTE_MASK[x]=""
ROUTE_GATEWAY[x]="aa.bb.dd.ffy"
ROUTE_COUNT[x]="1" -- > one if remote, else 0
ROUTE_ARGS[x]=""

If it is going to be network, then put network address in route_destination.
There is no substitute to HARDWORK
John Dvorchak
Honored Contributor

Re: netconf route_destination

Here is part of my /etc/rc.config.d/netconf file on a system that has 3 NICs installed:

ROUTE_DESTINATION[0]="default"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]="123.123.123.3"
ROUTE_COUNT[0]="1"
ROUTE_ARGS[0]=""

ROUTE_DESTINATION[1]="net 172.123.123.0"
ROUTE_MASK[1]=""
ROUTE_GATEWAY[1]="172.123.123.4"
ROUTE_COUNT[1]="0"
ROUTE_ARGS[1]=""

ROUTE_DESTINATION[2]="net 172.223.223.0"
ROUTE_MASK[2]=""
ROUTE_GATEWAY[2]="172.223.223.4"
ROUTE_COUNT[2]="0"
ROUTE_ARGS[2]=""

Of course these addresses are bogus but I think you will see that for every NIC [0] there is a ROUTE_DESTINATION[0] (network address) and a ROUTE_GATEWAY[0] (default router) associated with each instance of the NIC [0] or [1] etc.
If it has wheels or a skirt, you can't afford it.
Patrick Farho
Occasional Advisor

Re: netconf route_destination

So if my router address is a 151.123.12.123 I should be entering something like "net 151.123.12.0"?
John Dvorchak
Honored Contributor

Re: netconf route_destination

correct if your netmask is a class C network like 255.255.255.0 then the network would be the octet 123.123.123.0 because the network is always the first number of the address, in this case a 0 is used. Then the first host on that network would be 1 then 2 etc. like 123.123.123.1 and 123.123.123.2 etc.



If it has wheels or a skirt, you can't afford it.
Patrick Farho
Occasional Advisor

Re: netconf route_destination

What if the netmask is a 255.255.255.192 that has an ip of 151.123.12.123 or 255.255.254.0 that has an ip of 10.1.12.1?

Would the .192 still be 151.123.12.0 and the .254 be 10.1.0.0?

Thank you,

Patrick
John Dvorchak
Honored Contributor

Re: netconf route_destination

If you have a bunch of these NOT Class A B or C netmasks and you want to be sure, try using a "netmask calculator" like the one I found here:

http://jodies.de/ipcalc


Address: 151.123.12.123 10010111.01111011.00001100.01 111011Netmask: 255.255.255.192 = 26 11111111.11111111.11111111.11 000000Wildcard: 0.0.0.63 00000000.00000000.00000000.00 111111=>
Network: 151.123.12.64/26 10010111.01111011.00001100.01 000000 (Class B)Broadcast: 151.123.12.127 10010111.01111011.00001100.01 111111HostMin: 151.123.12.65 10010111.01111011.00001100.01 000001HostMax: 151.123.12.126 10010111.01111011.00001100.01 111110Hosts/Net: 62
If it has wheels or a skirt, you can't afford it.
John Dvorchak
Honored Contributor
Solution

Re: netconf route_destination

That was pretty ugly looking so here it is a little more readable with your example:

http://jodies.de/ipcalc

Network: 151.123.12.64
Broadcast: 151.123.12.127
HostMin: 151.123.12.65
HostMax: 151.123.12.126
If it has wheels or a skirt, you can't afford it.
John Dvorchak
Honored Contributor

Re: netconf route_destination

I have never seen a 255.255.254.0 netmask but I guess some network guy could think of a reason to use it.

But it does look like this:
Network: 10.1.12.0
Broadcast: 10.1.13.255
HostMin: 10.1.12.1
HostMax: 10.1.13.254
If it has wheels or a skirt, you can't afford it.
Patrick Farho
Occasional Advisor

Re: netconf route_destination

So, I should not have to make the 10.1.12.12 10.1.0.0 for the ROUTE_DESTINATION.

This sounds like fun, but I think my daughter would have more fun at an amusement park!
Bob_Vance
Esteemed Contributor

Re: netconf route_destination

>So, I should not have to make the 10.1.12.12
>10.1.0.0 for the ROUTE_DESTINATION.

That is correct!
10.1.0.0 is *not* the network for IP address 10.1.12.12 if the subnet mask is 255.255.254.0 !

As John mentioned, the network component of IP address 10.1.12.12 with a subnet mask of 255.255.254.0 is

10.1.12.0

To see why, a little tutorial:

The subnet mask, in the last non-zero octet, will always be 256 minus a power of 2. That's because subnet masks consist of consecutive 1's, starting from the left. We are normally used to the last subnet mask non-zero octet being 255, but that just represents all 8 bits of that last octet. As we shift left one bit at a time, we are decrementing by a power of 2.

So, if we shift left 0 bits (i.e., still using all 8 bits) then we have:
256-2^0 = 256-1 = the familiar 255

If we only use 7 bits in the last octet, then we have shifted left 1 bit and we have:
256-2^1 = 256-2 = 254.

for 6 bits, we have
256-2^2 = 256-4 = 252.

etc.

When we are *given* the mask (instead of having to figure it out), then we must work backwards from the above.

So, in your case, you had 254.
256-254 = 2 = 2^1 means one bit to the left.

This means that 254 represents that the mask is the first seven bits (in the relevant octet). The 8th and last bit is not part of the subnet mask and therefore is part of the host component of the address.

Now, in your case (mask=255.255.254.0), the 3rd octet is the relevant one (last non-zero octet of the mask).

The 3rd octet of the IP address is 12.

In binary, this is 0000 1100. As we determined above, for the 254 mask, the last bit would have been part of the host component. However, it is zero, so *all* of the 12 is part of the network, thus leading us to

network = 10.1.12.0
hostpart = 0.0.0.12

If the IP address had been 10.1.13.12, then the subnet would *still* have been 10.1.12.0, and the host component would have been 0.0.1.12 .


Note that when working from left to right, instead of right to left, we could say
"the last octet will be a sum of powers of 2 starting with 2^7 = 128.
"

So, one bit in the mask would be 128
2 bits would be 128+64 = 192
3 = 128+64+32 = 224
yada yada yada

Just for grins, note that 256-192=64=2^6.
Thus, we can say we have 2 bits left-to-right.
*Or* we can say we shifted left 6 bits, leaving 2 bits.
and we are consistent, either way.


BTW, network guys generally do not say "subnet mask = 255.255.254.0", anymore.
The proper way, nowadays, is to specify the IP address and then simply the total number of (consecutive) 1 bits in the mask.

Thus, our case would be written

10.1.12.12/23

(
again, note that 255.255.255.0 = 24 bits,
thus 255.255.254.0 = 23 bits !
)


hth
bv
"The lyf so short, the craft so long to lerne." - Chaucer