LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   IP Address (https://www.linuxquestions.org/questions/linux-newbie-8/ip-address-696118/)

kapilbajpai88 01-09-2009 11:36 AM

IP Address
 
Hi All,

Could anybody please let me know where all the IP addresses get stored in Linux?
How can we change the IP address in Linux...

Thanks in advance,
Kapil.

AuroraCA 01-09-2009 11:46 AM

IP address is set differently depending upon the distribution of Linux you are using.

This site explains the different configurations:

http://www.yolinux.com/TUTORIALS/Lin....html#ASSIGNIP

repo 01-09-2009 11:46 AM

/etc/network/interfaces

Quote:

How can we change the IP address in Linux...
take a look at man ipconfig and man iwconfig

Uncle_Theodore 01-09-2009 11:46 AM

What is your distribution? Usually, the IP address of an interface is stored in a configuration file, that deals with networking. For example, in Slackware, it's /etc/rc.d/rc.inet1.conf In other distributions it's different.
Usually, there are tools to change the IP and other things without editing these files directly. Like the netconfig in Slackware.

jamescondron 01-09-2009 12:12 PM

I think you need to do some research into IP Addresses, or more specifically how you're getting your IP Address. Are you using DHCP? If so, where ever your DHCP server (or zero-config stuff) is, thats where you want to change it. If you're setting your own IP address, and not using DHCP, /etc/networks/interfaces is the place to look.

You can set it with ifconfig, too.

What do you need to change it for?

kapilbajpai88 01-09-2009 12:38 PM

Quote:

Originally Posted by AuroraCA (Post 3402559)
IP address is set differently depending upon the distribution of Linux you are using.

This site explains the different configurations:

http://www.yolinux.com/TUTORIALS/Lin....html#ASSIGNIP



Hi there,
thank you for the response...i will check the portal, and if requred then will get back again...

Thankx again,
kapil.

kapilbajpai88 01-09-2009 12:40 PM

Quote:

Originally Posted by Uncle_Theodore (Post 3402563)
What is your distribution? Usually, the IP address of an interface is stored in a configuration file, that deals with networking. For example, in Slackware, it's /etc/rc.d/rc.inet1.conf In other distributions it's different.
Usually, there are tools to change the IP and other things without editing these files directly. Like the netconfig in Slackware.


hi There,
I am using RHEL5, and as you have already told us thta it depends upon distribution, so what could be the location for rhel5?

Thankx,
Kapil.

kapilbajpai88 01-09-2009 12:46 PM

Quote:

Originally Posted by jamescondron (Post 3402582)
I think you need to do some research into IP Addresses, or more specifically how you're getting your IP Address. Are you using DHCP? If so, where ever your DHCP server (or zero-config stuff) is, thats where you want to change it. If you're setting your own IP address, and not using DHCP, /etc/networks/interfaces is the place to look.

You can set it with ifconfig, too.

What do you need to change it for?

Hi There,

I am using rhel5 and i already tried ifconfig, but it is not working at all. Ipconfig is not good for linux at all. I tried accessing /etc/network/interfaces as well, but there is no such route either with user or with root...

What should I do?

Regards,
Kapil.

David1357 01-09-2009 12:55 PM

Quote:

Originally Posted by kapilbajpai88 (Post 3402619)
I am using rhel5 and i already tried ifconfig, but it is not working at all.

Make sure you are not running a DHCP client for that interface:
Code:

[machine:~]:ps aux | grep dhc
dhcp      3004  0.0  0.0  2396  564 ?        S<s  13:36  0:00 dhclient3 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp3/dhclient.eth0.leases eth0
root      4919  0.0  0.0  2800  764 pts/0    S+  13:48  0:00 grep dhc
[machine:~]:kill -9 3004
[machine:~]:ifconfig eth0 N.N.N.N netmask M.M.M.M

This syntax assumes you are logged in as root. "N.N.N.N" should be replaced by your desired IP address (for example 192.168.1.128) and "M.M.M.M" should be replaced by the desired subnet mask (for example 255.255.255.0).

This will not be persistent across reboots. If you need to make your changes permanent, look at the file named
Code:

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


All times are GMT -5. The time now is 10:57 AM.