kaksi
Posts: 94
Joined: Tue Mar 10, 2015 6:19 am

RPI3 connection with WPA2 (Hostname - I: 169.254.3.34)

Tue Oct 17, 2017 6:14 pm

I run RPI3 with a camera w/o monitor, mouse, keyboard and I control it over WiFi. The configuration:

Code: Select all

XP with WinSCP <-RJ45-> router devil <-WiFi-> RPI3
               <-RJ45-> router ghost <-RJ45-> antena <-WiFi-> internet provider

The content of wpa_supplicant.conf:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB

network={
	ssid="devil"
	psk="coco"
	key_mgmt=WPA-PSK
}
So far, so good. Depending on the location of RPI3, it might be more convenient that RPI connects to ghost (especially because ghost has a directional antena while devil has not). (ghost works well with Android.)

I started the GUI, found ghost, entered the password. RPI connected. Just for sure, I tried internet. Did not work. Hostname - I: 169.254.3.34. New entry in wpa_supplicant.conf:

Code: Select all

network={
	ssid="ghost"
	psk="coco"
	key_mgmt=WPA-PSK
}
It took me quite a long time to identify the problem: while devil uses WPA, ghost uses WPA2. Yes, I tried Google...

Supplementary question: What happens when both routers are reachable? Which one will RPI prefer?

User avatar
DougieLawson
Posts: 36540
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: RPI3 connection with WPA2 (Hostname - I: 169.254.3.34)

Tue Oct 17, 2017 6:25 pm

It depends on

Code: Select all

priority=100
vs

Code: Select all

priority=60
in your network block. High number means more likely to connect.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

kaksi
Posts: 94
Joined: Tue Mar 10, 2015 6:19 am

Re: RPI3 connection with WPA2 (Hostname - I: 169.254.3.34)

Tue Oct 17, 2017 7:53 pm

DougieLawson wrote:
Tue Oct 17, 2017 6:25 pm
It depends on priority in your network block. High number means more likely to connect.
Thanks, that will work perfectly. High priority to devil and when I want to connect to ghost, I switch devil off.

Now the hostname. I know you know the answer );

User avatar
DougieLawson
Posts: 36540
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: RPI3 connection with WPA2 (Hostname - I: 169.254.3.34)

Tue Oct 17, 2017 9:27 pm

Sorry I couldn't see a hostname. You've got a 169.254.xxx.xxx link-local IP address. That's because your RPi can't find the DHCP server on your network.

On a 192.168.1.0 to 192.168.1.255 (192.168.1.0/24) network you'll usually find that the default router, dhcp server and local DNS server is 192.168.1.1 or 192.168.1.254 (192.168.1.255 is the broadcast address).

If your WiFi isn't associated or your ethernet cable isn't connected then Linux and Windows systems will pick a 169.254.xxx.xxx address at random (from 65534 possible addresses).

So you need to look at your cabling or why wpa_supplicant isn't associated with your home access point.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

kaksi
Posts: 94
Joined: Tue Mar 10, 2015 6:19 am

Re: RPI3 connection with WPA2 (Hostname - I: 169.254.3.34)

Tue Oct 17, 2017 11:29 pm

DougieLawson wrote:
Tue Oct 17, 2017 9:27 pm
why wpa_supplicant isn't associated with your home access point.
That's in fact my question.

Yes, the router has the address 192.168.1.254.
Android gets the address 192.168.1.104.
Realtek dongle gets the address 192.168.1.106.

That turns my suspicion to RPI.

Ping from RPI to 192.168.1.254
- via cable with WiFi disabled: about 1 ms
- via WiFi with cable unplugged: Network is unreachable.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI3 connection with WPA2 (Hostname - I: 169.254.3.34)

Wed Oct 18, 2017 12:30 am

You should post the output of
ifconfig
iwconfig
route

User avatar
DougieLawson
Posts: 36540
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: RPI3 connection with WPA2 (Hostname - I: 169.254.3.34)

Wed Oct 18, 2017 6:31 am

Try this:
sudo killall wpa_supplicant
sudo wpa_supplicant
-d -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0

That -d flag runs it in debugging mode. Run with -dd for more debugging noise.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

kaksi
Posts: 94
Joined: Tue Mar 10, 2015 6:19 am

