From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,9e943f880c63cc59 X-Google-Attributes: gid1164f8,public From: John Chambers Subject: Re: Why doesn't ifconfig work? Date: 1998/05/04 Message-ID: <354DE12C.19D01C41@ral1.zko.dec.com>#1/1 X-Deja-AN: 350133445 Content-Transfer-Encoding: 7bit References: <354744C0.E2B6F10C@ral1.zko.dec.com> <6iar3m$ot7$1@lead.zk3.dec.com> Mime-Version: 1.0 Reply-To: jc@eddie.mit.edu Content-Type: text/plain; charset=us-ascii Organization: Digital Equipment Corp (soon to be Compaq) Newsgroups: comp.sys.dec 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 > # 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 > 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 > 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.