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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

where is IP address set?

Status
Not open for further replies.

stevenriz

IS-IT--Management
May 21, 2001
1,069
I was given a couple linux servers to administer and while I look around them, I see nothing in the hosts file. These servers do have iptables running, could that program possibly have the IP address set within the rules? I just don't want to spend a lot of time on it so I thought I would ask. Thanks!
 
It's always going to be ifconfig.
man 8 ifconfig
 
I think he's asking where the IP is set in config files so ifconfig can set it at boot time.
 
sort of, the hosts file is empty yet it does have an ip address. does this make sense? If it is linux 4.5.3, I would be very suprised b/c it is fairly old.

[root@webstuff sbin]# uname --version
uname (coreutils) 4.5.3
Written by David MacKenzie.
 
Code:
uname --version
Heh heh. That gives the version of the [tt]uname[/tt] utility.

Try
Code:
uname -r


Linux 4.5.3 may exist in 20 years. They're still stuck on 2.4.x for now, though ;)
 
uname won't give the distro... They usually have it in /etc/issue and they'd probably display it at boot time.

try: cat /etc/issue

on mine it shows:

Fedora Core release 2 (Tettnang)
Kernel \r on an \m

 
if you know the IP address, try this:

grep -iR "Put.in.ip.address" /etc/*

I bet you will find a file in /etc/network or something like that.
 
just ran this....

[root@webs root]# uname -r
2.4.21-4.ELsmp


 
I believe EL implies RedHat. There should be a utility called 'neat' that will allow you to update your IP addresses in a GUI. Or you can directly edit the files in /etc/sysconfig/network-script/
 
2.4.21-4 is the kernel that RH ships with RHEL3, I know because I just bought it myself. However, I can't guarantee this is your distro, only that it very well could be RHEL3. In any case, he's right, there will be files in /etc/sysconfig/network-script/ which will contain your IP address information. Check there.
 
it is there, this is alittle different then HPUX and SOLARIS. Anyway, would this be the only place to change the IP address if I so happen to want to change it?
 
yes... that is the place to change your network configuration on RHEL3. You'll do an "ifdown" and then "ifup" to bring the eth card down and then back up with the new configuration...

**** MAKE SURE YOU ARE DOING THAT LOCALLY, NOT OVER SSH, CAUSE THE NETWORK WILL GO DOWN AND YOU'LL LOOSE YOUR CONNECTION ****

Also, if you have something like iptables or ipchains or some other firewall running, you'll wanna make sure you modify those appropriately.

Lastly, various programs/services on a computer can have config files which bind themselves to certain IP addresses, such as Apache or SSH. If you have those running, make sure to check their configs as well.
 
If you're running X, use the GUI tools. They're very capable and flexible, but yes, you can set all your configs by editting /etc/sysconfig/network and network-scripts.
 
no I only have SSH access..... no gui.... :(
 
Well, one of the great things about X is you can display the gui tools on a remote X server, but that's a different thread. :)
 
true with the xauth tool etc right? i do that on solaris, is it similar with linux?
 
you're still gonna have the problem that if you are messing with the network config remotely, you only get one shot to do it right, and then force a reboot, and cross your fingers. I'd recommend doing network config locally on the terminal, even if that means a trip to where the server is. :)
 
X is pretty much X, whether it's Solaris or Linux. Ssh will handle forwarding your connection if set up properly.

You don't have to reboot to change your network config, it isn't NT ;-). But you are right about crossing your fingers. I was trying to move an IP address from an interface alias to the actual interface (just anal, I guess) and without thinking it through I ifconfig'ed the main interface down, knowing I was connected to the IP of an alias of that interface and not the primary (duh). That was a definite "oh sh*t" moment, but I was able to race across town and get it back up before anyone important noticed.

A nice trick I've started using when messing with our firewall rules is this:

service iptables save ; sleep 60 || service iptables restart

Then in that 60 seconds, in another window I install the new firewall rules. If I lock myself out of the machine, the firewall rules revert to their last saved config after the timer expires.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top