LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-09-2005, 06:30 PM   #1
blackdragonblood
Member
 
Registered: May 2005
Location: Minneapolis, MN
Distribution: Debian
Posts: 217

Rep: Reputation: 30
Getting Wrong IP


In Linux I get a 192.x address which is a bad IP for my network. When I boot into windows, I get a 172.x address which is a good IP. I didn't change anything w/ networking. One day it worked fine, the next day networking doesn't work in Linux. Could some 1 plz lend a helping hand? Thank you.
 
Old 06-09-2005, 07:23 PM   #2
Sharaz
Member
 
Registered: Jun 2005
Location: Dallas, TX
Distribution: Fedora 11,12, RedHat4,6, CentOS4,5, FreeBSD7,8
Posts: 70

Rep: Reputation: 16
what is the contents of the file /etc/sysconfig/network-scripts/ifcfg-eth0 say?
 
Old 06-09-2005, 07:27 PM   #3
blackdragonblood
Member
 
Registered: May 2005
Location: Minneapolis, MN
Distribution: Debian
Posts: 217

Original Poster
Rep: Reputation: 30
DEVICE-eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
 
Old 06-09-2005, 07:33 PM   #4
Sharaz
Member
 
Registered: Jun 2005
Location: Dallas, TX
Distribution: Fedora 11,12, RedHat4,6, CentOS4,5, FreeBSD7,8
Posts: 70

Rep: Reputation: 16
i would reboot it, and scroll back thru /var/log/messages and see if there is anything about what server handed you the ip address. i dont know if it will be there, but its a good place to start.
 
Old 06-09-2005, 08:04 PM   #5
blackdragonblood
Member
 
Registered: May 2005
Location: Minneapolis, MN
Distribution: Debian
Posts: 217

Original Poster
Rep: Reputation: 30
Here is the first time I see this bad IP showing up. Can I have some help interperting this? Is there more info I can post?









Jun 9 16:10:36 localhost dhclient: DHCPOFFER from 192.168.0.1
Jun 9 16:11:07 localhost kernel: PCI: Enabling device 0000:00:08.0 (0000 -> 0003)
Jun 9 16:10:36 localhost dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
Jun 9 16:11:07 localhost kernel: ACPI: PCI Interrupt Link [LNK6] enabled at IRQ 10
Jun 9 16:10:36 localhost dhclient: DHCPNAK from 172.17.1.12
Jun 9 16:11:07 localhost kernel: PCI: setting IRQ 10 as level-triggered
Jun 9 16:10:36 localhost dhclient: DHCPACK from 192.168.0.1
Jun 9 16:11:07 localhost kernel: ACPI: PCI interrupt 0000:00:08.0[A] -> GSI 10 (level, low) -> IRQ 10
Jun 9 16:10:36 localhost NET: /sbin/dhclient-script : updated /etc/resolv.conf
Jun 9 16:11:08 localhost kernel: ttyS47 at I/O 0x1428 (irq = 10) is a 8250
Jun 9 16:10:36 localhost dhclient: bound to 192.168.0.109 -- renewal in 292823 seconds.
Jun 9 16:11:08 localhost kernel: ttyS50 at I/O 0x1440 (irq = 10) is a 8250
Jun 9 16:10:36 localhost ifup: done.
Jun 9 16:11:08 localhost kernel: ttyS52 at I/O 0x1450 (irq = 10) is a 8250
Jun 9 16:10:46 localhost NET: /etc/sysconfig/network-scripts/ifup-post : updated /etc/resolv.conf
Jun 9 16:11:08 localhost kernel: ttyS54 at I/O 0x1460 (irq = 10) is a 8250
Jun 9 16:10:46 localhost network: Bringing up interface eth0: succeeded
Jun 9 16:11:08 localhost kernel: ttyS56 at I/O 0x1470 (irq = 10) is a 8250
Jun 9 16:10:46 localhost ifup:
Jun 9 16:11:08 localhost kernel: io scheduler noop registered
Jun 9 16:10:46 localhost ifup: Determining IP information for eth1...
Jun 9 16:11:09 localhost kernel: io scheduler anticipatory registered
Jun 9 16:10:47 localhost dhclient: DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 8
Jun 9 16:11:09 localhost kernel: io scheduler deadline registered
Jun 9 16:10:47 localhost dhclient: DHCPOFFER from 192.168.0.1 <30>Jun 9 16:10:47 dhclient: DHCPREQUEST on eth1 to 255.255.255.255 port 67
Jun 9 16:11:09 localhost kernel: io scheduler cfq registered
Jun 9 16:10:47 localhost dhclient: DHCPNAK from 172.17.1.12
Jun 9 16:11:09 localhost kernel: RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize
 
Old 06-09-2005, 08:14 PM   #6
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 58
What are you getting the dhcp lease from, a router, a modem? You should be able to set it up so it only gives out leases on 192.168.1.0/192.168.1.100 or something like that.
 
Old 06-09-2005, 09:27 PM   #7
blackdragonblood
Member
 
