Operating System - HP-UX
1819803 Members
3212 Online
109607 Solutions
New Discussion юеВ

Re: netconf file - "[#]" fields

 
SOLVED
Go to solution
JHL_2
Advisor

netconf file - "[#]" fields

Hello all. I have 5 total lan connections on a rp7400 running 11.0. One is on the core I/O and the remaining 4 on a 4-port nic. Anyway, when I edit the netconf file, aren't the instances of the [#] values simply the lan interfaces?

For example: wouldn't the following line be for lan0
ROUTE_GATEWAY[0]=10.210.32.1 and the line
ROUTE_GATEWAY[1]=10.236.145.71
be for lan1 etc?

I'm being told that the values are for "indexes" and not interfaces. Is this true and what is the difference?
21 REPLIES 21
John Poff
Honored Contributor
Solution

Re: netconf file - "[#]" fields

Hi,

The values in [#] are array indexes. The netconf file is really part of a shell script that runs and starts up the interfaces, so your indexes start with zero and go up one at a time from there. If your lan interfaces start with lan0 and are numbered sequentially, you can have subscript 0 be the settings for lan0, subscript 1 be the settings for lan1, and so on. The trick is that the netconf file can get reconfigured by other programs and scripts (sam, 'set_parms', etc.), so I wouldn't bank too much on things staying exactly like you start out with. On the other hand, there is a whole camp of thinking here on the forum that you should just edit netconf by hand and stay away from the automated stuff.

Either way, the numbers you are seeing are array subscripts and aren't tied to the lan numbers.

JP
Jim Turner
HPE Pro

Re: netconf file - "[#]" fields

Hi JHL,

John's right. The [index] is just used to tie groups of parms together. I always use [0] for lan0 stuff, [1] for lan1 stuff, etc. However, there's nothing preventing you from using some arbitrary choice like [123] for lan0 as long as all lan0 parms have the index [123].

And count me as one of those who advocates manual editing of config files. Save all that automated junk for the girlie-man Winblows admins.

Cheers,
Jim
JHL_2
Advisor

Re: netconf file - "[#]" fields

First thanks guys! Anyway, my lan0 is empty and the first three ports on the quad-card are lan1, lan2 and lan3 respectively. With the convention [0], [1] and [2] used accordingly shouldn't these (in this case) tie in with the lan0, lan1 and lan2 ports accordingly. OR does [0] tie into the first ACTIVE port which would in this case be lan1 and not lan0?
Still confused here....
Kellogg Unix Team
Trusted Contributor

Re: netconf file - "[#]" fields

In that case, you will define your netconf as -

INTERFACE_NAME[0]="lan1"
ROUTE_GATEWAY[0]=w.x.y.z
IP_ADDRESS[0]=
SUBNET_MASK[0]=

INTERFACE_NAME[1]="lan2"
....
....

So you tie interface name with index# by defining "INTERFACE_NAME[x]" variable

HTH
...Manjeet
work is fun ! (my manager is standing behind me!!)
John Poff
Honored Contributor

Re: netconf file - "[#]" fields

The first lan connection specified has an array subscript of zero, no matter what actual lan device it is (lan0, lan1, lan4, lan100, etc.), so you are correct. You are specifying the "active" lan connections. You have to start with zero and go up from there.

For example, on one of my boxes I have this:

INTERFACE_NAME[0]=lan0

INTERFACE_NAME[1]=lan2

while on another box I have this:

INTERFACE_NAME[0]=lan6

INTERFACE_NAME[1]=lan3

Does that help?

JP

JHL_2
Advisor

Re: netconf file - "[#]" fields

The first connection is lan0 and is on the core I/O. While it has a configuration in SAM, nothing is plugged into it (empty). The configurations for the second, third and fourth (lan1, lan2 and lan3) should match the indexes [1], [2] and [3] no? I've got a customer who thinks that the index and the interface numbers (even in this case) would be different. HELP!!!
John Poff
Honored Contributor

Re: netconf file - "[#]" fields

No. Check out Manjeet's example above. You would do it just it is listed there. Your lan1 settings go with index [0], lan2 settings go with index [1], and lan3 settings with index [2].

Do you know the IP addresses, netmasks, etc. for each of the three lan cards? If so, why don't you post them and we'll have a go at what your netconf file might actually look like.

JP
JHL_2
Advisor

Re: netconf file - "[#]" fields

Here's a copy of (part) of the netconf file:

IP_ADDRESS[0]=132.xxx.xxx.xx
SUBNET_MASK[0]=255.255.0.0
INTERFACE_NAME[0]=lan0
BROADCAST_ADDRESS[0]=132.145.255.255
INTERFACE_STATE[0]=down

IP_ADDRESS[1]=10.236.xxx.xxx
SUBNET_MASK[1]=255.255.240.0
INTERFACE_NAME[1]=lan1
BROADCAST_ADDRESS[1]=10.236.xxx.xxx
INTERFACE_STATE[1]=up
DHCP_ENABLE[1]=0

SO AGAIN - DOESN'T THE "[0]" VALUES MATCH THE LAN INTERFACE NUMBERS?
Kellogg Unix Team
Trusted Contributor

Re: netconf file - "[#]" fields

In the above case, yes, its matching but its not required. You could have -

INTERFACE_NAME[0]="lan1"
INTERFACE_NAME[1]="lan0"
(with other entries correctly populated)

and it would 'still work'.

...Manjeet
work is fun ! (my manager is standing behind me!!)
John Palmer
Honored Contributor

Re: netconf file - "[#]" fields

Hi,

All you are doing in netconf is to populate a set of shell array variables with data. A set of variables with the same subscript relate to the same card.

The order that you specify the Lan cards doesn't matter provided you start with subscript 0 and increment by 1 each time, you mustn't leave any gaps because the code thinks that an empty variable is the end of the list.

Thus as an example, you could have:
INTERFACE_NAME[0]=lan1
ROUTE_GATEWAY[0]=?.?.?.?
.....

INTERFACE_NAME[1]=lan4
ROUTE_GATEWAY[1]=?.?.?.?
.....
etc.

Changing the order to:
INTERFACE_NAME[0]=lan4
ROUTE_GATEWAY[0]=?.?.?.?
.....

INTERFACE_NAME[1]=lan1
ROUTE_GATEWAY[1]=?.?.?.?
.....
etc.

has exactly the same effect (other than the startup script configures the cards in the order specified) so you end up with the same result.

You happen to be in a situation where your Lan cards are numbered in order 0 to 3, this is by no means typical. Often you get gaps and sometimes they don't start at 0.

Regards,
John
John Poff
Honored Contributor

Re: netconf file - "[#]" fields

In this case, the array subscripts ([0], [1]) for the settings for each card happen to match up with your lan card numbers (lan0, lan1, lan2) because the device names for the lan cards just happened to be sequentially assigned. It won't always be that way, but it is in this case.

As long as you start with [0], and go up sequentially from there ([1], [2], [3]) you should be fine.

What is the best way to test it? Setup the netconf file like you think it should be and reboot the system. If the lan cards all come up with the correct IP addresses and netmasks, you've got it licked.

JP
JHL_2
Advisor

Re: netconf file - "[#]" fields

Thanks guys. I thought making the indexes and interface numbers the same would be the way to go. In this case, I'm glad I did. Thanks all around and a round of pints (points) accordingly...
Gerhard Roets
Esteemed Contributor

Re: netconf file - "[#]" fields

JHL,

Just remember after running sam(in its infinite wisdom) or some auther auto script you might find those index numbers changed.

The important thing is that the are arbitrary. As long as they stay constant for a specific port / lan interface.

If you use virtual interfaces aka multiplexing you will find that lan0:1 has one index and lan0:2 has another index and so forth.

As a side note lan0:0 is equivalent to lan0.

So to sum it up every logical network interface(Not physical even though they might match) aught to have its own index number in this file.

Regards
Gerhard
Jim Turner
HPE Pro

Re: netconf file - "[#]" fields

Another "Oh, by the way . . ."

SAM also has a nasty tendency to put parms at the bottom of the netconf file. So if you look in the regular place that is interleaved with the comments, that might not be all. Always scroll down to the bottom of the netconf file to make sure SAM's not screwing you over.

The last settings win, so when rc sources the netconf file, dupe settings at the end will negate whatever you have set earlier in the file.

Cheers,
Jim
JHL_2
Advisor

Re: netconf file - "[#]" fields

Hold on. Even if lan0 is empty but configured as 10.123.xxx.xxx can I still have the following:

INTERFACE_NAME[0]=lan0
INTERFACE_NAME[1]=lan1
INTERFACE_NAME[2]=lan2
INTERFACE_NAME[3]=lan3
INTERFACE_NAME[4]=lan4

Again, if lan0 is disabled the interface #s do indeed match the index number. Only lan1, lan2 and lan3 are plugged in and active.
John Palmer
Honored Contributor

Re: netconf file - "[#]" fields

Yes, you can still have that but I don't see the point. I wouldn't configure lan0 if it wasn't connected to a network so as not to get any error messages.

You could even include a lan0 for instance even if you didn't have one, provided you are prepared to ignore the error messages produced by the net startup script.

In your case I'd just have:
INTERFACE_NAME[0]=lan1
...
INTERFACE_NAME[1]=lan2
...
INTERFACE_NAME[2]=lan3
...
INTERFACE_NAME[3]=lan4
...

Regards,
John
Darrell Allen
Honored Contributor

Re: netconf file - "[#]" fields

What you ask about in your post beginning with "Hold on." is okay. You'll probably want to have "INTERFACE_STATE[x]=down" for lan0 and lan4.

I think you're making too much out of this. It simply just doesn't matter that the indexes and interface numbers don't match. It's not worth the effort. It may change if you add hardware later or rebuild the system.

The indexes are simply used to group ifconfig arguments for an interface together. Let the first one be [0], the next [1], and so forth, regardless of the interface number.

Life is too short to get hung up on the small stuff.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Darrell Allen
Honored Contributor

Re: netconf file - "[#]" fields

Let me add one more thing. One of the posts above shows a ROUTE parameter mixed in with the INTERFACE parameters. They are actually two seperate arrays.

INTERFACE parameters (including stuff like SUBNET_MASK, IP_ADDRESS, etc) are arguments for the ifconfig command. They are loaded into one array.

ROUTE parameters are arguments for the route command. They are loaded into a different array.

The point is that the indexes for INTERFACE parameters and ROUTE parameters are independent of each other. These lines often get intermingled in netconf but ROUTE...[0] has nothing to do with INTERFACE_NAME[0].

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
rick jones
Honored Contributor

Re: netconf file - "[#]" fields

i would be warry of using arbitrary indicies for the arrays in the netconf file. it would be probably be best for them to be contiguous.
there is no rest for the wicked yet the virtuous have no pillows
Gerhard Roets
Esteemed Contributor

Re: netconf file - "[#]" fields

I would agree with Rick. Only when manually adding a new interface would I add my own interface. I would not fret about them at all to be honest except when configuring new things.

Simple moto with things like that. If it aint broke dont fix it. You wont gain functionality by reindixing them. Just maybe more sense to you.

Guess what I am trying to say is really think before changing them.

Regards
Gerhard
JHL_2
Advisor

Re: netconf file - "[#]" fields

So leave it as it is will be just fine?
Guys I can't begin to thank you for all of your help in this