0

For a certain project I have a very specific need to connect a Raspberry Pi with an unrooted android tablet through a UTP cable (with an adapter on the android side).

Both of these devices work fine if plugged into a separate router individually, since the tablet then gets a DHCP IP and all is well (being unrooted, it cannot have a static one unfortunately). Not so much when I try to connect them directly I cannot get the connection to work.

The option I was pursuing thus far was to set up a DHCP server on the Pi and have that set the IP on the tablet once it's connected. I've followed like 5 Pi DHCP tutorials by now and none of them worked so I'm slowly starting to reconsider this idea. Perhaps DHCP cannot work without a cross-over cable?

Another thing would be a direct bridge connection for which I'm not entirely sure where to start.

Any tips on what to pursue?

Moff Kalast
  • 124
  • 1
  • 7

1 Answers1

0

I have tested this tiny setup with systemd-networkd using a fresh flashed Raspbian Buster Light. Just switch to systemd-networkd with:

# disable classic networking
rpi ~$ sudo -Es
rpi ~# systemctl mask networking.service 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 systemd-resolved.service
rpi ~# ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

For more details look at Howto migrate from networking to systemd-networkd with dynamic failover.

Now create this file and reboot:

rpi ~# cat > /etc/systemd/network/04-eth0.network <<EOF
[Match]
Name=eth0
[Network]
Address=192.168.1.120/24
DHCPServer=yes
EOF

I couldn't test it with an android device because I haven't this ethernet dongle but with my laptop it works without problems. It gets an ip address from 192.168.1.0/24 and I can ping 192.168.1.120.

Ingo
  • 42,961
  • 20
  • 87
  • 207