LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-05-2006, 10:51 PM   #1
Hawnted
Member
 
Registered: Aug 2006
Posts: 32

Rep: Reputation: 15
DHCP internet connection problem


I have a wierd problem, well wierd to me I dont know how common this is in Linux but anyway here it is.
I set up Mandriva 2006 according to The perfect setup tutorial. I setup a static IP address and its set to 192.168.1.103. Ok well when I boot up I get that IP says ifconfig. However, I have no internet connection. If I run dhclient command then I will get an IP from the DHCP of my router and I have internet connection but its never the IP I have setup in my eth0 config. How do I fix this problem?

Thanks in advance
 
Old 08-05-2006, 10:57 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
Quote:
If I run dhclient command then I will get an IP from the DHCP of my router and I have internet connection
Is there a particular reason that you don't want your computer to grab an IP address from the router?
 
Old 08-06-2006, 12:25 AM   #3
Hawnted
Member
 
Registered: Aug 2006
Posts: 32

Original Poster
Rep: Reputation: 15
Yes I am running a webserver and its a pain if I grab a different IP I have to go open ports on my router for that IP and change the IP address settings in ISPConfig.
 
Old 08-06-2006, 12:46 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Well, then you probably just need to manually set a name-server and a
default route, too.

Chances are that you're actually connected fine (can you ping the router
with the manually assigned IP address? Can you ping google by IP rather
than name? 64.233.187.99)...


Cheers,
Tink
 
Old 08-06-2006, 01:22 AM   #5
Hawnted
Member
 
Registered: Aug 2006
Posts: 32

Original Poster
Rep: Reputation: 15
Thats what confuses me. I have set up the name servers and default route and all of those options exactly according to The Perfect Setup. However, I cannot ping or do anything (wget, lynx, etc) When I run dhclient I can do all of those things, and the IP its giving me is just one number above what I have it set to. IE. 192.168.1.101 is what I want it to get and it gives me 192.168.1.102 and everything is fine then. I just dont understand why it wont connect to the internet at the IP im assigning without running dhclient.
 
Old 08-06-2006, 01:35 AM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Well, maybe your router does some firewalling as well, and has
a rule to only handle IPs it has a dhcp-lease for? Check its
set-up, see whether it has options for static IPs, too.

Another option is that maybe there's another machine that happens
to have 101 assigned while you have it statically?



Cheers,
Tink
 
Old 08-06-2006, 02:22 AM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
I always cheat. First I set up a machine using dhcp. Then I back up the /etc/resolv.conf file to use latter when I reconfigure it for a static address. If you have a linksys router, and haven't changed the starting IP range of its dhcp server, then give your computer an IP address below 192.168.1.100 if you want a static address. That way, if another computer is started up when yours is off there won't be a conflict.

I think that Tinkser's last point was correct, and the reason is that your static IP is in the dynamically assigned range. I bet if you gave your machine an ip address of 192.168.1.99 that would fix the problem.

Last edited by jschiwal; 08-06-2006 at 02:25 AM.
 
Old 08-06-2006, 02:53 AM   #8
Hawnted
Member
 
Registered: Aug 2006
Posts: 32

Original Poster
Rep: Reputation: 15
Thanks guys Ill give that a whirl. However, no other machines have that IP. I have my windows box set to 192.168.1.145. My other windows box to 192.168.1.140. Any my other Unix box to 192.168.1.100. I set this server I am trying to configure now to 192.168.1.101 and also tried 102 and 103. Ill give both of your suggestions a whirl and see how it goes..Thanks for the quick responses.
 
Old 08-06-2006, 03:11 AM   #9
Hawnted
Member
 
Registered: Aug 2006
Posts: 32

Original Poster
Rep: Reputation: 15
Ok i setup the IP address as 192.168.1.99 and restarted the network and opened the ports on my router for .99. Couldnt connect to server. Then I ran dhclient and it gave me 192.168.1.103 and bam it worked again. this is so wierd. I also checked on static IPs from my router, I can give it a static dns but no static IPs. Any other ideas I can try?

Thanks again guys
 
Old 08-06-2006, 04:59 AM   #10
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 3,273

