LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-10-2004, 11:26 PM   #1
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Rep: Reputation: 30
Elementary IP question


This is a very basic question so feel free to tell me to RTFM- point me at a tutorial or something.

I have three PC's connected to a linksys router. Everything works fine, but based on which one is turned on first, they get different ip addresses on the lan. How do I make them stick to thier ip address? I want:

windows box: 192.168.1.100
linux 1: 192.168.1.101
linux 2: 192.168.1.102

TIA
 
Old 03-10-2004, 11:32 PM   #2
Qzukk
Member
 
Registered: Jun 2003
Posts: 132

Rep: Reputation: 15
You need to change their configuration from a dynamic IP assigned by DHCP ("get IP address automatically" in windows) to the appropriate static IP. Also double-check your router configuration to make sure it will allow static IPs (most will have some blank where you can say that you have 100-102 assigned statically, so it won't try to give those IPs out to any other computers)
 
Old 03-10-2004, 11:50 PM   #3
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by Qzukk
You need to change their configuration from a dynamic IP assigned by DHCP ("get IP address automatically" in windows) to the appropriate static IP.
Thanks but where do I change that configuration- what file?
 
Old 03-11-2004, 01:43 AM   #4
pingswept
Member
 
Registered: May 2003
Location: Cambridge, MA
Distribution: SuSE, RedHat, and OpenBSD
Posts: 116

Rep: Reputation: 15
On Redhat 9, you'd look in:

/etc/sysconfig/network-scripts/ifcfg-eth0

For most distros, you can get interface status by typing:
/sbin/ifconfig -a
 
Old 03-11-2004, 02:10 AM   #5
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by pingswept
On Redhat 9, you'd look in:

/etc/sysconfig/network-scripts/ifcfg-eth0

For most distros, you can get interface status by typing:
/sbin/ifconfig -a

[rotwang@localhost network-scripts]$ vi ifcfg-eth0
# 3Com Corporation|3c905B 100BaseTX [Cyclone]
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:10:5A:E7:5E:FC
ONBOOT=yes
TYPE=Ethernet


thanks... now what?
 
Old 03-11-2004, 02:24 AM   #6
pingswept
Member
 
Registered: May 2003
Location: Cambridge, MA
Distribution: SuSE, RedHat, and OpenBSD
Posts: 116

Rep: Reputation: 15
Here's what my ifcfg-eth0 looks like:

DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
PEERDNS=no
TYPE=Ethernet
IPADDR=192.168.1.107
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
NETWORK=192.168.1.0
BROADCAST=192.168.1.255

You definitely need my last 5 lines (IPADDR through BROADCAST) in your file, and you want to set your BOOTPROTO line to none instead of dhcp. I'm not sure what USERCTL and PEERDNS do.

The 192.168.1.0 address space is reserved for local networks like yours (and mine), so you don't need to worry about using the same address as me. The IPs you listed earlier are fine.

Make the changes to the file, reboot, and then try:

/sbin/ifconfig -a

to see the status of your interfaces. If you see the word "up," that's good. (Try visiting a webpage too.)

Also try:

ping 192.168.1.1

If nothing works, check that you have the right driver loaded:

/sbin/lsmod

(Your driver could also be compiled into your kernel if lsmod doesn't find it.)
 
Old 03-11-2004, 02:46 AM   #7
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
Ok, I made the changes as follows and rebooted, but nothing changed- the ip is still the same and I'm still on the network ok (can ping or get web pages). (I am on fedora, btw):

# 3Com Corporation|3c905B 100BaseTX [Cyclone]
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:10:5A:E7:5E:FC
ONBOOT=yes
TYPE=Ethernet
PEERDNS=no
IPADDR=192.168.1.108
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
NETWORK=192.168.1.0
BROADCAST=192.168.1.255

and here is sbin/lsmod:

@localhost network-scripts]$ /sbin/lsmod
Module Size Used by Not tainted
parport_pc 19076 1 (autoclean)
lp 9060 0 (autoclean)
parport 37056 1 (autoclean) [parport_pc lp]
ide-cd 35776 0 (autoclean)
cdrom 33728 0 (autoclean) [ide-cd]
autofs 13364 0 (autoclean) (unused)
3c59x 31280 1
ipt_REJECT 4344 1 (autoclean)
ipt_state 1080 6 (autoclean)
ip_conntrack 29256 1 (autoclean) [ipt_state]
iptable_filter 2444 1 (autoclean)
ip_tables 15776 3 [ipt_REJECT ipt_state iptable_filter]
floppy 58012 0 (autoclean)
sg 36492 0 (autoclean)
microcode 4700 0 (autoclean)
keybdev 2976 0 (unused)
hid 24708 0 (unused)
usb-uhci 26380 0 (unused)
usbcore 79168 1 [hid usb-uhci]
mousedev 5556 1 (autoclean)
input 5888 0 (autoclean) [keybdev hid mousedev]
ext3 71300 1
jbd 52084 1 [ext3]
aic7xxx 167280 4
sd_mod 13708 8
scsi_mod 108104 3 [sg aic7xxx sd_mod]

btw do you have a linksys router? just curious because then we have basically the same setup- redhat and linksys routers.
 
Old 03-11-2004, 08:04 AM   #8
paintcheck200
Member
 
Registered: Sep 2003
Location: Michigan
Distribution: Gentoo, Knoppix
Posts: 69

Rep: Reputation: 15
Quote:
and I'm still on the network ok (can ping or get web pages).
The changes you made should allow you to still be on the network and browse etc.

Can you post you ifconfig -a ... Just curious.
 
Old 03-11-2004, 12:10 PM   #9
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
/sbin/ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:10:5C:E7:5E:FC
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:627 errors:0 dropped:0 overruns:0 frame:0
TX packets:430 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:53910 (52.6 Kb) TX bytes:56260 (54.9 Kb)
Interrupt:10 Base address:0x1400

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2359 errors:0 dropped:0 overruns:0 frame:0
TX packets:2359 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2456440 (2.3 Mb) TX bytes:2456440 (2.3 Mb)
 
Old 03-11-2004, 01:20 PM   #10
pingswept
Member
 
Registered: May 2003
Location: Cambridge, MA
Distribution: SuSE, RedHat, and OpenBSD
Posts: 116

Rep: Reputation: 15
Hi Rotwang,
It looks like your IP has been changed successfully:

inet addr:192.168.1.101

What makes you think that it didn't work?

And yes, I have a Linksys router.
 
Old 03-11-2004, 01:36 PM   #11
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by pingswept
Hi Rotwang,
It looks like your IP has been changed successfully:

inet addr:192.168.1.101

What makes you think that it didn't work?

And yes, I have a Linksys router.

101 was what it was before. (If you scroll up and look at my ifcfg-eth0, I was trying to set it to IPADDR=192.168.1.108)
 
Old 03-11-2004, 01:46 PM   #12
pingswept
Member
 
Registered: May 2003
Location: Cambridge, MA
Distribution: SuSE, RedHat, and OpenBSD
Posts: 116

Rep: Reputation: 15
Ack, you're right.

How about this as root:

/sbin/ifconfig eth0 192.168.1.108

Then:

/sbin/ifconfig -a

to see if it worked. This won't fix your problem permanently, but it's a start. You might also try:

locate ifcfg-eth0

There are several different versions of the ifcfg-eth0 file; I'm not sure which take precedence of over the others. I have three versions in various subdirectories of /etc/sysconfig.
 
Old 03-11-2004, 02:01 PM   #13
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
well, /sbin/ifconfig eth0 192.168.1.108 worked (it was funny because I was sshed into the machine when I did it hehe), but as for locate ifcfg-eth0 all I got was the one:

locate ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth0
 
Old 03-11-2004, 04:41 PM   #14
pingswept
Member
 
Registered: May 2003
Location: Cambridge, MA
Distribution: SuSE, RedHat, and OpenBSD
Posts: 116

Rep: Reputation: 15
Hi Rotwang,

Here are the three that appear on my machine:

/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/networking/devices/ifcfg-eth0
/etc/sysconfig/networking/profiles/default/ifcfg-eth0

Have you tried running redhat-config-network?
 
Old 03-11-2004, 04:44 PM   #15
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
got it

pingswept thanks for your persistence and patience. I figured it out. It was me. (of course).

What happend was, when I edited ifcfg-eth0, I made a copy if it first, in the same dir. What I didn't know is that everything in that directory gets run. I was thinking it was like other conf files like fstabs or httpd.conf, where you should make a ".old" copy before you make changes, in case you screw something up. The name of the copy I made was aphabetically greater than "ifcfg-eth0", so it was running after ifcfg-eth0 ran, and therefore overriding it.

Curiously, the way I found out about this was I tried to do the same thing on my Mandrake box, and during reboot it listed the copy file and said "sorry, eth0 is already setup, not running this config". Redhat doesn't do that check, it just runs whatever. Interesting, right? Chalk one up for Mandrake.

anyway thanks again.
 
  


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
[SOLVED] Elementary Bash Scripting Question Eternal_Newbie Slackware 2 08-25-2005 06:40 PM
Question, Apples Contribution to Open Source + MacOs file structure question Higgy3k Other *NIX 5 07-25-2005 04:23 AM
Elementary Question - Can't Edit File - Need Root rrrssssss Linux - Newbie 2 04-12-2005 03:05 AM
Does anyone have hardware for my elementary school classroom? tuxthelinuxpeng Linux - Hardware 0 04-05-2004 06:48 PM
newbie - with elementary smotthwall issues ... wont work! linux_latino Linux - Security 1 09-09-2003 12:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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