LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-05-2008, 06:54 AM   #1
zodehala
Member
 
Registered: Nov 2008
Posts: 53

Rep: Reputation: 15
static ip on CentOS (SIOCADDRT: File exists)


i am trying to give staic ip to centos5 so using following commands(as root)
first
Code:
ifconfig eth0 192.168.1.100 netmask 255.255.255.0
than
Code:
route add default gw 192.168.1.1 dev eth0
following error occured
Code:
SIOCADDRT: File exists
 
Old 11-05-2008, 07:34 AM   #2
hopbyhop
Member
 
Registered: Aug 2008
Posts: 52

Rep: Reputation: 15
Please post the output of "route" and ifconfig first
 
Old 11-05-2008, 07:50 AM   #3
zodehala
Member
 
Registered: Nov 2008
Posts: 53

Original Poster
Rep: Reputation: 15
Code:
[root@zode ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0


[root@zode ~]# netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.1.0     *               255.255.255.0   U         0 0          0 eth0
default         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
 
Old 11-05-2008, 07:54 AM   #4
hopbyhop
Member
 
Registered: Aug 2008
Posts: 52

Rep: Reputation: 15
As you can see you already have your gateway configured. No need to run route add...
 
Old 11-05-2008, 12:51 PM   #5
zodehala
Member
 
Registered: Nov 2008
Posts: 53

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by hopbyhop View Post
As you can see you already have your gateway configured. No need to run route add...
but i wanna change it how ?
 
Old 11-06-2008, 01:41 AM   #6
hopbyhop
Member
 
Registered: Aug 2008
Posts: 52

Rep: Reputation: 15
Code:
route del default
route add ....
 
Old 11-10-2008, 08:41 AM   #7
zodehala
Member
 
Registered: Nov 2008
Posts: 53

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by hopbyhop View Post
Code:
route del default
route add ....
wheneever i restart computer why does static ip change ?
 
Old 11-10-2008, 10:45 AM   #8
hopbyhop
Member
 
Registered: Aug 2008
Posts: 52

Rep: Reputation: 15
On reboot network settings are defined by initialization scripts. If changes you tried are good, you have to edit system's network configuration files. Either run (in the graphical environment from root) system-config-network or edit /etc/sysconfig/network and change the gateway or any other parameter you need.
In the latter case you need also to manually restart the network (/sbin/service network restart) to make changes effective.

Last edited by hopbyhop; 11-10-2008 at 10:47 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CentOS DHCP to Static mitchell2345 Linux - Networking 5 11-01-2008 10:38 AM
Determining IP information for eth0...SIOCADDRT: File exists c087 Linux - Networking 1 07-23-2006 08:06 AM
SIOCADDRT: File exists SIOCCADDRT: File Exists Failed to bring up eth0. opsraja Linux - Networking 0 01-10-2005 08:29 AM
dhcpcd warning (SIOCADDRT exists) jrdioko Linux - Networking 0 08-25-2004 05:15 PM
Linker problem: can't find a file, but the file exists atlep Programming 5 08-16-2004 06:15 AM


All times are GMT -5. The time now is 03:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration