LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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-2010, 11:18 AM   #1
Quinlan
LQ Newbie
 
Registered: Jul 2010
Location: Kalamazoo, MI
Distribution: Ubuntu 10.04 / CentOS 5.5
Posts: 24

Rep: Reputation: 1
Set Static IP


Hello.

I am a student trying to set a static IP for 4 computers in a university laboratory. These computers have been assigned host names (i.e. owl.ceas.wmich.edu) and I need to change the IPs to the static IPs assigned to each of the host names.

I'm having some trouble getting this accomplished, as I have zero experience with this sort of thing. I am using both CentOS 5.5 and Ubuntu 10.04.

The Ubuntu computer has the static IP address: 141.218.142.150

I tried to change the IP using the guide here:
http://www.cyberciti.biz/tips/howto-...iguration.html

It has me adding the following to the /etc/network/interfaces file:

Code:
iface eth0 inet static
address 141.218.142.150
netmask 255.255.255.0
broadcast 141.218.142.255 ?
network 141.218.142.0 ?
gateway 141.218.148.1 ?
I put question marks next to the lines that I am not sure of. I was given only the new IPs in an email. I got the net mask from
'ifconfig eth0'. I tried to look up the broadcast IP, network ID and gateway online, and this is what I came up with.

The next step is to go to /etc/resolv.conf
I am supposed to change my name server, but I don't know what to change it to.

I'm rather lost in this. Any help would be much appreciated.
 
Old 09-17-2010, 11:39 AM   #2
netmar
LQ Newbie
 
Registered: Jul 2004
Location: Durham, NC
Distribution: Ubuntu 10.04 (I'd rather use Gentoo)
Posts: 23

Rep: Reputation: 3
Actually, that's almost all right.

The netmask is the code to "cover up" part of your address to determine what constitutes a "local" (no router needed) network block. The network is the specification of that same block, and the broadcast is the inverse of the network. The gateway is the address used to connect to anything that is not on the local network block.

In your case, you have a slight problem in that the gateway is set to a IP address outside of your local network, which consists of all 254 addresses starting with 141.218.148. I'm guessing that might be a typo, but if not, it really ought to either be 141.218.142.1, or you need to modify all the other values to give access to the gateway address.

So a solution might look something like this:

iface eth0 inet static
address 141.218.142.150
netmask 255.255.0.0
broadcast 141.218.255.255
network 141.218.0.0
gateway 141.218.148.1

Note that this is the entire address block assigned to Western Michigan (or at least one of them), so unless the whole campus is running on a single LAN/VLAN, it's probably a suboptimal solution.

Unfortunately, all that I can tell you about your nameserver is what's in the public record for wmich.edu, which lists only one nameserver at 141.218.1.104. This should at least give you access to the rest of the internet and most of the campus machines -- I can't really say if it's the one that you're supposed to use.
 
Old 09-17-2010, 11:40 AM   #3
Ryan10
Member
 
Registered: Aug 2010
Posts: 71

Rep: Reputation: 0
Did you try using the command netconfig...
 
Old 09-17-2010, 11:53 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,386

Rep: Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336
So are we, because we don't know fully what you're trying to do. The broadcast line above looks ok, the last 2 you might not need. Beware that red hat (Centos) offers /etc/rc.d/init.d/network as a network connection script which they don't support, and /etc/rc.d/init.d/NetworkManager which they theoretically do support, and each uses different files.

How are you connecting - dhcp? pppoe?
Your provider will supply a dns 1 & 2 for resolv.conf unless you're running your own dns server. If you're going live on the internet, get a serious IT guy to sort the details. It's good to get everything behind a firewall, use NAT, etc. because the internet is a nasty place. My misconfigured router allowed access to port 22 while dhcp had assigned me one particular IP address. My logs began to fill up with hack attempts as scripts tried to log in. My son with a Bsce had a port open also and his vista box was rootkitted :-/.
 
Old 09-17-2010, 12:23 PM   #5
Quinlan
LQ Newbie
 
Registered: Jul 2010
Location: Kalamazoo, MI
Distribution: Ubuntu 10.04 / CentOS 5.5
Posts: 24

Original Poster
Rep: Reputation: 1
I am trying to have this computer set up with an SSH server, so I can access it remotely. I believe it is a dhcp connection.

netconfig didn't work for the ubuntu machine that I'm on. I googled the command and it looks like it would work on the CentOS system (?).

The professor who's lab I am setting up is pretty good with linux. I'll just ask him since you think that making a mistake with this could potentially be harmful.

Thanks for the help

Last edited by Quinlan; 09-17-2010 at 12:26 PM.
 
Old 09-17-2010, 12:26 PM   #6
netmar
LQ Newbie
 
Registered: Jul 2004
Location: Durham, NC
Distribution: Ubuntu 10.04 (I'd rather use Gentoo)
Posts: 23

Rep: Reputation: 3
Oops, sorry, I'm a moron. You did give the hostname, so the two nameservers that I would assign would be the two that seem to be assigned to the department, so your resolv.conf should look like this:

nameserver 141.218.1.100
nameserver 141.218.20.114
nameserver 141.218.1.104

With the third line for "just in case." And Ryan10 is right, as far as the CentOS machines are concerned. You still need all the right addresses, but if you use netconfig, it will ask you for them and save them in the appropriate places.

Come to think of it, you could the NetworkManager applet for the same thing in Ubuntu, if you have it running. It should be the little icon somewhere in the upper right of the screen that says "Network connection" when you mouse-over. Just click on it, click "Configure" and, again, enter the same data.
 
Old 09-17-2010, 12:44 PM   #7
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7/10
Posts: 893

Rep: Reputation: 119Reputation: 119
I agree with netmar. Fixing the netmask might fix the issue. Are these server headless (no desktop) If you have the gnome desktop you can go to System > Preferences > Network Connections and configure it there with out touching the command line. Easy way out. But your IPs still have to sync up with each other

Here are some definitions of the address to help you understand

IP: The physical IP of the machine
subnet mask: determines the range of your network or class of the network
broadcast: max IP of the network
network: the start of the network.
Gateway: The IP of the machine that the computer connects through

Somebody feel free to correct me if I wrong or make my terms more simple.
 
Old 09-17-2010, 01:52 PM   #8
Quinlan
LQ Newbie
 
Registered: Jul 2010
Location: Kalamazoo, MI
Distribution: Ubuntu 10.04 / CentOS 5.5
Posts: 24

Original Poster
Rep: Reputation: 1
I just had an IT guy come down from the university. It looks like it was something on their end. Once I get everything resolved, I'll post it for future reference.

Thanks for the help, guys.
 
Old 09-18-2010, 04:11 AM   #9
chris_thugs06
LQ Newbie
 
Registered: Sep 2010
Posts: 1

Rep: Reputation: 0
How to log as as root in freebsd
 
Old 09-18-2010, 04:18 AM   #10
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7/10
Posts: 893

Rep: Reputation: 119Reputation: 119
@chris Don't hijack threads. Create a new one. Also google is your best friend.
 
  


Reply



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
Problem to set static IP satimis Linux - Virtualization and Cloud 10 12-15-2009 02:10 AM
how do i set a static ip? ninja master Slackware 9 11-20-2008 08:15 PM
How to set Static IP? maverick_29 Linux - Networking 4 05-25-2007 01:07 AM
How to set static IP in Suse 10 leupi SUSE / openSUSE 4 02-19-2006 09:50 PM
FC2 Overriding static if in favor of dhcp system set for static pkraus109 Linux - Networking 8 09-21-2004 11:13 AM

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

All times are GMT -5. The time now is 04:40 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