Fedora Linux Support Community & Resources Center
  #1  
Old 27th June 2007, 04:32 AM
jawsmith Offline
Registered User
 
Join Date: Jun 2007
Location: Lees Summit, MO
Posts: 26
Static IP address

I know how to use gnome and set up a static IP address, same as KDE. I also know how to use ifconfig to set the IP address statically.

My problem is that once I set it in the UI (turning off the use of DHCP) and setting it to 192.168.0.10/255.255.255.0 and a gateway of 192.168.0.1.... I then restart the network and it doesn't come back to that IP, it comes back with a DHCP provided IP address.

If I do it from a terminal window and use "ifconfig eth2 192.168.0.10 netmask 255.255.255.0 up", it sets the IP correctly. But, I have been rearranging my stuff and have had to shut the server down several times. It always comes back to using a DHCP address.

The UI still shows it as the static IP, but that is not what it is.

The problem here is that I use samba with it and have some port forwarding going on from my gateway/router...

Anyone with any ideas?

--jamei
Reply With Quote
  #2  
Old 27th June 2007, 04:38 AM
jawsmith Offline
Registered User
 
Join Date: Jun 2007
Location: Lees Summit, MO
Posts: 26
I take that back, the command did not work!!! The following is the info:

ifconfig eth2
eth2 Link encap:Ethernet HWaddr 00:E0:81:27C:E9
inet addr:192.168.0.202 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:81ff:fe27:cce9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6703 errors:0 dropped:0 overruns:0 frame:0
TX packets:5946 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1129015 (1.0 MiB) TX bytes:899853 (878.7 KiB)
Base address:0x9400 Memory:f2020000-f2040000
Reply With Quote
  #3  
Old 27th June 2007, 04:40 AM
Seve Offline
Retired Community Manager
 
Join Date: Oct 2004
Location: The GTA, Ontario, Canada
Age: 56
Posts: 12,371
Hello:
There are lots of network gurus here, I'm not one

In lieu of that, have you tried setting your IP address for your box in your router ?
Here, at least I can assign the IP addresses that I select to each box connected to my network.

Seve
__________________
Registered Linux User: #384977
.................................................. ............
See the Links below for more Help and those much wanted extras ... :)
Reply With Quote
  #4  
Old 27th June 2007, 05:04 AM
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 6,032
jawsmith:
When you said you know how to setup static addressing with the UI, did you mean
via "system-config-network" ? That's available in KDE via the
KDE menu-> Administration->Network Configuration
or running system-config-network as root in the terminal window.

Assuming you used the system-config-network tool,
are you remembering to do the File->Save from the system-config-network
app. If you don't do the save the file changes aren't made and it's all lost at
the next boot. If you want to try the raw config files, you can go in
/etc/sysconfig/network-scripts and look at ifcfg-eth2, for static you should have:

in file /etc/sysconfig/network-scripts/ifcfg-eth2

DEVICE=eth2
BOOTPROTO=static
BROADCAST=192.168.0.255
HWADDR=XX:XX:XX:XX <<< whatever your hardware's mac address is
IPADDR=192.168.0.10
NETMASK=255.255.255.0
ONBOOT=yes

then make sure your

/etc/sysconfig/network file has a in it line:

GATEWAY=192.168.0.1

