Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Why doesn't ifconfig work?
@ 1998-04-29  4:00 John Chambers
  1998-04-30  4:00 ` Eric Werme - replace nobody with werme
  0 siblings, 1 reply; 4+ messages in thread
From: John Chambers @ 1998-04-29  4:00 UTC (permalink / raw)



On this Digital Unix 4.0B system, and on another 4.0D system, the ifconfig 
command doesn't seem to be able to change IP addresses at all.  It always 
gives a 1 exit status, implying that it thinks that it has worked, but in fact 
the address doesn't change.  Here's some evidence:

: id
uid=0(root) gid=1(daemon) groups=0(system),3(mem),7(terminal),9(opr),12(lp),22(web)
: ifconfig tu1
tu1: flags=c63<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
     inet 10.1.1.1 netmask ffffff00 broadcast 10.1.1.255 ipmtu 1500 
: ifconfig tu1 10.1.2.3
: ifconfig tu1
tu1: flags=c63<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
     inet 10.1.1.1 netmask ffffff00 broadcast 10.1.1.255 ipmtu 1500 
: ifconfig tu1 down
: ifconfig tu1
tu1: flags=c62<BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
     inet 10.1.1.1 netmask ffffff00 broadcast 10.1.1.255 ipmtu 1500 
: ifconfig tu1 10.1.2.3
: ifconfig tu1
tu1: flags=c63<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
     inet 10.1.1.1 netmask ffffff00 broadcast 10.1.1.255 ipmtu 1500 
: 


We can see from this that 1) I am indeed logged in as root, 2) ifconfig doesn't make
any changes to the IP address, but 3) ifconfig can put the interface down and 4)
The " ifconfig tu1 10.1.2.3" command doesn't change the address but it does put
the interface back up!   A long series of experiments with varations of the ifconfig
command turned up consisten results:  All sorts of things about the interface can
be changed, but the IP address never changes.  And sometimes changes (such as
the up/down status) change spontaneously for no apparent reason.

Any ideas what might be going wrong, or how to make it work?



BTW, to forestall the obvious red herring:  Yes, I have read "man 8 ifconfig", and
I have seen the suggestion that netsetup be used.  This is not relevant in our case,
because the* intent* is to purposely misconfigure the interface.  The application is
a class exercise in which some judicious mis-configurations are done to a couple
of machines, the student is told that "Such-and-such doesn't seem to work",
and the student is to find and fix the problem.  This situtation absolutely requires
that we be able to dynamically mis-configure the machines (and restore their
correct configuration later with a cleanup script).  Telling us how to "do it right"
isn't a useful answer. We need to be able to change the configuration on the fly,
and then soon after that, we need to be able to change it back.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Why doesn't ifconfig work?
  1998-04-29  4:00 Why doesn't ifconfig work? John Chambers
@ 1998-04-30  4:00 ` Eric Werme - replace nobody with werme
  1998-05-04  4:00   ` John Chambers
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Werme - replace nobody with werme @ 1998-04-30  4:00 UTC (permalink / raw)



John Chambers <jc@ral1.zko.dec.com> writes:

>On this Digital Unix 4.0B system, and on another 4.0D system, the ifconfig 
>command doesn't seem to be able to change IP addresses at all.  It always 
>gives a 1 exit status, implying that it thinks that it has worked, but in fact 
>the address doesn't change.  Here's some evidence:

I've always thought the ifconfig "parser" (hah!) should be rewritten.  Here
are some suggestions from someone who actually gets to work on it.

This is one way:

 # ifconfig tu1 10.1.1.1 netmask 255.255.255.0 
 # ifconfig tu1 
 tu1: flags=c63<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
      inet 10.1.1.1 netmask ffffff00 broadcast 10.1.1.255 ipmtu 1500
 # ifconfig tu1 down delete 
 tu1: delete inet address 10.1.1.1
 # ifconfig tu1 
 tu1: flags=c62<BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>

 # ifconfig tu1 10.1.2.3 netmask 255.255.255.0 
 # ifconfig tu1
 tu1: flags=c63<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
      inet 10.1.2.3 netmask ffffff00 broadcast 10.1.2.255 ipmtu 1500

This is much "slicker":

 # ifconfig tu1 10.1.1.1 netmask 255.255.255.0 
 tu1: flags=c63<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
      inet 10.1.1.1 netmask ffffff00 broadcast 10.1.1.255 ipmtu 1500
 # ifconfig tu1 alias 10.1.2.3 netmask 255.255.255.0
 # ifconfig tu1 -alias 10.1.1.1
 # ifconfig tu1
 tu1: flags=c63<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
      inet 10.1.2.3 netmask ffffff00 broadcast 10.1.2.255 ipmtu 1500
--
<>    Eric (Ric) Werme     <> The above is unlikely to contain   <>
<>    ROT-13 addresses:    <> official claims or policies of     <>
<>   <jrezr@mx3.qrp.pbz>   <> Digital Equipment Corp.            <>
<> <jrezr@plorecbegny.arg> <>  http://www.cyberportal.net/werme  <>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Why doesn't ifconfig work?
  1998-04-30  4:00 ` Eric Werme - replace nobody with werme
