Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another Newbie question 1

Status
Not open for further replies.

Chmex21

Technical User
Jun 10, 2001
26
0
0
US
This is really stupid question, but how do you change the IP{ address of a Red Hat 7.1 Machine, without xwindows installed. Please help.
 
As root edit the /etc/hosts file and add the new IP address, then run ifconfig {ethernet device}[ address xxx.xxx.xxx.xxx where xxx.xxx.xxx.xxx is the new address for that device. d3funct
zimmer.jon@cfwy.com
The software required `Windows 95 or better', so I installed Linux.

 
man ifconfig
ex:
classless
ifconfig eth0 192.168.1.30 netmask 255.255.255.224 up
classful
ifconfig eth0 192.168.1.30 up

It would probably be better to use netcfg,
or linuxconf to set this though as you are
new and it's RH.
 
Hi,









Redhat network initialisation runs scripts in /etc/sysconfig/network-scripts that read parameters from files in the same directory.









This means that you can 'ifconfig' as much as you like but on a restart the scripts will re-do the ifconfig with the parameters found in those files. For example, the parameters for the first ethernet card are in the file '/etc/sysconfig/network-scripts/ifcfg-eth0'









So, you can edit these files directly if you like or, preferably, use the redhat gui tool 'sbin/netconf' as root. For users of other distros - remember this is redhat specific and probably does not apply to other distros (except maybe Mandrake which is redhat based).









Incidentally, the hostname is contained in the file /etc/sysconfig/network .









Rgds
 
On the same note, how do you change the autosensing on a redhat system to say a 10Mbps only connection? Rninja

smlogo.gif

 
Whatever-learn the basics, the commands that make things work rather than the location of static sources that
contain configuration lines differing in location from distro to distro and you will do yourself a huge favor.
ifconfig is the command-where it is loaded from you will
learn, is largely up to you:when it is loaded ,and where, are more important.
 
Hi,

As a linux adherent, I agree absolutely that people need to master the 'standard' commands otherwise they will fall into the same trap as M$ users - pushing gui buttons and not really understanding whats going on. So, yes you would want to know all about ifconfig because it is common to all linux distros and will be the underlying command called by network initialisation scripts.

It should also be appreciated, however, that it is more or less impossible to design an operating system without having some configuration files that contain saved settings of various sorts. Windows had .ini files and then the dreaded registry. In linux there is no universal agreement on where such settings should be stored. Redhat happen to mostly use files in the /etc/sysconfig subdirectories. Other distros have similar files. If you imagine creating your own linux distro ... How would you start the network interfaces ? Obviously by invoking ifconfig from within a script. OK, but unless everything is dchp where do you get the static ip address from ? It has to be from a config file somewhere that is read by the script. Maybe the best solution would be to have the network scripts configured to transparently save active interface configs back to disk when you stop or restart the newtork so that when you change things with ifconfig they are preserved across a network restart or reboot.

On the autosensing query, thankfully this is not distro specific. You need to pass parameters to the module when it is loaded and this is done in /etc/modules.conf . It varies by card but, for example, tulip chip based cards are configured using the following table :

0 Auto-select (default to the 10baseT link)
1 10base2
2 AUI
3 100baseTx
4 10baseT-FD
5 100baseTx-FD
6 100baseT4
7 100baseFx
8 100baseFx-FD
9 MII 10baseT
10 MII 10baseT-FD
11 MII (autoselect)
12 Serial 10baseT (no autoselect)
13 MII 100baseTx
14 MII 100baseTx-FD
15 MII 100baseT4
16 MII 100baseFx-HDX (half duplex)
17 MII 100baseFx-FDX (full duplex)
18 MII Home-PNA 1Mbps
0x200 (0x200) Added to other values to set full duplex

You set the values on the 'options=' parameter to insmod or 'options' within the modules config file, for example (in /etc/modules.conf) :

alias eth0 tulip
options tulip options=1 full_duplex=0

Using insmod directly you would do something like :

/sbin/insmod tulip options=0x201 (example showing x200 added to force full duplex)

If the card is compiled into a custom kernel you have to pass parameters via lilo .

For full info on ethernet drivers for linux see --> .

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top