Rep: Reputation: 587Reputation: 587Reputation: 587Reputation: 587Reputation: 587Reputation: 587
You can set up an old machine as a smoothwall firewall. The resulting linux box will do NAT, packet filtering, packet dropping, DNS, and use a different interface for the web server than it does for the other clients. You can have a real firewall, set the web server static, and use DHCP for the other clients. You install the smoothwall distro on an old, cheap piece of hardware with three NICS. You plug the modem into one NIC, plug the router into another nic, and plug the web server into the third nic. Then, you plug your private clients into the router. The linux firewall secures an IP, via DHCP, from the isp. The webserver has a static ip, which never changes, on the firewall box. The router receives an IP, via DHCP, from the firewall box. The private clients receive an IP, via DHCP from the router. It takes about 2 hours to set up, and you need to know when to use a crossover cable. The cable that runs to the webserver needs to be a crossover cable because it runs directly between nic cards. Routers will usually take either cable, and modems are all straight through now, pretty much.
 
Old 08-06-2006, 02:10 PM   #11
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by rlhesson
Ok i setup the IP address as 192.168.1.99 and restarted the network and opened the ports on my router for .99. Couldnt connect to server. Then I ran dhclient and it gave me 192.168.1.103 and bam it worked again. this is so wierd. I also checked on static IPs from my router, I can give it a static dns but no static IPs. Any other ideas I can try?

Thanks again guys
Does the server box have more than one network interface?
Maybe the static IP is bound to a card without a cable, and
the dynamic one is configured right if you invoke dhclient without
and interface name because it probes them all?


Cheers,
Tink
 
Old 08-06-2006, 05:09 PM   #12
Hawnted
Member
 
Registered: Aug 2006
Posts: 32

Original Poster
Rep: Reputation: 15
It has a built in wireless card, but I was under the impression you have to setup wireless on linux for it to work, and I have never done that. Another discovery I made last night was I went to bed with the IP being 192.168.1.103 and woke up with it being 192.168.1.110. It is on the eth0 ethernet NIC so it is not my wireless card getting the DHCP. Im lost at this point.
 
Old 08-06-2006, 05:22 PM   #13
Hawnted
Member
 
Registered: Aug 2006
Posts: 32

Original Poster
Rep: Reputation: 15
UPDATE: I have set my IP to work statically, and I can ping my servers, and can goto my pages, but wget doesnt work. Everything i try sais failed: Temporary failure in name resolution. Any ideas?

Last edited by Hawnted; 08-06-2006 at 05:39 PM.
 
Old 08-06-2006, 05:53 PM   #14
Hawnted
Member
 
Registered: Aug 2006
Posts: 32

Original Poster
Rep: Reputation: 15
/etc/hosts

127.0.0.1 server1.rlhesson.com server1 localhost
--------------------------------------------------------------

/etc/resolv.conf

search midsouth.rr.com (this is my ISP)
nameserver 65.24.7.3

--------------------------------------------------------------

/etc/sysconfig/networking-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.103
NETMASK=255.255.255.0
NETWORK=192.168.1.1
BROADCAST=192.168.1.255
ONBOOT=yes
METRIC=10
MII_NOT_SUPPORTED=no
USERCTL=no
IPV6INIT=no
IPV6TO4INIT=no
PEERDNS=yes
NETMASK=255.255.255.0
IPADDR=192.168.1.103

--------------------------------------------------------------

/etc/sysconfig/networking-scripts/ifcfg-eth0:0

DEVICE=eth0:0
BOOTPROTO=static
IPADDR=192.168.1.104
NETMASK=255.255.255.0
NETWORK=192.168.1.1
BROADCAST=192.168.1.255
ONBOOT=yes
METRIC=10
MII_NOT_SUPPORTED=no
USERCTL=no

--------------------------------------------------------------

/etc/sysconfig/networking-scripts/ifcfg-sit0

DEVICE=sit0
BOOTPROTO=none (I have tried static here too)
ONBOOT=yes

--------------------------------------------------------------

This configuration is working if I could get wget to work (lynx or urpmi doesnt work either)

Last edited by Hawnted; 08-06-2006 at 05:56 PM.
 
Old 08-06-2006, 06:09 PM   #15
Hawnted
Member
 
Registered: Aug 2006
Posts: 32

Original Poster
Rep: Reputation: 15
Fixed the problem. Thanks for all your help guys and fast responses.

/etc/sysconfig/network turned out to be the problem

It had 192.168.0.1 instead of 192.168.1.1

 
  


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
DHCP Server Client no connection to Internet westverg Linux - Networking 3 02-28-2005 08:08 AM
internet connection with dhcp pelgrimforever Linux - Networking 4 09-03-2004 03:07 PM
SuSE 9.0 internet connection fails with LAN and DHCP lynxgogo Linux - Networking 0 01-31-2004 08:15 AM
Internet connection sharing and dhcp SolidSnake Linux - Networking 26 12-02-2003 11:23 AM
Internet Sharing with DHCP connection to the Net Earp Linux - Networking 1 06-15-2003 03:57 PM

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

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