?
Solved

Providing static ip address

Posted on 2004-04-14
6
Medium Priority
?
2,328 Views
Last Modified: 2010-03-18

 Hi,

    I have set the dhcp to provide the ip address to my linux machine while installing. Now that i want to give the ip address manually. How can i acheive it.

Many Thanks.
0
Comment
Question by:mkcharan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 17

Expert Comment

by:owensleftfoot
ID: 10822885
What distro are you using?
0
 
LVL 14

Accepted Solution

by:
kronostm earned 150 total points
ID: 10823831
basically that's all you have to do :
ifconfig eth0 xxx.yyy.zzz.ttt netmask 255.255.255.0 up
where xxx.yyy.zzz.ttt is the desired IP address and I assumed a 255.255.255.0 network mask, but you can change it to whatever fits your network.
0
 
LVL 5

Expert Comment

by:brabard
ID: 10835106
Basically kronostm is right , typing ifconfig command will change your ip address and netmask , but you have to obtain at least 3 things via dhcp to access Internet - ip address/mask , default gw & dns server .
You can do it manually by 3 steps :
1. ifconfig as kronostm said ;
2. route del defaul (it is just in case the new address is in the same network but in other subnetwork)
   route add default gw xxx.yyy.zzz.ttz
3. Edit your /etc/resolv.conf with putting at the top row "nameserver www.xxx.yyy.zzz"

But if you want to save the static setting after reboot , you have to edin config files , that are different , depending to your Linux distibution .
0
Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

 

Author Comment

by:mkcharan
ID: 10851362


 Hi,

      Thanks for the answers. I was able to change my ip address as desired. But as brabard told it changes after the reboot. so what are the files that i have to edit to keep the ip address permanent.
I have Redhat Linux 9 distribution. And if you need further details i am ready to provide.

 Many Thanks & Regards
 Murugan Kalicharan S
0
 
LVL 1

Expert Comment

by:terabiteau
ID: 10992611
You will need to modify this file ...

/etc/sysconfig/network-scripts/ifcfg-eth0

and it should look like this ...

DEVICE=eth0
IPADDR=x.x.x.x
NETMASK=255.255.255.0
ONBOOT=yes

Note that the NETMASK must match what ever your ISP specifies - I have just shown the most common form.

Good luck!
0
 
LVL 1

Expert Comment

by:JohnnyLingo
ID: 10998262
Don't forget to set a default gateway with a "GATEWAY=" line, either in this file or in /etc/sysconfig/network.  And set the DNS domain name and servers in /etc/resolv.conf, like

search mydomain.com
nameserver 1.2.3.4
nameserver 1.2.4.9

Also, if this is just a workstation or non-critical server why not continue to use DHCP with a reserved IP address?  Makes your life much easier, since if the default GW or DNS servers ever change you will pick up the settings automatically.  This is strongly recommend if you are in a predominately Windows 2000 network, since the hostname will get registered in DNS.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question