LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 12-17-2015, 08:47 AM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 761

Rep: Reputation: Disabled
Static IP not taking


I have a Raspberry pi connected to my LAN via wifi, and the hardwired Ethernet is not connected. As for as I could tell, my static IP is 192.168.1.199. Agree?

Code:
pi@raspberrypi ~ $ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:77:55:11
          UP BROADCAST 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)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:72 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6288 (6.1 KiB)  TX bytes:6288 (6.1 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:0f:60:06:f5:43
          inet addr:192.168.1.199  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2666 errors:0 dropped:1166 overruns:0 frame:0
          TX packets:428 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:445192 (434.7 KiB)  TX bytes:69767 (68.1 KiB)

pi@raspberrypi ~ $ cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
allow-hotplug wlan0
#iface wlan0 inet manual
#Above line deleted and next 5 lines added by Michael
iface wlan0 inet static
address 192.168.1.199
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

pi@raspberrypi ~ $ cat /etc/resolv.conf
# Generated by resolvconf
nameserver 192.168.1.1
pi@raspberrypi ~ $ cat /etc/hosts
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1       raspberrypi
pi@raspberrypi ~ $
And I could ping it from another machine which is good. But then I found this crazy other ip 192.168.1.173 on my network. I see who it is using "host", and I find it is the Pi. Furthermore, 192.168.1.199 doesn't have a host name.

Please explain what is happening. Thank you

Code:
[root@devserver ~]# ping 192.168.1.199
PING 192.168.1.199 (192.168.1.199) 56(84) bytes of data.
64 bytes from 192.168.1.199: icmp_seq=1 ttl=64 time=1.81 ms
64 bytes from 192.168.1.199: icmp_seq=2 ttl=64 time=1.27 ms
64 bytes from 192.168.1.199: icmp_seq=3 ttl=64 time=1.71 ms
^C
--- 192.168.1.199 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2558ms
rtt min/avg/max/mdev = 1.274/1.603/1.819/0.236 ms
[root@devserver ~]# ping 192.168.1.173
PING 192.168.1.173 (192.168.1.173) 56(84) bytes of data.
64 bytes from 192.168.1.173: icmp_seq=1 ttl=64 time=1.55 ms
64 bytes from 192.168.1.173: icmp_seq=2 ttl=64 time=3.99 ms
64 bytes from 192.168.1.173: icmp_seq=3 ttl=64 time=1.28 ms
^C
--- 192.168.1.173 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2935ms
rtt min/avg/max/mdev = 1.281/2.277/3.993/1.219 ms
[root@devserver ~]# host 192.168.1.173
173.1.168.192.in-addr.arpa domain name pointer raspberrypi.
[root@devserver ~]# host 192.168.1.199
Host 199.1.168.192.in-addr.arpa. not found: 3(NXDOMAIN)
[root@devserver ~]#
 
Old 12-17-2015, 09:03 AM   #2
swampthing001
Member
 
Registered: May 2005
Distribution: LFS, CentOS, Slack, Ubuntu
Posts: 112

Rep: Reputation: 8
Could it be the IP address from when you plugged in the ethernet? Assuming you used the ethernet port if it was set to dhcp at somepoint.

Last edited by swampthing001; 12-17-2015 at 09:04 AM. Reason: forgot something, dhcp
 
Old 12-17-2015, 09:08 AM   #3
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 761

Original Poster
Rep: Reputation: Disabled
Hi Swampthing. I don't think so. I am sure it originally had the hardwired Ethernet setup with dhcp, but currently, it is not even plugged in.
 
Old 12-17-2015, 09:32 AM   #4
swampthing001
Member
 
Registered: May 2005
Distribution: LFS, CentOS, Slack, Ubuntu
Posts: 112

Rep: Reputation: 8
well you can ping it. is it the machine you pinged the pi from?
 
Old 12-17-2015, 09:32 AM   #5
erik2282
Member
 
Registered: May 2011
Location: TX
Distribution: Debian
Posts: 762

Rep: Reputation: 220Reputation: 220Reputation: 220
What machine provides your DNS, your wireless router? check in its DHCP tables for these IP's and hostnames, may need to clear or correct entries.
 
Old 12-17-2015, 10:10 AM   #6
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora, Alpine, Cirros, OpenSuse/SLES
Posts: 3,447

Rep: Reputation: 904Reputation: 904Reputation: 904Reputation: 904Reputation: 904Reputation: 904Reputation: 904Reputation: 904
ifconfig has its limits after a long life of about 30 years. Perhaps it doesn't show everything.

Run ip address for ip addresses and ip route for the routing table. Also check the arp cache right after running the ping test (ip neighbor) to see the MAC address of 192.168.1.173.
If you don't like typing, you can abbreviate the commands: ip a, ip r, ip n.

The fact that 199 doesn't have a host name is unrelated. You need to configure the host name on the DNS server.
 
Old 12-17-2015, 10:39 AM   #7
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 761

Original Poster
Rep: Reputation: Disabled
Okay, I see 192.168.1.173 when using ip address and ip route, but don't know what it means. "secondary wlan0"?

Also, how should I check the arp cache?. See the bottom for when I used arp -a. Also, I see man arp says it is obsolete and I should use ip neighbor.

Thanks

Quote:
Originally Posted by berndbausch View Post
Run ip address for ip addresses and ip route for the routing table. Also check the arp cache right after running the ping test (ip neighbor) to see the MAC address of 192.168.1.173.
Code:
pi@raspberrypi ~/bacnet-stack-0-8-0 $ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether b8:27:eb:77:55:11 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:0f:60:06:f5:43 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.199/24 brd 192.168.1.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet 192.168.1.173/24 brd 192.168.1.255 scope global secondary wlan0
       valid_lft forever preferred_lft forever
pi@raspberrypi ~/bacnet-stack-0-8-0 $ ip r
default via 192.168.1.1 dev wlan0
default via 192.168.1.1 dev wlan0  metric 303
192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.173  metric 303
pi@raspberrypi ~/bacnet-stack-0-8-0 $ ip n
192.168.1.201 dev wlan0 lladdr b8:76:3f:69:31:95 REACHABLE
192.168.1.10 dev wlan0 lladdr 90:e6:ba:58:1b:40 REACHABLE
192.168.1.1 dev wlan0 lladdr 78:24:af:ed:b7:58 STALE
pi@raspberrypi ~/bacnet-stack-0-8-0 $
Code:
[root@devserver ~]# ping 192.168.1.173
PING 192.168.1.173 (192.168.1.173) 56(84) bytes of data.
64 bytes from 192.168.1.173: icmp_seq=1 ttl=64 time=2.24 ms
64 bytes from 192.168.1.173: icmp_seq=2 ttl=64 time=1.31 ms
^C
--- 192.168.1.173 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1150ms
rtt min/avg/max/mdev = 1.318/1.779/2.241/0.463 ms
[root@devserver ~]# arp -a
raspberrypi (192.168.1.173) at 00:0f:60:06:f5:43 [ether] on wlan0
router.asus.com (192.168.1.1) at 78:24:af:ed:b7:58 [ether] on wlan0
IAMMICHAEL-PC (192.168.1.10) at 90:e6:ba:58:1b:40 [ether] on wlan0
? (192.168.1.199) at 00:0f:60:06:f5:43 [ether] on wlan0
[root@devserver ~]# ping 192.168.1.199
PING 192.168.1.199 (192.168.1.199) 56(84) bytes of data.
64 bytes from 192.168.1.199: icmp_seq=1 ttl=64 time=1.32 ms
64 bytes from 192.168.1.199: icmp_seq=2 ttl=64 time=1.32 ms
^C
--- 192.168.1.199 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1262ms
rtt min/avg/max/mdev = 1.320/1.324/1.328/0.004 ms
[root@devserver ~]# arp -a
raspberrypi (192.168.1.173) at 00:0f:60:06:f5:43 [ether] on wlan0
router.asus.com (192.168.1.1) at 78:24:af:ed:b7:58 [ether] on wlan0
IAMMICHAEL-PC (192.168.1.10) at 90:e6:ba:58:1b:40 [ether] on wlan0
? (192.168.1.199) at 00:0f:60:06:f5:43 [ether] on wlan0
[root@devserver ~]#
 
Old 12-17-2015, 10:44 AM   #8
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 761

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by swampthing001 View Post
well you can ping it. is it the machine you pinged the pi from?
I am pinging the pi from another machine with ip 192.168.1.201.
 
Old 12-17-2015, 10:46 AM   #9
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 761

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by erik2282 View Post
What machine provides your DNS, your wireless router? check in its DHCP tables for these IP's and hostnames, may need to clear or correct entries.
Yes, I believe it is my wireless router. I looked in its DHCP tables, and it appears to be the correct 192.168.1.199. I'll try rebooting the router to see what happens. Over and out...
 
Old 12-17-2015, 02:21 PM   #10
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 761

Original Poster
Rep: Reputation: Disabled
Dang, this is frustrating!

So, if I log onto my router, it shows both eth0 and wlan0 as being DHCP and not static. I want them to be static.

Furthermore, if I reboot my router, I am not able to PuTTY into the device (at least using what I assumed were its static IPs) until I restart it.

So, while I thought I had set it up with static IPs, it appears I haven't.

Below is my config.

Is there a way to confirm whether it is set up with a static IP or not? When searching for answers, all I saw was "Look at /etc/network/interfaces", and that gets me nowhere.

Thanks in advance for any help or suggestions.


Code:
pi@raspberrypi ~ $ cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
#iface eth0 inet manual
iface eth0 inet static
address 192.168.1.198
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
network 192.168.1.0

auto wlan0
allow-hotplug wlan0
#iface wlan0 inet manual
iface wlan0 inet static
address 192.168.1.199
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
network 192.168.1.0
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

#auto wlan1
#allow-hotplug wlan1
#iface wlan1 inet manual
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

pi@raspberrypi ~ $

EDIT. Also, if I restart the network, I lose communication and need to reboot the machine.
Code:
pi@raspberrypi ~ $ sudo /etc/init.d/networking restart
[warn] Running /etc/init.d/networking restart is deprecated because it may not re-enable some interfaces ... (warning).
[....] Reconfiguring network interfaces...
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
RTNETLINK answers: File exists
Failed to bring up wlan0.
ifup: interface eth0 already configured
done.
pi@raspberrypi ~ $

Last edited by NotionCommotion; 12-17-2015 at 02:24 PM.
 
Old 12-17-2015, 03:52 PM   #11
swampthing001
Member
 
Registered: May 2005
Distribution: LFS, CentOS, Slack, Ubuntu
Posts: 112

Rep: Reputation: 8
It looks right from what I can tell. You define a static IP on the machine and not the router. This breaks down the process of setting up a static IP on eth0 http://www.modmypi.com/blog/tutorial...tic-ip-address and this post is pretty spot on with establishing a static IP on wlan0 http://www.electroschematics.com/949...-raspberry-pi/ And this one too https://www.raspberrypi.org/forums/v...p?f=91&t=22660
 
Old 12-17-2015, 04:50 PM   #12
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 761

Original Poster
Rep: Reputation: Disabled
I agree it looks right, but why would the router show it as being DHCP? Is there any commands which would confirm?
 
Old 12-17-2015, 06:39 PM   #13
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora, Alpine, Cirros, OpenSuse/SLES
Posts: 3,447

Rep: Reputation: 904Reputation: 904Reputation: 904Reputation: 904Reputation: 904Reputation: 904Reputation: 904Reputation: 904
First, I am a bit confused - your Raspberry Pi is not the same as the router, correct? If so:

It's absolutely normal to have more than one IP address on an interface. ifconfig is too old for such things, that's why you should retire it and use the ip command instead.

You can, for example, add an IP address manually:
Code:
# ip a add 1.2.3.4/11 dev wlan0    # add a bogus address to wlan0
# ip a show dev wlan0              # verify the new configuration of wlan0
# ip a del 1.2.3.4/11 dev wlan0    # delete the address
The question is where 192.168.1.173 comes from. I don't know anything about WiFi configuration, but I would suspect that the answer is in both your router configuration and the line "wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf" in the interfaces file.

The fact that your router is configured differently than your Raspberry simply means that you didn't configure it correctly (in my humble opinion - again, I don't know too much about wireless LAN configuration).
 
Old 12-17-2015, 08:09 PM   #14
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,553

Rep: Reputation: 314Reputation: 314Reputation: 314Reputation: 314
Your Pi only has one ethernet connection - but you are defining two ethernet connections for it.

When it comes up, entering
Code:
arp -n
might reveal something of interest about your arp cache.
 
Old 12-18-2015, 06:52 AM   #15
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 761

Original Poster
Rep: Reputation: Disabled
Thanks berndbausch,

The Raspberry Pi is not the same as the router.

Why is it absolutely normal to have more than one IP address on an interface? Is it primarily to support virtual servers?

I ended up deleting the second IP, and think I have it resolved.
Code:
update-rc.d dhcpcd disable
service dhcpcd stop
ip addr del 192.168.1.173/24 dev eth0
 
  


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
setting static IP on linux PCs with no static IP address from internet provider? solvetek Linux - Networking 1 10-22-2011 08:04 AM
Java non-static variable cannot be referenced from a static context issue rickrvo Programming 2 02-12-2010 03:26 PM
How to initialize a static array of a class in a static member function lali.p Programming 9 02-16-2008 09:27 AM
Howto Assign Multiple Static Public IP Addresses under SBC's PPPoE Static Ip system o trekgraham Linux - Networking 8 04-17-2007 10:51 AM
FC2 Overriding static if in favor of dhcp system set for static pkraus109 Linux - Networking 8 09-21-2004 11:13 AM

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

All times are GMT -5. The time now is 04:24 PM.

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