Re: RPI3 connection with WPA2 (Hostname - I: 169.254.3.34)

Thu Oct 19, 2017 12:34 pm

ifconfig

Code: Select all

eth0      Link encap:Ethernet  HWaddr b8:27:eb:fc:30:8f  
          inet addr:192.168.1.103  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a5e:c30b:8532:23f3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:128 errors:0 dropped:2 overruns:0 frame:0
          TX packets:99 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:23928 (23.3 KiB)  TX bytes:11989 (11.7 KiB)

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:65536  Metric:1
          RX packets:440 errors:0 dropped:0 overruns:0 frame:0
          TX packets:440 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:36096 (35.2 KiB)  TX bytes:36096 (35.2 KiB)

wlan0     Link encap:Ethernet  HWaddr b8:27:eb:a9:65:da  
          inet addr:169.254.3.34  Bcast:169.254.255.255  Mask:255.255.0.0
          inet6 addr: fe80::61a4:dc6c:ad57:c142/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:301 errors:0 dropped:272 overruns:0 frame:0
          TX packets:148 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:88335 (86.2 KiB)  TX bytes:34011 (33.2 KiB)
iwconfig

Code: Select all

wlan0     IEEE 802.11bgn  ESSID:"ghost"  
          Mode:Managed  Frequency:2.462 GHz  Access Point: 00:02:72:98:DA:77   
          Bit Rate=11 Mb/s   Tx-Power=31 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=36/70  Signal level=-74 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
route

Code: Select all

ghost
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.254   0.0.0.0         UG    202    0        0 eth0
link-local      *               255.255.0.0     U     303    0        0 wlan0
192.168.1.0     *               255.255.255.0   U     202    0        0 eth0

devil
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.254   0.0.0.0         UG    202    0        0 eth0
default         192.168.0.1     0.0.0.0         UG    303    0        0 wlan0
192.168.0.0     *               255.255.255.0   U     303    0        0 wlan0
192.168.1.0     *               255.255.255.0   U     202    0        0 eth0
i?config with the working router present just minor differences in speed, packets...

sudo wpa_supplicant -d -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0

Code: Select all

wpa_supplicant v2.3
random: Trying to read entropy from /dev/random
Successfully initialized wpa_supplicant
Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'
ctrl_interface='DIR=/var/run/wpa_supplicant GROUP=netdev'
update_config=1
country='GB'
Priority group 0
   id=0 ssid='devil'
   id=1 ssid='ghost'
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=1 type=2 op=0 soft=0 hard=0
nl80211: TDLS supported
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:6
nl80211: Using driver-based off-channel TX
nl80211: Supported vendor command: vendor_id=0x1018 subcmd=1
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: Enable multi-channel concurrent (driver advertised support)
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 3 iftype 2 (STATION)
nl80211: Subscribe to mgmt frames with non-AP handle 0x5601af18
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=040a
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=2): 04 0a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=040b
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=2): 04 0b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=040c
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=2): 04 0c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=040d
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=2): 04 0d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=090a
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=2): 09 0a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=090b
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=2): 09 0b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=090c
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=2): 09 0c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=090d
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=2): 09 0d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=0409506f9a09
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=6): 04 09 50 6f 9a 09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=7f506f9a09
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=5): 7f 50 6f 9a 09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=0801
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=2): 08 01
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=040e
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=2): 04 0e
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=06
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=1): 06
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=0a07
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=2): 0a 07
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5601af18 match=0a11
nl80211: Register frame command failed (type=208): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=2): 0a 11
nl80211: Failed to register Action frame processing - ignore for now
netlink: Operstate: ifindex=3 linkmode=1 (userspace-control), operstate=5 (IF_OPER_DORMANT)
nl80211: driver param='(null)'
Add interface wlan0 to a new radio phy0
nl80211: Regulatory information - country=GB (DFS-ETSI)
nl80211: 2402-2482 @ 40 MHz 20 mBm
nl80211: 5170-5250 @ 80 MHz 20 mBm
nl80211: 5250-5330 @ 80 MHz 20 mBm (DFS)
nl80211: 5490-5710 @ 160 MHz 27 mBm (DFS)
nl80211: 57000-66000 @ 2160 MHz 40 mBm
nl80211: Added 802.11b mode based on 802.11g information
nl80211: Do not indicate P2P_DEVICE support (p2p_device=1 driver param not specified)
wlan0: Own MAC address: b8:27:eb:a9:65:da
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=4 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-22 Invalid argument)
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=5 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-22 Invalid argument)
wlan0: RSN: flushing PMKID list in the driver
nl80211: Flush PMKIDs
TDLS: TDLS operation supported by driver
TDLS: Driver uses internal link setup
wlan0: WPS: UUID based on MAC address: b4ae468b-391a-5076-ac7a-8c4111854911
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
nl80211: Skip set_supp_port(unauthorized) while not associated
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
Using existing control interface directory.
ctrl_interface_group=108 (from group name 'netdev')
ctrl_iface bind(PF_UNIX) failed: Address already in use
ctrl_iface exists and seems to be in use - cannot override it
Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore
Failed to initialize control interface 'DIR=/var/run/wpa_supplicant GROUP=netdev'.
You may have another wpa_supplicant process already running or the file was
left by an unclean termination of wpa_supplicant in which case you will need
to manually remove this file before starting wpa_supplicant again.

