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 |
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)
|
Quote:
|
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 |
Quote:
[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? |
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.) |
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. |
Quote:
Can you post you ifconfig -a ... Just curious. |
/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) |
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. |
Quote:
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) |
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. |
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 |
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? |
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. |
All times are GMT -5. The time now is 08:25 PM. |