1836355 Members
1990 Online
110100 Solutions
New Discussion

permanent route add

 
BLADE_1
Frequent Advisor

permanent route add

dear all,

i am trying to add some route addresses and everytime i reboot the box they get reset. I use the command route add -p and also add the entries in /etc/rc.config.d/netconf file...I am running 11.x .

I don't know why this doesn't work..would it be better to make a route add script in /sbin/rc3.d ..



fortune favours the brave
12 REPLIES 12
T G Manikandan
Honored Contributor

Re: permanent route add

If you have proper entries in netconf file things should be ok.
Post your netconf file and the ipaddress which you need to make it permanent.

ROUTE_DESTINATION[0]=
ROUTE_MASK[0]=255.255.255.0
ROUTE_GATEWAY[0]=
ROUTE_COUNT[0]=1
ROUTE_ARGS[0]=""

Here [0} indicates the lan0 interface.

Revert
Frederic Sevestre
Honored Contributor

Re: permanent route add

Hi,

If you ever added an entry in /etc/rc.config.d/netconf which didn't work, you should check the /etc/rc.log to see what is the problem with your configuration (bad lan ID, bad address...)

Don't use a script in rc3.d, you may have problem in the futur if you need to modify the net configuration.

Regards,
Fr??d??ric


Crime doesn't pay...does that mean that my job is a crime ?
Rajeev  Shukla
Honored Contributor

Re: permanent route add

Hi Nainesh,
1.If you have only few routes to be added then its better off doing in /etc/rc.config.d/netconf and if there are too many routes then better make a new rc script for startup.
2. It should definately work with netconf, just take care of the index number(they should not conflict). Take care of Metric count.
3. Try adding those routes manual to see if they are really reachable and can be added.
4. Check for the exact problems in /etc/rc.log

Cheers
Rajeev
BLADE_1
Frequent Advisor

Re: permanent route add

thanx for your replies guys,

U see we have 2 ip address configured on 1 lan card.

first interface is - lan0
and the second a virtual one- lan0:1

this takes care of 2 different networks. Now..i have to add 24 route destinations to 1st interface and 1 for the virtual interface.

I want to know...what will be the entry in the [] braces for 1st and 2nd interface..

I have added

1st interface - lan0

ROUTE_DESTINATION[0]=
ROUTE_MASK[0]=
ROUTE_GATEWAY[0]=ROUTE_COUNT[0]=""
ROUTE_ARGS[0]=""

This entry should be the sam for all 24 routes on 1st enterface?

2nd interface- lan0:1

ROUTE_DESTINATION[1]
ROUTE_MASK[1]
ROUTE_GATEWAY[1]
ROUTE_COUNT[1]=""
ROUTE_ARGS[1]=""


fortune favours the brave
T G Manikandan
Honored Contributor

Re: permanent route add

INTERFACE_NAME[0]="lan0"
INTERFACE_NAME[1]="lan0:1"
Heinz Gaertner
Advisor

Re: permanent route add

hi,

i think you misunderstood what the number in the brackets mean. This is a array-variable, so you must just count up from 0 to 23 for your 24 routes. This has nothing to do with the lan-interfaces. Which lan-interface is used, is a logical result of your routing-entry, because your ROUTE_GATEWAY specifies the ip which is used as routing gateway and this is in your case normally one of your interface-ip's (or a ip in the logical network, where the interface is attached). Hope this helps.

Heinz
Ron Kinner
Honored Contributor

Re: permanent route add

Heinz is correct. The brackets are just so the program can keep the statements together and tell them apart from the other statements. Following is an example lifted from a working system with just the IP addresses changed to protect the guilty.

ROUTE_DESTINATION[0]="10.1.95.0"
ROUTE_MASK[0]="255.255.255.0"
ROUTE_GATEWAY[0]="172.16.1.250"
ROUTE_COUNT[0]="1"
ROUTE_ARGS[0]=""

ROUTE_DESTINATION[1]="192.168.9.0"
ROUTE_MASK[1]=""
ROUTE_GATEWAY[1]="172.16.1.250"
ROUTE_COUNT[1]="1"
ROUTE_ARGS[1]=""

ROUTE_DESTINATION[2]="172.19.95.0"
ROUTE_MASK[2]="255.255.255.0"
ROUTE_GATEWAY[2]="172.16.1.250"
ROUTE_COUNT[2]="1"
ROUTE_ARGS[2]=""

You can leave the ROUTE_MASK at "" if you use the regular class mask. i.e. 10 and 172 are class A and B so their standard masks would be 255.0.0.0 and 255.255.0.0 but we have broken all of our networks down into class C's so we need to specify the mask except for the 192 which is a class C.

ROUTE_COUNT should be a positive integer. Represents the number of "hops" to the destination but the actual number doesn't matter that much unless you are running GATED. A value of 0 means that the address is local so we usually just set it to 1 to indicate to the system that it is non-local.

Also as far as I know the -p option to route add only works in Windows.

netstat -rn

will let you see what routes the box knows.

Ron
David Baraloto
Occasional Contributor

Re: permanent route add

Whenever I have to add permament routes to an HP machine I use gated and put them in the gated.conf file. I've found the netconf file to be unreliable at best when it comes to adding routes at startup. Gated hasn't failed me yet.
BLADE_1
Frequent Advisor

Re: permanent route add

hi guys,

thanx for the valuable input.

So the fact is that the entry in [] doesn't specify the lan interface but the sequence no. of different entries. My netconf file is configured in the same way now..but now the only destination which doesn't get initialized at the startup, is the entry configured to lan0:1 interface.

Is the configuration here righ?

IP_ADDRESS[1]=10.111.13.186
SUBNET_MASK[1]=255.255.255.248
INTERFACE_NAME[1]=lan0:1
BROADCAST_ADDRESS[1]=10.111.13.191
INTERFACE_STATE[1]=up

# VSM
ROUTE_DESTINATION[28]=10.69.4.29
ROUTE_MASK[28]=255.255.255.224
ROUTE_GATEWAY[28]=10.111.13.150
ROUTE_COUNT[28]=""
ROUTE_ARGS[28]=""

ip addresses changed..

fortune favours the brave
V. Nyga
Honored Contributor

Re: permanent route add

Hi,

please honor the efforts of these guys by assigning points.
Most of us are helping here during their work!

Volkmar
*** Say 'Thanks' with Kudos ***
Heinz Gaertner
Advisor

Re: permanent route add

Hi,

now for me it's a question how near the used IP's come to reality. In your example you have subnets with three bits for networks, which means every subnet has 8 IP's where the lowest one is the networks IP, the highest one is the broadcast IP. So if i don't have miscalculated (doing this without a calculator :-o) you have ....186 as network-IP and ....193 as broadcast-IP and you cannot assign the 186 as a normal interface IP.
But, whatever is wrong here, i think the easiest try to get out of this, is to check if you assign the IP manually using the ifconfig command:
ifconfig lan0:1 netmask broadcast
and let's see what error is coming up doing this.
RAC_1
Honored Contributor

Re: permanent route add

you will also need the entry in netconf as follows.

/etc/rc.config.d/nddconf

TRANSPORT_NAME[0]=ip
NDD_NAME[0]=ip_check_subnet_addr
NDD_VALUE[0]=0
There is no substitute to HARDWORK