Changing your IP and more in Red Hat.
by TheRealEdwin on 25/03/10 at 12:15 pm

- Image by afsilva via Flickr
I thought this would be a useful post for some of you out there. For only the second time in my professional career, I have encountered a Linux box in the workplace. This one was a VMWare ESX server running on top of an unknown install. To find out what version of Linux you run there are two ways.
First try
uname -a.
If that doesn’t work like it did for me, try
ls -l /etc/ | more
and you should see a folder there telling you what derivative you are using. In my case, I saw the RedHat folders there. So now you know what you are running. How do you change the IP? In windows it’s super easy, but with the console, you need to do a bit more. I like to use nano, but you can use whatever text editor you wish like emacs or vi.
This brings up the file that needs to be edited for the gateway of the network you are now on.
nano /etc/sysconfig/network
Now we have to edit the actual IP of the network card. In most cases, your NIC is going to be eth0. In my case, for whatever reason, it was named vswif0.
nano /etc/sysconfig/network-scripts/ifcfg-vswif0
Last thing to do now, is to change your DNS settings.
nano /etc/resolv.conf
For each entry of nameserver you see, just add the IP address of your DNS. Now it’s time to restart the network services so the settings can take effect. This also has two different ways of doing it.
/etc/init.d/network restart
or
service network restart
Once everything comes back as OK, let’s test it out by pinging Google.com or your gateway. If the pings come back successfully, then you are good to go. Of course all of this is only useful if you are using a static address which is great for servers, but to make things easier, DHCP may be better for your needs.
If you have any questions or comments, please leave a comment below. Start the conversation.
![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=b93a3eb8-dbd4-4b0a-a9dd-d048605d9421)

Sbobet
Apr 1st, 2010
Thanks a lot for a bunch of good tips. I look forward to reading more on the topic in the future. Keep up the good work! This blog is going to be great resource. Love reading it.
Electric Guitars For Kids
May 26th, 2010
Good weblog, just looking around some blogs, seems a pretty good platform you’re using. I’m presently using WordPress for a few of my sites but looking to alter one of them more than to a platform comparable to yours as a trial run. Anything in particular you would recommend about it?
Dougal
May 27th, 2010
Howdy,
the second comment here is spam (note how it uses keywords like WordPress, but otherwise it’s all boilerplate text…).