LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-16-2012, 07:37 PM   #1
student5
LQ Newbie
 
Registered: Jun 2012
Posts: 1

Rep: Reputation: Disabled
how do I change ip and gateway addresses in linux


How do I change IP and gateway addresses in Linux. I'm currently using Redhat

Last edited by student5; 06-16-2012 at 07:48 PM. Reason: needed more info
 
Old 06-16-2012, 07:43 PM   #2
whysoserious
Member
 
Registered: May 2012
Location: London
Distribution: Debian and slackware for uni
Posts: 61

Rep: Reputation: Disabled
Which distro are you using?
 
Old 06-16-2012, 08:03 PM   #3
whysoserious
Member
 
Registered: May 2012
Location: London
Distribution: Debian and slackware for uni
Posts: 61

Rep: Reputation: Disabled
In redhat I think the script for that is in /etc/sysconfig/network-scripts. For eth0 edit the ifcfg-eth0 file. Is it on dynamic assignment at the moment?
 
Old 06-16-2012, 11:28 PM   #4
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Rep: Reputation: 91
Run the following command in a terminal window:
ifconfig
Look at the line that has "Link encap:Ethernet". The alphanumeric right before that -- in my case "p5p1" -- is the suffix of the file you want to edit in /etc/sysconfig/network-scripts. In my case that's /etc/sysconfig/network-scripts/ifcfg-p5p1. Open a text editor like "gedit" and open the aforementioned file. Edit the line that says "GATEWAY=" with an ip address at the end by changing it to whatever gateway ip you want to use for the gateway. You might also need to edit /etc/sysconfig/network the same way. Restart networking.
EDIT: I forgot to mention changing your ip is done with the same files. Don't forget you have to either restart networking or reboot for the changes to take effect.

Last edited by SharpyWarpy; 06-16-2012 at 11:36 PM. Reason: Forgot something
 
Old 06-17-2012, 12:30 AM   #5
linuxreza
Member
 
Registered: Jan 2012
Location: Mumbai, India
Distribution: Redhat
Posts: 30
Blog Entries: 1

Rep: Reputation: Disabled
you can use the setup command in command line .

it will give you the option to change the ip address and DNS as well..
 
Old 06-17-2012, 12:46 AM   #6
mannmaniyar
LQ Newbie
 
Registered: Apr 2009
Posts: 22

Rep: Reputation: 0
In redhat you can also use "system-config-network"

It ubuntu you need to edit /etc/network/interfaces file and below lines

# vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address x.x.x.x
netmask x.x.x.x
network x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Gateway Bandwidth monitor, restrict IP addresses in LAN mrkagz Linux - Networking 2 10-28-2007 04:05 AM
dhcpd to lease IP addresses depending gateway jlbocanegra Linux - Networking 1 05-28-2006 02:43 PM
tcpdump, dhcpcd and recieving many listings of addresses and the correct gateway and starlypt Linux - Networking 1 09-16-2005 09:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration