Setting up WiFi over SSH, without using DietPi-config

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Setting up WiFi over SSH, without using DietPi-config

Post by Fourdee »

beerenheini wrote: I'd like to set up my Wireless Connection. Doing so with dietpi-config drops ethernet connection and obviously I lose being able to ssh into the pi.
In the next DietPi release (v116):
You will now be able to configure both adapters in dietpi-config, at the same time, without having to disable the other.
https://github.com/Fourdee/DietPi/issues/265

V116 should be out in a few days.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
beerenheini
Posts: 16
Joined: Tue Mar 15, 2016 2:56 pm

Re: Setting up WiFi over SSH, without using DietPi-config

Post by beerenheini »

Perfect, thanks for the update!
User avatar
k-plan
Posts: 416
Joined: Sun Feb 28, 2016 5:28 pm

Re: Setting up WiFi over SSH, without using DietPi-config

Post by k-plan »

RPi3 with build-in Wifi

Code: Select all

 ───────────────────────────────────────
 DietPi     | 13:18 | Sun 01/05/16
 ───────────────────────────────────────
 V117       | Raspberry Pi 3 Model B
 ───────────────────────────────────────
 
 root@RPi-3-test:~# dmesg
  . . .
[    3.675159] brcmfmac: brcmf_sdio_drivestrengthinit: No SDIO Drive strength init done for chip 43430 rev 1 pmurev 24
[    3.676350] usbcore: registered new interface driver brcmfmac
[    3.870719] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Dec 15 2015 18:10:45 version 7.45.41.23 (r606571) FWID 01-cc4eda9c
[    4.027452] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
[    4.027500] cfg80211: World regulatory domain updated:
[    4.027510] cfg80211:  DFS Master region: unset
[    4.098267] brcmfmac: power management disabled



root@RPi-3-test:~# lshw
 . . .
  *-network:0
       description: Wireless interface
       physical id: 2
       logical name: wlan0
       serial: b8:27:eb:xx:xx:xx
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=brcmfmac driverversion=7.45.41.23 firmware=01-cc4eda9c ip=192.168.0.100 multicast=yes wireless=IEEE 802.11bgn
       
       
root@RPi-3-test:~# uname -a
Linux RPi-3-test 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux


root@RPi-3-test:~# cat /proc/version
Linux version 4.1.19-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #858 SMP Tue Mar 15 15:56:00 GMT 2016


root@RPi-3-test:~# iwlist wlan0 channel
wlan0     11 channels in total; available frequencies :
          Channel 01 : 2.412 GHz
          Channel 02 : 2.417 GHz
          Channel 03 : 2.422 GHz
          Channel 04 : 2.427 GHz
          Channel 05 : 2.432 GHz
          Channel 06 : 2.437 GHz
          Channel 07 : 2.442 GHz
          Channel 08 : 2.447 GHz
          Channel 09 : 2.452 GHz
          Channel 10 : 2.457 GHz
          Channel 11 : 2.462 GHz
          Current Frequency:2.412 GHz (Channel 1)
          
Last official Kernel : Linux 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux
and brcmfmac WiFi Firmware version = wl0: Dec 15 2015 18:10:45 version 7.45.41.23 (r606571)

# only support Channel 01 - Channel 11 (no Channel 12 + 13) #

==============================
It's a kernel bug and the hardware does not support channels 12 & 13 in Germany. Kernel 4.4 apparently fixes it.

Can you help me with upgraden the kernel in DietPi?
IMPORTANT: - Only for Testing ! - :
  • Upgrade to the latest Kernel and Firmware (not recommend to do this !!!)

Code: Select all

root@RPi-3-test:~# dietpi-config 

=> 4  Advanced Options  
=> 4 Update Firmware
=> reboot
DietPi - Advanced Options
DietPi - Advanced Options

Code: Select all

 ───────────────────────────────────────
 DietPi     | 14:02 | Sun 01/05/16
 ───────────────────────────────────────
 V117       | Raspberry Pi 3 Model B
 ───────────────────────────────────────



 root@RPi-3-test:~# dmesg
  . . .
[    4.193627] brcmfmac: brcmf_sdio_drivestrengthinit: No SDIO Drive strength init done for chip 43430 rev 1 pmurev 24
[    4.194241] usbcore: registered new interface driver brcmfmac
[    4.342817] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Dec 15 2015 18:10:45 version 7.45.41.23 (r606571) FWID 01-cc4eda9c
[    4.368110] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
[    4.381683] cfg80211: World regulatory domain updated:
[    4.381694] cfg80211:  DFS Master region: unset
[    4.476007] brcmfmac: power management disabled


root@RPi-3-test:~# lshw
 . . .
  *-network:0
       description: Wireless interface
       physical id: 2
       logical name: wlan0
       serial: b8:27:eb:xx:xx:xx
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=brcmfmac driverversion=7.45.41.23 firmware=01-cc4eda9c ip=192.168.0.100 multicast=yes wireless=IEEE 802.11bgn



root@RPi-3-test:~# uname -a
Linux RPi-3-test 4.4.8-v7+ #881 SMP Sat Apr 30 12:16:50 BST 2016 armv7l GNU/Linux


root@RPi-3-test:~# cat /proc/version
Linux version 4.4.8-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #881 SMP Sat Apr 30 12:16:50 BST 2016


root@RPi-3-test:~# iwlist wlan0 channel
wlan0     11 channels in total; available frequencies :
          Channel 01 : 2.412 GHz
          Channel 02 : 2.417 GHz
          Channel 03 : 2.422 GHz
          Channel 04 : 2.427 GHz
          Channel 05 : 2.432 GHz
          Channel 06 : 2.437 GHz
          Channel 07 : 2.442 GHz
          Channel 08 : 2.447 GHz
          Channel 09 : 2.452 GHz
          Channel 10 : 2.457 GHz
          Channel 11 : 2.462 GHz
          Current Frequency:2.412 GHz (Channel 1)


edit:
  • Test and set the correct regulatory domain:

Code: Select all


root@RPi-3-test:~# iw reg get
country 00: DFS-UNSET
        (2402 - 2472 @ 40), (N/A, 20), (N/A)
        (2457 - 2482 @ 40), (N/A, 20), (N/A), NO-IR
        (2474 - 2494 @ 20), (N/A, 20), (N/A), NO-OFDM, NO-IR
        (5170 - 5250 @ 80), (N/A, 20), (N/A), NO-IR
        (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, NO-IR
        (5490 - 5730 @ 160), (N/A, 20), (0 ms), DFS, NO-IR
        (5735 - 5835 @ 80), (N/A, 20), (N/A), NO-IR
        (57240 - 63720 @ 2160), (N/A, 0), (N/A)


root@RPi-3-test:~# iw reg set DE


root@RPi-3-test:~# iw reg get
country DE: DFS-ETSI
        (2400 - 2483 @ 40), (N/A, 20), (N/A)
        (5150 - 5250 @ 80), (N/A, 20), (N/A), NO-OUTDOOR
        (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS
        (5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS
        (57000 - 66000 @ 2160), (N/A, 40), (N/A)


root@RPi-3-test:~# iwlist wlan0 channel
wlan0     13 channels in total; available frequencies :
          Channel 01 : 2.412 GHz
          Channel 02 : 2.417 GHz
          Channel 03 : 2.422 GHz
          Channel 04 : 2.427 GHz
          Channel 05 : 2.432 GHz
          Channel 06 : 2.437 GHz
          Channel 07 : 2.442 GHz
          Channel 08 : 2.447 GHz
          Channel 09 : 2.452 GHz
          Channel 10 : 2.457 GHz
          Channel 11 : 2.462 GHz
          Channel 12 : 2.467 GHz
          Channel 13 : 2.472 GHz
          Current Frequency:2.412 GHz (Channel 1)


  • To make this setting permanent:

Code: Select all


root@RPi-3-test:~# sed -i "s/REGDOMAIN=/REGDOMAIN=DE/g" /etc/default/crda


root@RPi-3-test:~# cat /etc/default/crda
# Set REGDOMAIN to a ISO/IEC 3166-1 alpha2 country code so that iw(8) may set
# the initial regulatory domain setting for IEEE 802.11 devices which operate
# on this system.
#
# Governments assert the right to regulate usage of radio spectrum within
# their respective territories so make sure you select a ISO/IEC 3166-1 alpha2
# country code suitable for your location or you may infringe on local
# legislature. See `/usr/share/zoneinfo/zone.tab' for a table of timezone
# descriptions containing ISO/IEC 3166-1 alpha2 country codes.

REGDOMAIN=DE

  • Reboot and testing:

Code: Select all


root@RPi-3-test:~# reboot


root@RPi-3-test:~# dmesg
 . . .
[    4.454422] cfg80211: Regulatory domain changed to country: DE
[    4.454444] cfg80211:  DFS Master region: ETSI
[    4.454454] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[    4.454469] cfg80211:   (2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    4.454486] cfg80211:   (5150000 KHz - 5250000 KHz @ 80000 KHz, 200000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[    4.454500] cfg80211:   (5250000 KHz - 5350000 KHz @ 80000 KHz, 200000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[    4.454513] cfg80211:   (5470000 KHz - 5725000 KHz @ 160000 KHz), (N/A, 2698 mBm), (0 s)
[    4.454525] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)


root@RPi-3-test:~# iwlist wlan0 channel
wlan0     13 channels in total; available frequencies :
          Channel 01 : 2.412 GHz
          Channel 02 : 2.417 GHz
          Channel 03 : 2.422 GHz
          Channel 04 : 2.427 GHz
          Channel 05 : 2.432 GHz
          Channel 06 : 2.437 GHz
          Channel 07 : 2.442 GHz
          Channel 08 : 2.447 GHz
          Channel 09 : 2.452 GHz
          Channel 10 : 2.457 GHz
          Channel 11 : 2.462 GHz
          Channel 12 : 2.467 GHz
          Channel 13 : 2.472 GHz
          Current Frequency:2.412 GHz (Channel 1)



:arrow: Result : Done ! :D
Last edited by k-plan on Mon May 02, 2016 8:17 am, edited 2 times in total.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.
User avatar
k-plan
Posts: 416
Joined: Sun Feb 28, 2016 5:28 pm

Re: Setting up WiFi over SSH, without using DietPi-config

Post by k-plan »

Fourdee wrote:..
You will now be able to configure both adapters in dietpi-config, at the same time, without having to disable the other.
DietPi - Network Options: Adapters
DietPi - Network Options: Adapters
Now in DietPi release v117 it works nearly perfect.
You can configure and set active ethernet and wifi connection per dietpi-config, plugging in or out cable or adapter.
Established connection from the device will working along and you can connect via SSH to wlan or eth IP addresses.

https://github.com/Fourdee/DietPi/issues/273

Thanks to @Fourdee for implement this. :)
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Setting up WiFi over SSH, without using DietPi-config

Post by Fourdee »

k-plan wrote:Thanks to @Fourdee for implement this. :)
And many thanks to you for your assistance with this one :)
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
k-plan
Posts: 416
Joined: Sun Feb 28, 2016 5:28 pm

Re: Setting up WiFi over SSH, without using DietPi-config

Post by k-plan »

No problem, my pleasure!

BTW: - now you have to do a little update on DietPi-Config and explain new feature like Proxy, NAS a. Network Feature, Firmware Update, DNS and so on.
http://dietpi.com/phpbb/viewtopic.php?f=8&t=63

:D
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.
User avatar
k-plan
Posts: 416
Joined: Sun Feb 28, 2016 5:28 pm

Re: Setting up WiFi over SSH, without using DietPi-config

Post by k-plan »

Hi,

I have done a update to my previous posting: http://dietpi.com/phpbb/viewtopic.php?p=1701#p1701

(note for myself: have to do a new test with fresh install)
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.
Gord_W
Posts: 134
Joined: Sat Oct 24, 2015 6:30 pm

Re: Setting up WiFi over SSH, without using DietPi-config

Post by Gord_W »

I'm also having problems setting up a rpi3 with wifi after using ethernet for a time headless.

Using V135.

What I am finding is that when I have ethernet connected to the router and wifi with ip 192.168.1.100 and 192.168.1.103 when I send requests to wifi the Rx byte count increases on the wifi but the tx byte count doesn't while eth tx byte count increases. Therefore the data to rpi appears to be going in through wifi and the reply comes out through ethernet.

When I unplug ethernet, even though I'm ssh through wifi, the ssh connection fails. There is no return path for ssh data when ethernet is disconnected. There is no way to reconnect. I've tried all sorts of things and this has me baffled.

I had this working on a rpi B a year ago and it worked fine. Change in dietpi version?

Regards,
Gordon

Some examples below to try and illustrate the problem.

From the desktop ping 192.168.1.103 wifi to produce some data through .103

root@DietPi:~# ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:9e:47:6e
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3095 errors:0 dropped:0 overruns:0 frame:0
TX packets:5453 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:179569 (175.3 KiB) TX bytes:1578246 (1.5 MiB)

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:1126 errors:0 dropped:0 overruns:0 frame:0
TX packets:1126 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:94312 (92.1 KiB) TX bytes:94312 (92.1 KiB)

wlan0 Link encap:Ethernet HWaddr b8:27:eb:cb:12:3b
inet addr:192.168.1.103 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2822 errors:0 dropped:8 overruns:0 frame:0
TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:238722 (233.1 KiB) TX bytes:1429 (1.3 KiB)

wait a few seconds ... and repeat

root@DietPi:~# ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:9e:47:6e
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3097 errors:0 dropped:0 overruns:0 frame:0
TX packets:5530 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:179661 (175.4 KiB) TX bytes:1588008 (1.5 MiB)

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:1126 errors:0 dropped:0 overruns:0 frame:0
TX packets:1126 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:94312 (92.1 KiB) TX bytes:94312 (92.1 KiB)

wlan0 Link encap:Ethernet HWaddr b8:27:eb:cb:12:3b
inet addr:192.168.1.103 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2921 errors:0 dropped:8 overruns:0 frame:0
TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:247647 (241.8 KiB) TX bytes:1429 (1.3 KiB)

Difference Rx, Tx between the two
eth0 RX packets:3095
TX packets:5453

RX packets:3097
TX packets:5530
Rx traffic 2 packets
Tx traffic 77 packets

wlan0 RX packets:2822
TX packets:9

RX packets:2921
TX packets:9
Rx traffic 99
Tx traffic none

So to me this means that the data is going into wifi and reply is coming back on ethernet. Why would rpi route it like that?

Other info:
root@DietPi:~# iwconfig
wlan0 IEEE 802.11bgn ESSID:"Williams"
Mode:Managed Frequency:2.412 GHz Access Point: 6F:66:B3:F4:35:AB
Bit Rate=65 Mb/s Tx-Power=31 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=70/70 Signal level=-23 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

lo no wireless extensions.

eth0 no wireless extensions.


#/etc/network/interfaces
# Local
auto lo
iface lo inet loopback

# Ethernet
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1

# Wifi
auto wlan0
iface wlan0 inet dhcp
#address 192.168.1.100
#netmask 255.255.255.0
#gateway 192.168.1.1
#wireless-essid Williams
#wireless-key xxx
wireless-mode Managed
wireless-power off
wpa-ssid Williams
wpa-psk xxx
Gord_W
Posts: 134
Joined: Sat Oct 24, 2015 6:30 pm

Re: Setting up WiFi over SSH, without using DietPi-config

Post by Gord_W »

I will try and do a fresh install to see if that fixes things.

Edit:
OK, I put on the latest version of dietpi. I edited the dietpi.txt file to enable wifi and disable ethernet

I got the wifi up and working.

Went to enable the ethernet through the dietpi menus and set ethernet to static address and filled out IP address parameters. Clicked OK to upadate with the message that connections would be dropped.
Reconnecting Ethernet , please wait

DietPi-Services
─────────────────────────────────────────────────────
Mode: stop
Please wait...

[Ok] cron
[Ok] proftpd

[Info] Dropping connections, please wait...

--- So wifi connection was dropped. Now I cant reconnect to wifi :cry:
gordon@gordon-linux ~ $ ssh root@192.168.1.103
ssh: connect to host 192.168.1.103 port 22: No route to host

Before I got to this point there were two programs that were downloaded and installed: iproute and netplug (I think) Could it be one of these programs that is screwing things up?

Will try and plug the ethernet in to see if I can get a ssh connection through ethernet.
Gord_W
Posts: 134
Joined: Sat Oct 24, 2015 6:30 pm

Re: Setting up WiFi over SSH, without using DietPi-config

Post by Gord_W »

Plugged in the ethernet and got a ssh connection. Looks like the wifi has been lost ---- Access Point: Not-Associated
root@DietPi:~# ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:9e:47:6e
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1287 errors:0 dropped:2 overruns:0 frame:0
TX packets:83 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:104217 (101.7 KiB) TX bytes:12682 (12.3 KiB)

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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

wlan0 Link encap:Ethernet HWaddr b8:27:eb:cb:12:3b
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:686 errors:0 dropped:30 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:65678 (64.1 KiB) TX bytes:1028 (1.0 KiB)

root@DietPi:~# iwconfig
wlan0 IEEE 802.11bgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=31 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Post Reply