1

I have a device which is used to monitor analog sensor data(Micron optics sm130 ) with ethernet port available. It has

Static IP as 10.0.0.126 Netmask as 255.255.255.0 DHCP server disabled

Its works fine if If I connect it with my laptop using ethernet cable and by configuring my laptop's IP as static 10.0.0.12. I use enlight software to monitor. BUT.

I want to monitor it wirelessly i.e. I want to put this device at the site and want to monitor it at my office. How is it possible by using raspberry pi.I am connecting device with raspberry using ethernet cable and trying to connect my laptop wirelessly but nothing works so far how to proceed.? or if there any way without raspberry pi?

3
  • 2
    It is unclear what you are trying to achieve.
    – Milliways
    Commented Feb 12, 2019 at 4:35
  • 1
    so, what have you tried with the pi? have you set a 10.0.0.x IP on it? Commented Feb 12, 2019 at 5:27
  • I tried the solution suggested by @ingo & it worked for me in 1st trial. Now I am able to operate with my device wirelessly but in a limited range. Now my next step is to communicate with it from globally anywhere with least cost & dependency. So I am planning to connect my raspberry pi with a USB mobile internet dongle & hoping to operate it from anywhere. is there any way to do that? The articulation is same as told by ingo in the first answer of this question but I want internet using USB mobile internet dongle instead of wifi and wlan0.
    – bandejiya
    Commented Feb 14, 2019 at 6:41

1 Answer 1

5

It is a bit unclear how do you want to connect the Laptop to the Raspberry Pi. I will assume that there is no other wifi router as access point running for example to connect to the internet so you want to connect to the RasPi direct by wifi. You tagged a bridge so it is possible to bridge the wired interface eth0 to wifi interface wlan0. If you setup the RasPi as an access point then the Laptop can connect to it as station and with the bridge it should be able to access the Micron optics sm130 device.

Here is a diagram of the setup:

                        RPi
         wifi   ┌──────bridge──────┐   wired
laptop <.~.~.~> │(wlan0) br0 (eth0)│ <-------> sensor
      \                 /                     /
    10.0.0.12      10.0.0.13              10.0.0.126

For reference I use Raspbian Stretch Lite 2019-04-08 updated with sudo apt update && sudo apt full-upgrade && sudo reboot on 2019-04-14. I use systemd-networkd to configure this so we have first switch over to it.

♦ Switch over to systemd-networkd

For detailed information look at (1). Here only in short. Execute these commands:

# disable classic networking
rpi ~$ sudo -Es
rpi ~# systemctl mask networking.service
rpi ~# systemctl mask dhcpcd.service
rpi ~# mv /etc/network/interfaces /etc/network/interfaces~
rpi ~# sed -i '1i resolvconf=NO' /etc/resolvconf.conf

# enable systemd-networkd
rpi ~# systemctl enable systemd-networkd.service
rpi ~# systemctl enable systemd-resolved.service
rpi ~# ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

♦ Configure wpa_supplicant as access point

To configure wpa_supplicant as access point create this file with your settings for country=, ssid=, psk= and maybe frequency= You can just copy and paste this in one block to your command line beginning with cat and including EOF (delimiter EOF will not get part of the file):

rpi ~# cat > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf <<EOF
country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="RPiNet"
    mode=2
    key_mgmt=WPA-PSK
    proto=RSN WPA
    psk="password"
    frequency=2437
}
EOF

rpi ~# chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
rpi ~# systemctl enable [email protected]

♦ Setting up an access point with a bridge

Create the following three files to configure eth0 and br0.

rpi ~# cat > /etc/systemd/network/02-br0.netdev <<EOF
[NetDev]
Name=br0
Kind=bridge
EOF

rpi ~# cat > /etc/systemd/network/04-br0_add-eth0.network <<EOF
[Match]
Name=eth0
[Network]
Bridge=br0
EOF

rpi ~# cat > /etc/systemd/network/12-br0_up.network <<EOF
[Match]
Name=br0
[Network]
Address=10.0.0.13/24
EOF

Now we have to tell wpa_supplicant to use a bridge by adding the option -bbr0 when invoking it. We do it by modifying its service with:

rpi ~# systemctl edit [email protected]

In the empty editor insert these statements, save them and quit the editor. The empty ExecStart= is important. This will clear the original call so we can set it new:

[Service]
ExecStartPre=/sbin/iw dev wlan0 set type __ap
ExecStartPre=/bin/ip link set wlan0 master br0

ExecStart=
ExecStart=/sbin/wpa_supplicant -bbr0 -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -Dnl80211,wext -i%I

ExecStopPost=-/bin/ip link set wlan0 nomaster
ExecStopPost=-/sbin/iw dev wlan0 set type managed

Reboot.
That's it.

This is a specific and simplified subset for you from (2).


references:
[1] Howto migrate from networking to systemd-networkd with dynamic failover
[2] Setting up a Raspberry Pi as an access point - the easy way

5
  • Thanks @Ingo, I tried the solution suggested by you & it worked for me in 1st trial. now I am able to operate with my device wirelessly in a limited range. Now my next step is to communicate with it from globally anywhere with least cost & dependency. So I am planning to connect my raspberry pi with a mobile internet dongle & hoping to operate from anywhere. Please suggest me some way to do that.
    – bandejiya
    Commented Feb 14, 2019 at 6:39
  • @bandejiya Glad to help you :-) It would be nice if you could accept the answer. You can tick the tick under the arrow by my post. This will finish the question and show others that it has a solution. For your next requirement using an USB/4G dongle please open a new question. I will look at it.
    – Ingo
    Commented Feb 14, 2019 at 10:19
  • Hello @Ingo I posted a new question raspberrypi.stackexchange.com/questions/94359/… Please answer soon
    – bandejiya
    Commented Feb 19, 2019 at 6:28
  • Hello @ingo I am able to make the raspberry pi as a hotspot with help of your answer. And I am also able to connect raspberry pi to the internet via mobile usb dongle. but when I connect my smartphone wifi to raspberry pi hotspot it gets connected but no internet connection is there. how to resolve the issue? Only one step far.. aiming for 3g hotspot.. what are the respective commands?
    – bandejiya
    Commented Mar 5, 2019 at 6:16
  • @bandejiya Does the routing problem with your smartphone is also solved with your other question?
    – Ingo
    Commented Mar 7, 2019 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.