@ 1998-05-04  4:00   ` John Chambers
  1998-05-10  4:00     ` Paul Repacholi ( prep )
  0 siblings, 1 reply; 4+ messages in thread
From: John Chambers @ 1998-05-04  4:00 UTC (permalink / raw)



Eric Werme - replace nobody with werme wrote:
> This is one way:
>  # ifconfig tu1 down delete
>  tu1: delete inet address 10.1.1.1
>  # ifconfig tu1
>  tu1: flags=c62<BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
>  # ifconfig tu1 10.1.2.3 netmask 255.255.255.0
> 
> This is much "slicker":
> 
>  # ifconfig tu1 10.1.1.1 netmask 255.255.255.0
>  tu1: flags=c63<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
>       inet 10.1.1.1 netmask ffffff00 broadcast 10.1.1.255 ipmtu 1500
>  # ifconfig tu1 alias 10.1.2.3 netmask 255.255.255.0
>  # ifconfig tu1 -alias 10.1.1.1
>  # ifconfig tu1
>  tu1: flags=c63<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
>       inet 10.1.2.3 netmask ffffff00 broadcast 10.1.2.255 ipmtu 1500

Hmmm ... The implications of this are that the ifconfig command on Dunix has a
subtle difference from how it works on other Unices:  If you just use it to assign
an address to an interface, the effect is apparently to add an alias, not to change
the primary address.  It appears that the usual meaning of "ifconfig tu1 10.1.2.3"
can't actually be done here; this command seems to be synonymous with "ifconfig
tu1 alias 10.1.2.3", and you need to use either the -alias option or the delete param
to get the usual effect of a change of address.

Rereading "man ifconfig" makes it clear that the man page is in fact confused on
the issue, and one can't actually determine how to change the address from the
man page.    It also strongly encourages one to use netsetup, which I in fact did,
but I must say that netsetup is a rather horrible thing to write an expect script for.
It is incredibly wordy, requiring a large script, but the worst of it is that it has a lot of
messages that are either identical or very similar, but which require very different
answers at different phases of the operation.  Writing a program to talk to netsetup
isn't for the faint of heart.  (Maybe it'd make a good worst-case example in a course
on expect ;-).  User friendly it may be, to someone with the intelligence of a human,
but it is one of the most programmer-hostile tools I've ever seen.

Anyway, since it looks like, with a slight paradigm shift (;-), ifconfig can actually
do the job in two or three commands (rather than dozens with netsetup), I'll
be able to write an expect script that uses it.  Thanks.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Why doesn't ifconfig work?
  1998-05-04  4:00   ` John Chambers
@ 1998-05-10  4:00     ` Paul Repacholi ( prep )
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Repacholi ( prep ) @ 1998-05-10  4:00 UTC (permalink / raw)



>>>>> "john" == John Chambers <jc@ral1.zko.dec.com> writes:

    > User friendly it may be, to someone with the intelligence
    > of a human, but it is one of the most programmer-hostile tools
    > I've ever seen.

Now this is my leader for newgroup quote of the year...

-- 
~paul        ( prep )                           Paul Repacholi,
                                                1 Crescent Rd.,
erepacholi@cc.curtin.edu.au                      Kalamunda,
+61 (08) 9257-1001                              Western Australia.  6076



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-05-10  4:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-04-29  4:00 Why doesn't ifconfig work? John Chambers
1998-04-30  4:00 ` Eric Werme - replace nobody with werme
1998-05-04  4:00   ` John Chambers
1998-05-10  4:00     ` Paul Repacholi ( prep )

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox