On our router (which has WiFi), we have one ethernet port which is currently being used by my laptop. I need my raspberry pi model B rev. 2 connected to the network as well, but it doesn't use WiFi. (My laptop can, but i prefer ethernet.) I don't want to purchase a network switch, so what I've been doing is sharing our family Macbook Pro's WiFi connection using internet sharing, and connecting the pi to the Macbook over ethernet. The pi now has internet, but here's the catch: I want to run a web server on the pi, and be able to access it from my laptop. Is there a way to port forward over internet sharing?

P.S. If it helps, the web server will be running on port 8080.

To visualize the setup:

 Home Router --+-- WiFi  -- MBP* -- Ether -- Pi
               +-- Ether -- Laptop

 * Internet Sharing 
  • Unfortunately, I won't be able to x11forward ssh into the mac and type in the pi's ip, because i haven't installed a browser that uses x11, and i dont want to. Commented Jul 20, 2020 at 1:35
  • I think i found my answer at this link. however, im not certain it will work so help is still appreciated. apple.stackexchange.com/questions/156847/… Edit: Nvm, natd does not exsist any more :( Commented Jul 20, 2020 at 2:06
  • If I understand you config correctly, you have a double NAT issue which causes all sorts of problems. There's a a NAT behind your router and and one one behind your Mac so the Pi is double NAT’ed. Get an inexpensive switch - port forwarding will be problematic at best
    – Allan
    Commented Jul 20, 2020 at 11:54
  • there is no nat in the macbook. if you could tell me how to forward port 8080 on the raspberry pi so that all tue other computers in my network (namely my laptop) can access it, that would be great. if you cant, then this question isn't for you. Commented Jul 20, 2020 at 11:58
  • You simply can’t have internet saring without a NAT network. What’s the IP addresses of all your interfaces including the Pi?
    – Allan
    Commented Jul 20, 2020 at 12:20

2 Answers 2


I got it! I wrote a node.js script, like so, to redirect requests on port 8080 of the macbook to port 8080 of the raspberry pi. the pi's ip is
the script:

var net = require('net');
net.createServer(function(socket) {
  var raspberrypi = net.connect(8080, '');
  raspberrypi.on('connect', function() {
    raspberrypi.on('data', function(data) {
    socket.on('data', function(data) {
  • The reason I accepted this answer is because it answers the question of internet sharing, not of fixing my wifi. Commented Jul 26, 2020 at 13:43

The reason I had to connect to the network via ethernet was because I lost the WiFi USB adapter for the pi. I found it and fixed it, and also got WiFi working on my laptop, so I'm very happy right now.

Also, I'm pretty sure someone will close this question for being too specific.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .