Solved

Providing static ip address

Posted on 2004-04-14
6
2,323 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 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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 

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

Containers and Docker for Everyone

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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