1

this is my first question on this site.

My problem is that i have an old PC lying around with no WiFi adapter but it has an Ethernet adapter.

I want to connect my Raspberry pi to WiFi then connect it with an Ethernet wire to the PC to share internet but how?

My board is Raspberry pi 3 b

3

1 Answer 1

2

There are several options to achieve what you want. It depends on your use case. If you do not need to access the PC from a device on your local network then you can use NAT (Network Address Translation) which makes routing configuration simple. Here is an example How to make Raspberry Pi 4 as “WIFI” -> “Ethernet” adaptor without add any USB component?.

If you want to access the PC from a remote device then you have to use static routing. This needs additional configuration of your home hotspot/internet router. Look at this example for it: Direct Ethernet IPCam and Wifi for browsing - Networking setup.

If you want to have the PC on the same subnet of your local network you can use proxy arp. This is the most transparent setup because the PC seems to be just on the local network like any other device but it is also the most sophisticated setup. Have a look at Workaround for a wifi bridge on a Raspberry Pi with proxy arp.

6
  • Your answers are great, but out of curiosity: Have you ever tried to do this using brctl (linux kernel bridge, the userspace command is part of bridge-utils)? I've only ever used it with containers (ie., virtual interfaces) but I don't see why it could not be used here, eg.: How do I configure a network interface bridge from WiFi to Ethernet with Debian? (may not work as is with Raspbian but configuring this directly in a short script is not hard).
    – goldilocks
    Commented Jun 26, 2021 at 14:10
  • @goldilocks Of course you can still use bridge-utils, hostapd, dnsmasq, iptables (for NAT) and other separate helpers to configure a Linux system. I have also done it before systemd. This fulfills the Unix paradigm to combine small and simple different programs to get a complex system. But this paradigm is from a time where no one have thought about parallel computing. This all works only synchronous. But nowadays really every processor comes with more than one core and synchronous execution is supported very badly.
    – Ingo
    Commented Jun 27, 2021 at 10:21
  • @goldilocks Systemd has been introduced since version Jessie and they do hard work to make it compatible with old style computing as most as possible otherwise they wouldn't have a chance to become accepted. The result is that parts of systemd is mixed with classic utilities with having old style synchronous working in mind. A typical bad example of this is Setting up a Raspberry Pi as a bridged wireless access point. But with more and more acceptance compatibility will be lost more and more.
    – Ingo
    Commented Jun 27, 2021 at 10:22
  • @goldilocks So I decided to consequently use only systemd. This is mainly to improve my own experience with modern all day parallel computing but share it with the community. This may not be easy for an experienced Unix user because he has to learn new things. But I am convinced that learning Unix for a newbie is easier with systemd because it is consistent managing only one system. Yes, I know the discussion about systemd to be monolithic and violate the Unix paradigm but I think that is the price we have to pay to follow parallel computing evolution.
    – Ingo
    Commented Jun 27, 2021 at 10:22
  • 1
    But you are right about the general point: The systemd method should be the simplest method and no less effective than anything else, meaning it should generally be preferred. I was just curious after reading your other stuff whether you were aware of the linux bridge and what you though of it.
    – goldilocks
    Commented Jun 27, 2021 at 12:37

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.