Failed to add interface wlan0
wlan0: Request to deauthenticate - bssid=00:00:00:00:00:00 pending_bssid=00:00:00:00:00:00 reason=3 state=DISCONNECTED
TDLS: Tear down peers
wlan0: State: DISCONNECTED -> DISCONNECTED
nl80211: Set wlan0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=3 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
wlan0: Cancelling delayed sched scan
wlan0: Cancelling scan request
wlan0: Cancelling authentication timeout
Remove interface wlan0 from radio phy0
Remove radio phy0
nl80211: Remove monitor interface: refcount=0
netlink: Operstate: ifindex=3 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 3 iftype 2 (STATION)
nl80211: Unsubscribe mgmt frames handle 0xde892791 (mode change)
I am somehow puzzled by

Code: Select all

Regulatory information - country=GB (DFS-ETSI)
I though the country codes regulated the emission power and I never cared about (as long as it stayed in English and I was not annoyed with diacritics and incomprehensible translations). My appliances must form a colorful bunch. Should I digg ths way?

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI3 connection with WPA2 (Hostname - I: 169.254.3.34)

Thu Oct 19, 2017 12:44 pm

So it is "ghost" you have problems with? When you connect to "ghost", there is a network setting assignment problem.

Code: Select all

wlan0     Link encap:Ethernet  HWaddr b8:27:eb:a9:65:da  
          inet addr:169.254.3.34  Bcast:169.254.255.255  Mask:255.255.0.0
There is no gateway in route for that localnet.

It appears you have a dhcp server problem on "ghost".

kaksi
Posts: 94
Joined: Tue Mar 10, 2015 6:19 am

Re: RPI3 connection with WPA2 (Hostname - I: 169.254.3.34)

Fri Oct 20, 2017 1:32 pm

Expecting nothing, I corrected the in raspi-config the country codes. I was not deceived, it did not help.

But I think I am into something now. I digged out my TP-LINK AV200 WiFi Powerline Extender. One device connected to GHOST, the second one to the next room to RPI (one wall and one wooden door between), 169.254.3.34. I could not believe that and I placed the second device to the same room as RPI. 192.168.1.120. Can connect via putty to RPI and RPI connects to internet.

Then I tried the Realtek dongle very near the RPI. It connected, 192.168.1.106.

Now, I suspect the emitting power of RPI.

Any idea what I could do?

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI3 connection with WPA2 (Hostname - I: 169.254.3.34)

Fri Oct 20, 2017 1:36 pm

You posted that ghost has a directional high gain antenna. You do realize the directional antenna is really directional, right?

kaksi
Posts: 94
Joined: Tue Mar 10, 2015 6:19 am

Re: RPI3 connection with WPA2 (Hostname - I: 169.254.3.34)

Sat Oct 21, 2017 7:51 pm

In fact, I would need a directional antenna on both ends (just not very handy for RPI). More in detail what I suspect:

The directional antenna works mostly one way:
- ghost emits a very concentrated beam, the part of power RPI receives is important
- RPI emits in all directions, there is only a marginal gain for ghost from the antenna (the surface is bigger)

If Realtek has a higher emitting power, it might make the difference. Unfortunately, it is not easy to move the hardware.

Realtek gets quite hot, RPI does not.

Return to “Beginners”