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 |
Quote:
|
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.
|
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 |
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.
|
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 |
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. |
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.
|
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 |
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.
|
Quote:
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 |
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. :scratch:
|
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?
|
/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) |
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 :D |
All times are GMT -5. The time now is 05:26 AM. |