LinuxQuestions.org
Help answer threads with 0 replies.
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 11-18-2008, 03:08 PM   #1
figure002
Member
 
Registered: Nov 2008
Distribution: Ubuntu Maverick
Posts: 31

Rep: Reputation: 16
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?
 
Old 11-18-2008, 03:12 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
# 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.
 
Old 11-18-2008, 03:23 PM   #3
figure002
Member
 
Registered: Nov 2008
Distribution: Ubuntu Maverick
Posts: 31

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by anomie View Post
# 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.

Last edited by figure002; 11-18-2008 at 03:24 PM.
 
Old 11-18-2008, 03:23 PM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
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.

Last edited by billymayday; 11-18-2008 at 03:24 PM.
 
Old 11-18-2008, 03:24 PM   #5
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Probably from network manager would be my guess.
 
Old 11-18-2008, 03:36 PM   #6
figure002
Member
 
Registered: Nov 2008
Distribution: Ubuntu Maverick
Posts: 31

Original Poster
Rep: Reputation: 16
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
 
Old 11-18-2008, 03:47 PM   #7
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
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.
 
Old 11-18-2008, 03:53 PM   #8
heloma
LQ Newbie
 
Registered: Jun 2006
Posts: 4

Rep: Reputation: 0
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.
 
Old 11-18-2008, 03:58 PM   #9
figure002
Member
 
Registered: Nov 2008
Distribution: Ubuntu Maverick
Posts: 31

Original Poster
Rep: Reputation: 16
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
 
Old 11-18-2008, 04:06 PM   #10
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
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.

Last edited by billymayday; 11-18-2008 at 04:13 PM.
 
Old 11-18-2008, 04:08 PM   #11
figure002
Member
 
Registered: Nov 2008
Distribution: Ubuntu Maverick
Posts: 31

Original Poster
Rep: Reputation: 16
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 View Post
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.

Last edited by figure002; 11-18-2008 at 04:13 PM.
 
Old 11-18-2008, 04:12 PM   #12
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Yes. What distro are you using?
 
Old 11-18-2008, 04:16 PM   #13
figure002
Member
 
Registered: Nov 2008
Distribution: Ubuntu Maverick
Posts: 31

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by billymayday View Post
Yes. What distro are you using?
See my first post, I'm using openSuSE 11.0
 
Old 11-18-2008, 04:20 PM   #14
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Sorry, running a few responses in tandem here. Let me have a look at my OpenSuSe box and come back to you.
 
Old 11-18-2008, 04:27 PM   #15
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
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.
 
  


Reply

Tags
dhcp, ip, private, static



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
SSH with passwordless public/private key not working on another account on server infocom Linux - Server 14 12-27-2010 05:09 AM
Samba not working as intended. Private / Public share's ILikeVoltron Linux - Networking 3 03-14-2006 04:22 PM
static ip in a private lan master Linux - Networking 12 02-19-2006 10:39 PM
Making static symbols private/local in shared libraries skoona Programming 1 02-18-2005 03:14 PM
Working with SSH and multiple private keys IgD Linux - Security 2 09-08-2003 10:07 PM

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

All times are GMT -5. The time now is 09:03 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
Open Source Consulting | Domain Registration