Usually the network file is for all the info the
interfaces have in common, and the ifcfg-???
files are for all the interface particular stuff where ??? is
the name of the interface eth0, eth1, and so on.
You should also make sure no entries in the /etc/hosts
exist that contradict your /etc/sysconfig/network entry
(that is if you have HOSTNAME=blah.blah,blah in the network file,
don't also have a entry for blah.blah.blah whose IP doesn't
match 192.168.0.10

Mark

Last edited by marko; 13th July 2007 at 03:41 AM. Reason: typo - fixed different GATEWAY entry from ifcfg-eth2
Reply With Quote
  #5  
Old 3rd July 2007, 03:31 PM
jawsmith Offline
Registered User
 
Join Date: Jun 2007
Location: Lees Summit, MO
Posts: 26
It just started doing it..... It is saved. I did it correctly. Done it a million times, it seems. But, for some reason, when my first login after a restart is root, it works fine! (I am rearranging some stuff, so normally it would always be on so no need to change).

It is really not the IP address thing as much as it is that it is deciding to use DHCP instead of the IP given... It seems to work now as long as I login as root first.
Reply With Quote
  #6  
Old 13th July 2007, 03:23 AM
akvino Offline
Registered User
 
Join Date: Mar 2007
Posts: 73
Marko I tried setting my static address via etc/sys*/network-scripts/ifcfg-eth01 file

can you explain what does the entery in your example

NETWOR=192.168.0.0

not match


/etc/sysconfig/network file has a in it line:

GATEWAY=192.168.0.1
Reply With Quote
  #7  
Old 13th July 2007, 03:40 AM
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 6,032
Quote:
Originally Posted by akvino
Marko I tried setting my static address via etc/sys*/network-scripts/ifcfg-eth01 file

can you explain what does the entery in your example

NETWOR=192.168.0.0

not match


/etc/sysconfig/network file has a in it line:

GATEWAY=192.168.0.1
It shouldn't. that was a typo. I've fixed it
now by removing it from the ifcfg-eth2 file in my
post.

Mark
Reply With Quote
  #8  
Old 13th July 2007, 03:50 AM
akvino Offline
Registered User
 
Join Date: Mar 2007
Posts: 73
I played with ifcfg-eth0 trying to setup static address


I did everything correct but I lose network every time I set it up.

Is there any additional service/ file beside ifcfg-eth* - that should be modified

Is it apsolutely necesary to have entry for GATEWAY in the /network file
Reply With Quote
  #9  
Old 13th July 2007, 04:01 AM
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 6,032
No, /etc/sysconfig/network is for settings that are globally true for
all interfaces. If you like you can put the GATEWAY entry in
each interface ifcfg-* file separately. If you do that just don't also have it
in /etc/sysconfig/network.

BTW, why not just use the GUI network setup tool
system-config-network ?

In KDE, it's in the KDE task bar menu: Administration -> Network

In Gnome... I don't know, I don't use it.

When you say "lose the network" what does that mean?
Usually you should configure your network files, then
restart the network either with the system-config-network
(there's an "activate" button in there that you'd usually use
if you're in there anyway doing the configuration) or
you can just run as root:

# /etc/init.d/network restart



Mark

Last edited by marko; 13th July 2007 at 04:09 AM.
Reply With Quote
  #10  
Old 13th July 2007, 05:25 AM
akvino Offline
Registered User
 
Join Date: Mar 2007
Posts: 73
Quote:
Originally Posted by marko
No, /etc/sysconfig/network is for settings that are globally true for
all interfaces. If you like you can put the GATEWAY entry in
each interface ifcfg-* file separately. If you do that just don't also have it
in /etc/sysconfig/network.

BTW, why not just use the GUI network setup tool
system-config-network ?

In KDE, it's in the KDE task bar menu: Administration -> Network

In Gnome... I don't know, I don't use it.

When you say "lose the network" what does that mean?
Usually you should configure your network files, then
restart the network either with the system-config-network
(there's an "activate" button in there that you'd usually use
if you're in there anyway doing the configuration) or
you can just run as root:

# /etc/init.d/network restart



Mark
I prefer terminal due to the fact that SSH support might be needed one day, so practicing terminal means lot to me.

I was setting the system in school lab, I did not have GATEWAY entry but I did have NETWORK entry. I'll try to locate GATEWAY entry, just to see that I have it...
Reply With Quote
  #11  
Old 13th July 2007, 06:01 AM
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,809
Quote:
Originally Posted by akvino
I prefer terminal due to the fact that SSH support might be needed one day, so practicing terminal means lot to me.
Learn to use "ssh -Y".


IN the services tool, shut off NetworkManager and the NW-Dispatcher. Also consider shutting off avahi server too.
Reply With Quote
  #12  
Old 13th July 2007, 01:05 PM
akvino Offline
Registered User
 
Join Date: Mar 2007
Posts: 73
Steve can you elaborate pls?
Reply With Quote
  #13  
Old 14th July 2007, 12:43 AM
jawsmith Offline
Registered User
 
Join Date: Jun 2007
Location: Lees Summit, MO
Posts: 26
So I have somewhat given up. I created a script that I manually run that uses IPTABLES to forward all requests for port 80 to go to port 8080. I then added the manual IFCONFIG command to force the ip address and finally a ROUTE command to route it.

BTW, my UI always said it was a static IP and the /etc/sysconfig/network file ALSO had the static IP address in it and it says ONBOOT=Y... so, according to all the files and UI settings, everything is correct. I don't have any idea what it is.

But, now, my network connections are really slow. Web pages seem to time out on nearly everything. For example, I cannot get to this page on my server! Whereas, all my other computers work fine... any ideas? When I do a traceroute to www.fedoraforum.com, it shows no hops whatsoever...
Reply With Quote
  #14  
Old 14th July 2007, 03:22 AM
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 6,032
You do have this in your /etc/sysconfig/network-scripts/ifcfg-eth0
right?

BOOTPROTO=static

you need that set for doing static ip I think, the other values
that can have are dhcp and none

this shows what a typical static script looks like
(see the second gray boxed text under "Redhat's Scripts" in this URL):
http://www.jms1.net/ifcfg.shtml

Mark

Last edited by marko; 14th July 2007 at 03:28 AM.
Reply With Quote
  #15  
Old 14th July 2007, 03:35 AM
Iron_Mike Offline
Registered User
 
Join Date: Jul 2005
Location: Ft Huachuca, AZ
Posts: 3,772
BUT, also make sure in the startup scripts that you have:

# Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.1.255
HWADDR=00:62:F5:3A:43:46
IPADDR=192.168.1.105
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=no
GATEWAY=192.168.1.1
TYPE=Ethernet
USERCTL=yes <--This line, if not set to "allow user to enable/disable device, all the changes you make will not be saved.
IPV6INIT=no
PEERDNS=yes
Reply With Quote
Reply

Tags
address, static

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Static IP address cliftonbazaar Servers & Networking 6 8th April 2009 08:46 PM
How do I get a static IP address? C1ivey Servers & Networking 3 20th August 2006 12:23 PM
Static Set IP Address Roam Servers & Networking 5 27th July 2006 01:28 AM
static ip address jjordan2004 Servers & Networking 1 18th May 2006 04:55 AM
Static IP Address mmouer Servers & Networking 3 24th February 2006 08:40 PM


Current GMT-time: 06:56 (Tuesday, 02-09-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat