Solved

Providing static ip address

Posted on 2004-04-14
6
2,282 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
6 Comments
 
LVL 17

Expert Comment

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

Accepted Solution

by:
kronostm earned 50 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now