Registered: May 2005
Location: Minneapolis, MN
Distribution: Debian
Posts: 217

Original Poster
Rep: Reputation: 30
I'm on a collage campus. My guess is that someone setup a wireless router backwards so that I'm getting my DHCP from them and not from the collage DHCP server. We have had this problem before, but this doesn't explain why I get a good IP running windows and my laptop (plugged into the same switch) setting next to me can't get a good IP. I get the same results on both machines only when I boot into linux. I thought it was a bad router setup until I booted into windows and got a good IP.
 
Old 06-10-2005, 06:46 AM   #8
Sharaz
Member
 
Registered: Jun 2005
Location: Dallas, TX
Distribution: Fedora 11,12, RedHat4,6, CentOS4,5, FreeBSD7,8
Posts: 70

Rep: Reputation: 16
wireless nic?

it could be that in windows, the preferred network settings prevent you from getting onto some other unsecured network. if your using wireless in linux, sounds like you need to dink with your SSID and preferred network settings.
 
Old 06-10-2005, 07:04 AM   #9
demian
Member
 
Registered: Apr 2001
Location: Bremen, Germany
Distribution: Debian
Posts: 303

Rep: Reputation: 30
When it's obvious that the server 192.168.0.1 is not the dhcp server you want, why not just block dhcp packets from that server (or flat out anything) with iptables?
 
Old 06-10-2005, 07:15 AM   #10
blackdragonblood
Member
 
Registered: May 2005
Location: Minneapolis, MN
Distribution: Debian
Posts: 217

Original Poster
Rep: Reputation: 30
The only problem w/ that is that I'm a newbie and I don't understand iptables yet.
 
Old 06-10-2005, 07:34 AM   #11
kees-jan
Member
 
Registered: Sep 2004
Distribution: Debian, Ubuntu, BeatrIX, OpenWRT
Posts: 273

Rep: Reputation: 30
DHCP works such that clients can remember for a little time their old ip, and then, when they ask for a new one, they ask if they can please have the same one again.

Your logs show two dhcp servers, one in 172, one in 192. Your linux box asks for a 192 address, and then the 172 server says "no, you can't", while 192 says "that's ok". And then linux proceeds to use the ip.

You could make linux forget its old ip by removing the file /var/lib/dhcp/dhclient.leases. Then it will take an ip from the first dhcp server that responds. I just hope its your campusses ;-)

Groetjes,

Kees-Jan
 
Old 06-10-2005, 09:19 AM   #12
demian
Member
 
Registered: Apr 2001
Location: Bremen, Germany
Distribution: Debian
Posts: 303

Rep: Reputation: 30
Quote:
Originally posted by blackdragonblood
The only problem w/ that is that I'm a newbie and I don't understand iptables yet.
As root do this:

iptables -I INPUT 1 -s 192.168.0.1 -j DROP

This throws away any packet coming from the host with IP 192.168.0.1 and is destined for your computer. Seeing that the network you are in (or want to be in) isn't 192.168.0.0 you could (and probably should) throw out anything from misconfigured hosts anyway. For example:

iptables -A INPUT -s 192.168.0.0/16 -j DROP
iptables -A INPUT -s 10.0.0.0/8 -j DROP

There are better ways to do this but you should familiarize yourself with iptables first. Until then just use the rules above.
 
Old 06-10-2005, 11:53 AM   #13
setenv02
Member
 
Registered: Apr 2005
Location: Chicago,IL
Distribution: redhat 9
Posts: 32

Rep: Reputation: 15
Try running netconfig and choose the option for dhcp. Otherwise you can set it manually
 
Old 06-10-2005, 04:50 PM   #14
blackdragonblood
Member
 
Registered: May 2005
Location: Minneapolis, MN
Distribution: Debian
Posts: 217

Original Poster
Rep: Reputation: 30
I got it to work. Big thanks for your help. Here's what I did to get it to work:

iptables -I INPUT -s 192.168.0.1 -j DROP


Quick Question:

After some research I understand iptables a little better. How do I list my current rules. I tried "iptables -L" and that didn't work. Is there something I'm doing wrong?

Thanks again!
 
Old 06-10-2005, 04:56 PM   #15
blackdragonblood
Member
 
Registered: May 2005
Location: Minneapolis, MN
Distribution: Debian
Posts: 217

Original Poster
Rep: Reputation: 30
I answered my question. I have to be logged on as root. I don't see the rule I just added. Is this normal? Where do I find the rules I added myself?
 
  


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
what' s wrong phoenix_fei Programming 4 01-18-2005 10:56 AM
my time is wrong and calender is also wrong Paxmaster Linux - General 6 12-16-2004 12:46 AM
What's wrong? whaase Linux - Software 7 10-20-2003 12:39 AM
What am I doing wrong? funkenbooty Linux - Newbie 14 07-26-2003 02:16 AM
What did I do wrong? yakko Linux - Newbie 7 05-02-2002 07:09 PM

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

All times are GMT -5. The time now is 08:33 PM.

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