Static IP (private) not working
Hello,
I have set a static local IP address for my machine, but after that I can't get on the internet. I'm running openSuSE 11.0 with a Broadcom card on a laptop. Usually my settings are set to DHCP which always assigned me to the local address 192.168.1.6. But recently the router gave me a new private IP address, which means I have to update all the port forwarding rules. But I want to avoid that by setting 192.168.1.6 as my static IP. Internet works fine when set to DHCP, but when I use "yast2 lan" to change to a static IP, I can't get on the internet. I used the following settings to set it to static: Local static IP: 192.168.1.6 (this ip is not in use, and i tried other ip's also) Subnetmask: 255.255.255.0 (which is the same when DHCP is enabled) DNS/Nameserver: 192.168.1.1 (which is also the same when DHCP is enabled) When I do an ifconfig afterwards, the ip is indeed set to the new address. But websites still can't be found. Anyone got an idea how to fix this? |
# cat /etc/resolv.conf
? It's not clear whether you're saying you can't connect to the 'net or whether you simply can not resolve names. If resolve.conf does not contain nameservers when you set a static IP, there's your problem. |
Quote:
I don't really know what you mean by "can't resolve names", but i just found something weird when viewing the contents of '/etc/resolve.conf'. When DHCP is enabled: Code:
# generated by NetworkManager, do not edit! Code:
# generated by NetworkManager, do not edit! How do I fix this without manually editing the file? I prefer to use graphical tools to set these things rather then manually editing things. |
You could probably have your dhcp serve assign a specific IP based on the MAC address as well - same result, less fiddling
Edit cross typing I see. |
Probably from network manager would be my guess.
|
Ok, I just set the nameserver with the same network manager, and this is what I got:
# cat /etc/resolv.conf When DHCP is enabled and internet is working: Code:
nameserver 192.168.1.1 Code:
domain site About "assigning a specific IP based on the MAC address". I just went through all my router settings, but there is no such option :( |
What IP are you assigning, is it 192.168.1.6?
From the command line, can you post the results of: ifconfig route dig www.google.com You will probably need to be root or use sudo. |
1- ping your gateway, if it pings, go to next step, if not, you have a network problem.
2- ping external ip (4.2.2.2), if it pings, go to next step, if not, you have a routing problem. 3- add external dns server to your /etc/resolv.conf (internet dns servers 4.2.2.2, 142.77.1.1) heloma. |
Yes, I'm assigning 192.168.1.6
When DHCP is enabled: Code:
saibot:~ # ifconfig Code:
saibot:~ # ifconfig |
Ok, so when you use DHCP, the default route is via eth0, but through wlan0 otherwise. However dig (that's a namserver lookup) works because it's being routed through eth0 because it's on 192.168.1.1 (see first line of route output).
Am I correct in saying that you are both wired in and trying to use your wireless card? It looks to me like th wireless card isn't working properly if that's the case. |
I think I should have disabled my wlan in the previous step. I redid the same step, but this time with wireless disabled:
When DHCP is disabled: Code:
saibot:~ # ifconfig Code:
saibot:~ # ping 192.168.1.1 Quote:
|
Yes. What distro are you using?
|
Quote:
|
Sorry, running a few responses in tandem here. Let me have a look at my OpenSuSe box and come back to you.
|
When you open up Network Settings from yast, there's a routing tab on the RHS.
You need to add 192.161.1.1 as the default gateway. |
Quote:
EDIT: Turns out I could just enter the gateway IP (192.168.1.1) in the empty list, but internet still didn't work after that. |
Are you running yast as root?
Try firing it up from a root terminal session (just type yast2 at the command line) |
Yes, I'm running Yast as root, because I have to enter my root password everytime I run Yast. I also fired up Yast from a root terminal session, but there was no difference.
|
Something is awry then.
Either you have entered something wrong that is causing this or yast is on strike. I can change it here OK. You are using "Network Settings" from the "Network Devices" tab? |
You can always add the route manually. Not sure if it will persist in SuSe
Quote:
|
I had a similar problem to what you are experiencing just today. It turned out to be a IP conflict between the two devices in my computer. For some reason, when I changed one devices IP address (eth0) it would change the other one's as well to the same thing. Even though the second network device (eth1) was disabled, this caused a conflict. Maybe try removing your wireless completely? Disable it in the bios?
|
Except it seems pretty clear it's a routing problem since there is no default gateway.
Were you experiencing a routing issue or just IP conflict? |
Quote:
|
Quote:
Quote:
Quote:
|
This is definitly a routing issue, you need to add a static route (default gateway):
as root #route add default gw 192.168.1.1 If you are using Linksys, you will need also to clear your routing table. good luck. heloma |
Reading through this one thing does not make sense to me. In post 11 you posted the stats with dhcp off. In the ifconfig I see:
Quote:
Are you restarting networking after you make these changes? service network restart works on my distros ... |
I finally got it to work.
First I tried the following commands as root: # route add default gw 192.168.1.1 followed by # service network restart But this only worked half. Skype would then work, but i could not ping to google.com or visit websites. So I took another look at billymayday's advice. He told me to set the Default Gateway to '192.168.1.1' in the Routing tab in the Network Settings. When I tried this earlier, another option (Actualize DNS-data through DHCP) under the DNS tab was enabled. This time I disabled it and manually entered '192.168.1.1' for 'Namespace 1'. This in combination with the Default Gateway set to 192.168.1.1, does work :D I hope this works for other people also. Thanks a lot for your help guys! |
You need to add external dns servers to your hostfile,
add the following lines to /etc/resolv.conf nameserver 4.2.2.2 nameserver 142.77.1.1 that's it ! |
All times are GMT -5. The time now is 11:04 PM. |