LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 09-17-2009, 11:26 AM   #1
k00lit8
LQ Newbie
 
Registered: Sep 2009
Posts: 4

Rep: Reputation: 0
how to assign local ip in linux


Hi im newbie in linux i am going to install new lan card how can i assign local ip ? any step by step instructions on this? thanks
 
Old 09-17-2009, 11:30 AM   #2
damicatz
Member
 
Registered: May 2004
Distribution: FreeBSD 7, Debian "Squeeze", OpenBSD 4.5
Posts: 167

Rep: Reputation: 30
Quote:
Originally Posted by k00lit8 View Post
Hi im newbie in linux i am going to install new lan card how can i assign local ip ? any step by step instructions on this? thanks
Are we talking about a fixed (static) IP or one that's automatically configured via DHCP (say from a router or modem)?
 
Old 09-17-2009, 11:30 AM   #3
~sHyLoCk~
Senior Member
 
Registered: Jul 2008
Location: /dev/null
Posts: 1,173
Blog Entries: 12

Rep: Reputation: 129Reputation: 129
On what? mac OS? :O
 
Old 09-17-2009, 11:36 AM   #4
k00lit8
LQ Newbie
 
Registered: Sep 2009
Posts: 4

Original Poster
Rep: Reputation: 0
damicatz - Fixed static IP
~sHyLoCk~ - On linux OS
 
Old 09-17-2009, 11:51 AM   #5
damicatz
Member
 
Registered: May 2004
Distribution: FreeBSD 7, Debian "Squeeze", OpenBSD 4.5
Posts: 167

Rep: Reputation: 30
There should be a file called interfaces, net.eth0 or ifcfg-etho (to find it do find / -name eth|grep etc; it should be in etc) that you edit to assign static IPs. It's location can vary based on your distribution.

A basic configuration (at least in Debian/Ubuntu) would look something like this :

Code:
auto lo
iface lo inet loopback

iface eth0 inet static
  address x.x.x.x 
  netmask x.x.x.x  
  gateway x.x.x.x 
  up
Where address is the IP address, netmask is the subnet mask and gateway is the IP of your router (only if you are using one)

You then edit /etc/resolv.conf to set your DNS servers.

Note that this process may vary depending on your distribution.

Last edited by damicatz; 09-17-2009 at 01:33 PM.
 
Old 09-17-2009, 12:43 PM   #6
k00lit8
LQ Newbie
 
Registered: Sep 2009
Posts: 4

Original Poster
Rep: Reputation: 0
im using mac pc and my linux server is centos is that the right commands?
 
Old 09-17-2009, 01:36 PM   #7
damicatz
Member
 
Registered: May 2004
Distribution: FreeBSD 7, Debian "Squeeze", OpenBSD 4.5
Posts: 167

Rep: Reputation: 30
Quote:
Originally Posted by k00lit8 View Post
im using mac pc and my linux server is centos is that the right commands?
With CentOS you should just be able to run setup from the command line and configure your network adapter's ip address from there.

Alternatively, you can edit these two files :

(IP Addresses)
/etc/sysconfig/network-scripts/ifcfg-eth0
(Gateway)
/etc/sysconfig/network
 
Old 09-17-2009, 06:46 PM   #8
k00lit8
LQ Newbie
 
Registered: Sep 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks Damicatz
 
  


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
assign network interfaces to linux users? FireRaven Linux - Networking 4 04-29-2007 09:04 PM
Linux command to assign an ip address seb22 LinuxQuestions.org Member Intro 2 06-12-2005 03:19 AM
Linux command to assign an ip address seb22 Linux - Networking 5 05-24-2005 01:03 PM
Assign Drive Letter in Linux? UTKEngineer Linux - Newbie 3 10-28-2003 11:34 PM


All times are GMT -5. The time now is 11:38 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration