LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Static IP (private) not working (http://www.linuxquestions.org/questions/linux-networking-3/static-ip-private-not-working-684417/)

figure002 11-18-2008 03:08 PM

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?

anomie 11-18-2008 03:12 PM

# 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.

figure002 11-18-2008 03:23 PM

Quote:

Originally Posted by anomie (Post 3346685)
# 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.

What I meant whas, I can't access websites, or use Skype, or anything that uses the internet. A simple 'ping google.com' doesn't work either.

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!

nameserver 192.168.1.1

When DHCP is not enabled:
Code:

# generated by NetworkManager, do not edit!
So it's missing one line: "nameserver 192.168.1.1"
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.

billymayday 11-18-2008 03:23 PM

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.

billymayday 11-18-2008 03:24 PM

Probably from network manager would be my guess.

figure002 11-18-2008 03:36 PM

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
search site

When DHCP is disabled (internet not working):
Code:

domain site
nameserver 192.168.1.1


About "assigning a specific IP based on the MAC address". I just went through all my router settings, but there is no such option :(

billymayday 11-18-2008 03:47 PM

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.

heloma 11-18-2008 03:53 PM

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.

figure002 11-18-2008 03:58 PM

Yes, I'm assigning 192.168.1.6

When DHCP is enabled:
Code:

saibot:~ # ifconfig
eth0      Link encap:Ethernet  HWaddr 00:15:F2:38:43:9B 
          inet addr:192.168.1.54  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::215:f2ff:fe38:439b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5973 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5793 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3118953 (2.9 Mb)  TX bytes:1163277 (1.1 Mb)
          Interrupt:19 Base address:0xc00

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4866 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4866 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:262322 (256.1 Kb)  TX bytes:262322 (256.1 Kb)

wlan0    Link encap:Ethernet  HWaddr 00:15:F2:1D:95:7B 
          inet addr:192.168.1.55  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::215:f2ff:fe1d:957b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:898 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1258 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:119919 (117.1 Kb)  TX bytes:271354 (264.9 Kb)

wmaster0  Link encap:UNSPEC  HWaddr 00-15-F2-1D-95-7B-35-37-00-00-00-00-00-00-00-00 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

saibot:~ # route
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.1.0    *              255.255.255.0  U    0      0        0 eth0
192.168.1.0    *              255.255.255.0  U    0      0        0 wlan0
loopback        *              255.0.0.0      U    0      0        0 lo
default        192.168.1.1    0.0.0.0        UG    0      0        0 eth0
saibot:~ # dig www.google.com

; <<>> DiG 9.4.2-P1 <<>> www.google.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39254
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com.                        IN        A

;; ANSWER SECTION:
www.google.com.                604685        IN        CNAME        www.l.google.com.
www.l.google.com.        188        IN        A        74.125.79.103
www.l.google.com.        188        IN        A        74.125.79.99
www.l.google.com.        188        IN        A        74.125.79.147
www.l.google.com.        188        IN        A        74.125.79.104

;; Query time: 34 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Tue Nov 18 22:50:35 2008
;; MSG SIZE  rcvd: 116

When DHCP is disabled and set to static IP:
Code:

saibot:~ # ifconfig
eth0      Link encap:Ethernet  HWaddr 00:15:F2:38:43:9B 
          inet addr:192.168.1.6  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::215:f2ff:fe38:439b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6003 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5821 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3123870 (2.9 Mb)  TX bytes:1168505 (1.1 Mb)
          Interrupt:19 Base address:0xc00

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4867 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4867 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:262351 (256.2 Kb)  TX bytes:262351 (256.2 Kb)

wlan0    Link encap:Ethernet  HWaddr 00:15:F2:1D:95:7B 
          inet addr:192.168.1.55  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::215:f2ff:fe1d:957b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:908 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1279 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:121677 (118.8 Kb)  TX bytes:275999 (269.5 Kb)

wmaster0  Link encap:UNSPEC  HWaddr 00-15-F2-1D-95-7B-35-37-00-00-00-00-00-00-00-00 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

saibot:~ # route
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.1.0    *              255.255.255.0  U    0      0        0 eth0
192.168.1.0    *              255.255.255.0  U    0      0        0 wlan0
loopback        *              255.0.0.0      U    0      0        0 lo
default        192.168.1.1    0.0.0.0        UG    0      0        0 wlan0
saibot:~ # dig www.google.com

; <<>> DiG 9.4.2-P1 <<>> www.google.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52924
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com.                        IN        A

;; ANSWER SECTION:
www.google.com.                604598        IN        CNAME        www.l.google.com.
www.l.google.com.        101        IN        A        74.125.79.103
www.l.google.com.        101        IN        A        74.125.79.99
www.l.google.com.        101        IN        A        74.125.79.147
www.l.google.com.        101        IN        A        74.125.79.104

;; Query time: 32 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Tue Nov 18 22:52:02 2008
;; MSG SIZE  rcvd: 116


billymayday 11-18-2008 04:06 PM

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.

figure002 11-18-2008 04:08 PM

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
eth0      Link encap:Ethernet  HWaddr 00:15:F2:38:43:9B 
          inet addr:192.168.1.6  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::215:f2ff:fe38:439b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6486 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6335 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3282799 (3.1 Mb)  TX bytes:1292303 (1.2 Mb)
          Interrupt:19 Base address:0xc00

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4896 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4896 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:263192 (257.0 Kb)  TX bytes:263192 (257.0 Kb)

saibot:~ # route
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.1.0    *              255.255.255.0  U    0      0        0 eth0
loopback        *              255.0.0.0      U    0      0        0 lo
saibot:~ # dig www.google.com

; <<>> DiG 9.4.2-P1 <<>> www.google.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19441
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com.                        IN        A

;; ANSWER SECTION:
www.google.com.                604041        IN        CNAME        www.l.google.com.
www.l.google.com.        146        IN        A        74.125.79.147
www.l.google.com.        146        IN        A        74.125.79.104
www.l.google.com.        146        IN        A        74.125.79.103
www.l.google.com.        146        IN        A        74.125.79.99

;; Query time: 31 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Tue Nov 18 23:01:19 2008
;; MSG SIZE  rcvd: 116

And in response to heloma:

Code:

saibot:~ # ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=1.10 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=1.02 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.942 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.936 ms
^C
--- 192.168.1.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3011ms
rtt min/avg/max/mdev = 0.936/1.003/1.108/0.070 ms
saibot:~ # ping 4.2.2.2
connect: Network is unreachable
saibot:~ # ping 82.173.xxx.xx (my public ip)
connect: Network is unreachable
saibot:~ #

So that means it's a routing problem?

Quote:

Originally Posted by billymayday (Post 3346745)
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.

Yes, it is true that both wireless and cable were enabled. But wireless works fine when DHCP is enabled. Wireless works very slow when DHCP is disabled for cable only. I am just trying to set a static IP for cable, not wireless.

billymayday 11-18-2008 04:12 PM

Yes. What distro are you using?

figure002 11-18-2008 04:16 PM

Quote:

Originally Posted by billymayday (Post 3346755)
Yes. What distro are you using?

See my first post, I'm using openSuSE 11.0

billymayday 11-18-2008 04:20 PM

Sorry, running a few responses in tandem here. Let me have a look at my OpenSuSe box and come back to you.

billymayday 11-18-2008 04:27 PM

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.


All times are GMT -5. The time now is 01:19 AM.