Operating System - HP-UX
1834884 Members
2954 Online
110071 Solutions
New Discussion

'correct' ifconfig sequence

 
John Cattanach
Occasional Advisor

'correct' ifconfig sequence

Hi,
I'm swapping networks between lancards using ifconfig (HP-UX 11.0), and get occasional failure. The sequence I'm doing is:
ifconfig down
ifconfig 0
ifconfig
ifconfig up

Where I get trouble is the ifconfig 0, which sometimes reports duplicate IP.
I haven't managed to note what other circumstance are involved. NB I'm using secondary and primary interfaces for lan PPA.

My questions are:
1) is the ifconfig sequence above reasonable, or is there a better way?
2) does the ifconfig automatically do a gratuitous ARP?

Many thanks,
John
6 REPLIES 6
Animesh Chakraborty
Honored Contributor

Re: 'correct' ifconfig sequence

Hi,
Try using SAM.

SAM>network & communication >netowk interface card.


Best of luck
Animesh

Did you take a backup?
Santosh Nair_1
Honored Contributor

Re: 'correct' ifconfig sequence

HI John,

How about unplumbing the lan card since you no longer need it, i.e.

ifconfig down
ifconfig unplumb
ifconfig
ifconfig up

-Santosh

P.S. Don't forget to update /etc/rc.config.d/netconf to point to the new lan card/IP, also update /etc/hosts with the new IP/hostname.
Life is what's happening while you're busy making other plans
John Cattanach
Occasional Advisor

Re: 'correct' ifconfig sequence

Thanks for quick responses.
As ever I should have included more information:

I want to do this ifconfig automatically, and temporarily (so updating netconf et al isn't required).
I also don't think I want to unplumb the lan card as other applications may require to use it (though I stand to be corrected). e.g.

lan1 =
lan1:1 =

problem with lan1, so I want to move to lan2. Want to leave on lan1 so that another process can recover it.

lan1 fixed, so I want to from lan2 back to lan1:1

John
harry d brown jr
Honored Contributor

Re: 'correct' ifconfig sequence

John,

I?m very curious, why do the lan swapping? What kind of app are you running that requires/needs you to swap the lan ??
Live Free or Die
Ravi_8
Honored Contributor

Re: 'correct' ifconfig sequence

Hi,
no need to swap the IP's , since u have multiple interfaces u can assign different IP's to each interfaces and enable them simultaneously(need to add all the iterfaces in netconf file and all IP's in hosts file)so that users can use any interface
never give up
John Cattanach
Occasional Advisor

Re: 'correct' ifconfig sequence

Hi,
Thanks again for your replies. In answer to why and what I'm doing this, here's the story:

Have a requirement to provide network failover using 2 physically seperate (unbridged) lans.
The way I've been doing it is with a process for each network for each host pinging all other local hosts on that network. If any ping fails, a route is added via that host's address on the other network.
Fair enough, that bit seems okay. What isn't so okay is if I unplug the cable for lan PPA X from machine A. I have been advised that hp-ux discards/hides/makes unusable any IP addresses formerly on lan PPA X.
So what my program does is issue 'ifconfig lanX' and grep for 'UP'. If it doesn't show, the program then tries to ifconfig the IP address onto a secondary lan interface on the other network e.g. lanY:1

And this is where trouble starts. I'm currently doing
ifconfig lanX:0 down
ifconfig lanX:0 0
ifconfig lanY:1
ifconfig lanY:1 up

and getting occasional 'duplicate IP' at the ifconfig lanX:0 0 command.

I'm also seeing another thing where after replacing cable to lanX and ifconfiging it back up, the ifconfig lanX command doesn't display UP, even though the card is functional according to linkloop and lanadmin.

Hope this makes things somewhat clearer,
John