Solved

Providing static ip address

Posted on 2004-04-14
6
2,292 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
Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Fail2ban says an IP is banned, but not 12 118
Lame BIND 9.3 10 58
ovirt web management page 1 71
How to identify SSH user interactive login? 15 78
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

27 Experts available now in Live!

Get 1:1 Help Now