Link to home
Start Free TrialLog in
Avatar of terrywong
terrywong

asked on

How to change IP address?

Hi All,

We have one 10 years' DEC Unix box (brand: Digital). Want to change its IP address. Besides looking the file in

/etc/resolv.conf
/etc/hosts
/etc/defaultrouter
/etc/netmasks

is there any file I need to take care?

Thanks!
Avatar of shivsa
shivsa
Flag of United States of America image

i do not know if they have something like
/etc/hostname.hme0, u have to check that too.

also i remember there used to be netsetup command on the  DEC, if u run it from there u can change the ip address from there and it will do the rest of the job for u.
hostname.de0 is more likely to appear on DEC Alpha, hme is on SUN

Digital aka DEC was bought by Compaq, and network cards business by Intel
Now Compaq is slowly becoming HP with Alpha CPU business going to Intel

check out www.tru64unix.compaq.com for missing documents (it redirects to some HP site now)
Avatar of Hanno P.S.
which OS (Ultrix, BSD ...) ?
ASKER CERTIFIED SOLUTION
Avatar of ppentchev
ppentchev

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
grepping for 192.168.0 will find this string, too
   u192x168y0bla
which is NOT an IP address!

Use this instead:
  grep '192\.168\.0\.' `find /etc -type f`

I don't know which UNIX you had in mind, ppentchev, but the -L to find
is not very common, most "find"s don't support it.
Avatar of ppentchev
ppentchev

Errr... as far as escaping the dots, please note that I used 'fgrep', not 'grep'.  While it is true that 'grep' or 'egrep' would treat the dots as wildcard characters in the regular expression, the 'fgrep' tool will treat its argument as a fixed string, not a regexp, and will not attach any special meaning to the dot character.  A fgrep for 192.168.0 will *not* find u192x168y0bla :)

The use of grep ... `find ..` may be risky, if any of the files or directories should contain spaces in their names.  Consider the following:

[roam@straylight ~/tmp]> mkdir -p foo/a\ b/c
[roam@straylight ~/tmp]> touch foo/d foo/a\ b/c/e
[roam@straylight ~/tmp]> find foo -type f
foo/a b/c/e
foo/d
[roam@straylight ~/tmp]> ls `find foo -type f`
ls: b/c/e: No such file or directory
ls: foo/a: No such file or directory
foo/d
[roam@straylight ~/tmp]>

For this reason, the use of find/xargs is generally preferable, especially when using find -print0 | xargs -0, as in:

[roam@straylight ~/tmp]> find foo -type f -print0 | xargs -0 ls
foo/a b/c/e     foo/d
[roam@straylight ~/tmp]>

As to the -L option to find, you are right, I should have mentioned that there are some versions of find that do not have it.  It is commonly found on BSD-derived systems, and the reason I used it instead of 'find -type f' was to make sure that symbolic links are also searched.  Consider the case of, say, /etc/hosts being symlinked to /cfg/local/etc/hosts; a 'find /etc -type f' command would *not* "find" the /etc/hosts symbolic link, while it would definitely need attention by the original poster.  True, symlinking /etc/hosts is an extreme example, but there are many cases when there *are* indeed symlinks even within /etc.