November 22, 2024, 06:06:32 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: changing IP Address thru ifconfig utility  (Read 22186 times)

Offline naresh

  • Linux Noob !
  • *
  • Posts: 5
changing IP Address thru ifconfig utility
« on: June 16, 2011, 01:30:25 PM »
I tried using "ifconfig eth0 192.168.0.201 up" command to change my ip address from 192.168.0.210 to 192.168.0.201 and it got changed, I confirmed it by using "ifconfig eth0" command, but when i entered "neat" command i found out that the ip address still remained 192.168.0.210. I want to know the reason why..??

Offline linux1986

  • Linux Noob !
  • *
  • Posts: 6
    • Linux Help
Re: changing IP Address thru ifconfig utility
« Reply #1 on: September 19, 2011, 11:16:30 AM »
You can edit the network script and restart the network demon

vi /etc/sysconfig/network-scripts/ifcfg-eth0 and edit it

and restart network service



« Last Edit: December 31, 2011, 05:46:39 AM by LS-Admin »

Offline naresh

  • Linux Noob !
  • *
  • Posts: 5
Re: changing IP Address thru ifconfig utility
« Reply #2 on: January 22, 2012, 06:07:51 AM »
I am really thankful to everyone who responded my query.
But i need to know that DO I have to restart the service every time when i change my ip address.
Is neat utility not updated with the ifconfig command ?
And manually editing a network script everytime is a little bit tedious job and for that you will have to remember the exact path of the file too.
Anyways thanks for your reply.

Offline ManiDhillon

  • Linux Noob !
  • *
  • Posts: 4
    • Randomness
Re: changing IP Address thru ifconfig utility
« Reply #3 on: January 22, 2012, 11:47:46 AM »
How is IP address assigned to your card in first place?
Through dhcpd or through any router you are using with it?

Because if your router is assigning you the ip then this won't help you and you have to stop the DHCP server on your router.
If you are using manual ip assignment then you best use a dhcp server on your machine and assign the required parameters to it.
And before running the link up you should first shut it down with
$ ifconfig eth0 down
« Last Edit: January 22, 2012, 11:49:23 AM by ManiDhillon »

Offline naresh

  • Linux Noob !
  • *
  • Posts: 5
Re: changing IP Address thru ifconfig utility
« Reply #4 on: January 25, 2012, 12:57:34 PM »
Thanks ManiDhillon
But in my case I need to assign IP address manually to the clients but what the tragic is that when i use a command
say "ifconfig eth0 192.168.0.201 up" it gets changed but if i go to the neat utility it does not come up. The neat utility shows the previous IP address which is "192.168.0.210" So therefore I am in a confusion why it is so ?
« Last Edit: January 25, 2012, 12:59:31 PM by naresh »

Offline ManiDhillon

  • Linux Noob !
  • *
  • Posts: 4
    • Randomness
Re: changing IP Address thru ifconfig utility
« Reply #5 on: January 26, 2012, 12:30:38 AM »
So do you out down the ethernet interface before putting it up with new ip?
$ ifconfig eth0 down
$ifconfig eth0 192.168.1.* up
And try restarting the network service.