[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Static IP

Scott Mertens wrote:
On Tue, 2005-04-12 at 10:21 -0700, Rick Stevens wrote:

Scott Mertens wrote:

On Tue, 2005-04-12 at 10:00 -0700, Rick Stevens wrote:

Scott Mertens wrote:

New Linux User: Red Hat Enterprise Linux ES release 4 (Nahant)

I am in the process of setting up Printer sharing on this Linux box for
WIN XP users. I think some of my problems might be resolved if I can set
up a static IP for this box.  Currently it gets one from a Linksys
router connected to ISP.

How can I tell Linux to use a static IP, but use DNS and other info
provided by ISP/Linksys router?

First off, get into the router and write down the DNS info it uses. Also check the router's "DHCP Pool" (those are the addresses that the DHCP server will give out) and the router's IP address and netmask.

Run "redhat-config-network" (or "RedHatIcon->System Settings->Network"

from the Gnome GUI) and configure the NIC for a fixed IP address. You

will want to select a fixed IP that is NOT in the DHCP pool for the
router.  Your netmask will probably be, but use the one
you saw that the router was using.  Your default gateway will be the
router (usually and you'll put in the DNS servers you
grabbed from the router.  That should be it.

Thanks, I'll give that a try.

Go for it, Scott. We'll be waiting for a status report.

Is there just a file I can edit?  My practice is to always make a backup
of files before editing, and I'm not sure the GUI will do that.  Also
running the following as you suggest throws an error.

[root RHServer01 ~]# redhat-config-network
-bash: redhat-config-network: command not found

That's odd. Hmmm. Try "system-config-network". One or the other should be in /usr/bin.

Anyway, yes, you can edit files if you wish.  You're interested in
these two files:


/etc/sysconfig/network contains three lines generally.  Here's a typical


The values in there should be pretty obvious.  Put your desired hostname
as the value of the "HOSTNAME=" line, and the IP address of your gateway
in the "GATEWAY=" line (as I said, your gateway is probably, but use whatever the router's LAN port's address is).

The second file, /etc/sysconfig/network-scripts/ifcfg-eth0, sets up the
specifics for your NIC.  The only data that is REQUIRED in that file
are the following:


Make sure you set the "DEVICE=" to the proper device.  If you only have
one NIC, then "eth0" is the right value (it should match the name of the

"BOOTPROTO=static" is what makes the device use a static IP rather than
one from DHCP (which is triggered by "BOOTPROTO=dhcp").  Obviously, you
put your desired IP address in the "IPADDR=" line and your netmask in

The final line, "ONBOOT=yes" tells the system to bring up this interface
at boot time.

Once you've got all that set up, do "/etc/rc.d/init.d/network restart"
and the system should switch over to your new network settings.

Hope that helps.
- Rick Stevens, Senior Systems Engineer     rstevens vitalstream com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-           What is a "free" gift?  Aren't all gifts free?           -

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]