Advertisements

#MacOSX : Make your Mac a Wireless Network Bridge


Sometimes you need to extend wireless field; you can do it transforming your Mac as a Wireless Network Bridge.

Why  your Mac? Maybe a new shining Mac Book Pro? Well, let’s say your city has been hit by a big earthquake, so you had to leave your house, but your wireless network still works. Mobile Network won’t  work due to excessive overhead but you can still access internet to contact your friends and family. Sharing your internet connection give this chance also to many other people (this has been happened to me recently).

First you need a Switch or a Router or a Wireless Access Point and Ethernet cables.

Then:

  • Connect your mac to your wireless network
  • Connect Switch / Router / Wireless Access Point to Mac Ethernet port
  • Go to System Preferences -> Sharing
  • Check Internet Sharing
    • Share your connection from: Wi-Fi
    • To computers using: Ethernet and Bluetooth PAN
  • Let DHCP enabled

NOTE: this way you can connect to internet while you can maintain a secure distance from damaged buildings.

Advertisements

About whitehatty

Computer Engineer and Scientist interested in Computer Security, Complex Networks, Math, Biology and Medicine. "Think Different" life style. Quake 3 Arena player. NERD by DNA.

Posted on June 3, 2012, in Mac OS X Tips & Tricks and tagged , , , , , . Bookmark the permalink. 27 Comments.

  1. This isn’t a bridge. :/

  2. No, this is a NAT gateway or router. A bridge operates at the MAC addr level and doesn’t span different networks.

    • please read linked wikipedia article…

      • haha wikipedia. using wikipedia as proof is like using the campaign advertisements of politicians to prove they are decent people

      • Actually Wikipedia has shown to be quite reliable. That said, you have Google or books if you want a better reference.

      • This is most definitely not a bridge. Regardless of the semantics or the Wikipedia article (which is terrible) or whatever, the fact remains that what OSX creates when you enable internet sharing is, in fact, a routed NAT network. Devices connecting to the Mac get an entirely different subnet than the one the Mac is connecting to. Therefore, this is absolutely NOT acting as a bridge, it is a NAT router (routers operate at the network layer, or Layer 3. Bridges operate at the link layer, or Layer 2)

      • You might want add some flexibility to the categorization you just provided. Routers (and switches) can operate at a higher level than what you said, so if you strictly consider your definition they are not (Cisco sell them, just sayin’).
        Let me try to explain, once and for all.
        Wireless bridge in a network means a link between two devices, where the link is wireless. Now, as you can see, there isn’t a specification on how this can be achieved. If using natting or whatever else, It still is a wireless bridge. I can remove the word “network” if you find it is confusing, that’s it.

  3. whitehatty, they’re right, it’s not a bridge. When you bridge two networks together, it’s done at an ethernet protocol layer, not at a TCP/IP layer. These instructions clearly set the computer up as a router which routes traffic from one network to another. The differences are subtle, but one key difference is when two networks are bridged devices can talk directly one to another using physical MAC addresses. MAC addresses not on a network will be forwarded to the bridged connection, and vice versa.

    • … although, bridging can happen on any network protocol, I suppose. I don’t think what you describe is a bridge because bridges do not translate addresses.

    • Don’t stop on the word bridge and take the time to read the link to Wikipedia, please.
      Btw, if you look for fancy stuff you might be surprised to find that exist level 7 switches and routing then 🙂
      In all these cases the words bridge, switch and router assume a broader meaning than the one they have in the classic TCP/IP or ISO/OSI layering.
      CS PhD student here.

      • Words have meaning, especially where technical subjects are concerned. Since the subject at hand deals specifically with ethernet and TCP/IP, using meanings ascribed to those words from outside the scope of those two subjects is not helpful.

        Also goes to reinforce the idea that CS academics haven’t got the foggiest clue how stuff works out there in the real world.

      • Yes, words have meaning and it looks like you failed to keep up with them.

        No seriously, don’t make it personal…

  4. Mac Internet Connection Sharing is not a bridge in the normal meaning of the word.

    Normally when you say bridge you mean ‘level 2 network bridging’, which does not require a DHCP server, a separate IP subnet, IP routing, nor NAT.

    Internet Connection Sharing utilizes NAT and is thus a NAT-ed router and not a bridge.
    (it internally implements a DHCP server, allocates a new IP subnet for the wifi connection and does IP routing [with NAT])

    Among other things this means that if you have a computer ‘A’ connected to the wired port of the mac ‘B’ (likely via switch or switch+router, since you presumably also want to connect your internet connection here) and another one ‘C’ connected via the wireless sharing feature of ‘B’, then:
    ‘C’ can reach ‘B’ and ‘A’
    ‘B’ can reach ‘A’ and ‘C’
    ‘A’ can reach ‘B’ but cannot reach ‘C’

    Why?

    Because A and B are directly connected so can reach each other.
    Similarly B and C are directly connected and can thus reach each other.
    C can reach A (and the internet) because of the outgoing NAT translation.
    A cannot reach C because of the unidirectionality of NAT.

    In order to get A to be able to reach C you would need to setup port forwarding and/or use uPnP. [This is why games/voip devices/programs/etc often require you to configure port forwarding on your router/nat device]

    There appears to be a bit of a hack to get real (level 2) network bridging available at


    Which supposedly gets your wireless nic into host ap mode (without using Internet Connection Sharing), which combined with normal mac bridging of your wired and wireless interfaces should do the trick – ie. get you a real wireless ethernet bridge.

    In general for ad-hoc temporary situations (like in a hotel room or at a conference) the built-in Mac OS X ‘Internet Connection Sharing’ feature is perfect.

    But if you want a stationary mac (say a mac mini or an imac) [that, for example, you have more permanently placed at home] to effectively act as a wireless range extender then you really should go the hostap+bridge way. Even though that is clearly harder to configure.

    • Everything right, indeed I am not claiming it is a level 2 bridge…As I said earlier here the word “bridge” has a broader meaning, is it that hard to get it? Damn…
      Oh, bye the way, I will not reccomend the use of uPnP for security reasons. If you want forward/block packets from/to other subnets it is as easy as deploy a firewall rule, that is, you can create a whole virtual network on top of a physical network having completely different topology without any problem. [And I don’t know why you tell me this, since I just wrote that I have ample knowledge of the subject, lol]

      Now, the good part…the links on github, those might be useful to someone, even though I think there is no point having a Mac working that way [I repeat, IMHO]…well, what I mean is that you can have better performance and save a lot of money with a Linux box…

      Last, but not least…well, it was a temporary solution, an earthquake, got it?

      So, I don’t wan’t to be rude, but if the post is just to show your knowledge of the subject, what is the point? Everybody can google-paste what he finds, and then?
      Now, let’s talk about something that is more valuable; what’s the case scenario where you need a real level 2 bridge for a Mac [given that you can do the same with a router or a linux box]?

      • Case for needing a real Level 2 bridge with a Mac:
        1: Wifi only internet source (ISP’s router)
        2: Ethernet-only NAS
        3: 2 computers – 1x Mac Mini, 1x Macbook
        4: Both computers should be able to see and access the NAS for backups, etc.

        The ideal setup “feels” like
        – Mini connected to outside world by Wifi.
        – NAS connected to the ethernet port on the Mini
        – MacBook connects to the internet and the Mini AND the NAS over wifi.

        As it stands, I cannot get the Mini to correctly “bridge” the NAS to the same subnet as the wifi network, only to NAT the ethernet port through to the Internet on the outside of the ISP’s router.

  5. I left the above comment simply because I was looking for a solution to making a wired to wireless bridge out of my mac and this blog posting was one of the first hits on Google, but wasn’t particularly helpful.

    Anyway I have to go try the above linked code and see if I can figure out how to get it to make a WPA2 Personal Access Point…

  6. I would like to connect a DD-WRT (WRT-54GL) router to my Mac with an ethernet cable and share my WIFI from and external hi-gain USB WIFI adaptor which can reach the house from the workshop 150m away. The airport card cannot handle distance around the workshop. Anyone know how to do this?

  7. Its very simple NOW my Mac is behaving like a wifi bridge. Thank you for this post. Its been very useful to me.

  8. Old topic, still I’d like to configure this on my Mini as well. I simply want to share my WiFi Internet connection over Ethernet on OSX, nee, macOS 10.12 (aka Sierra). I have some basic knowledge on IP, still I’m either too stupid or Apple broke Internet Sharing in 10.12, possibly earlier.

    Any chance of opening up this old thread? TIA

    • As of right now, my Mac is not supported by Mac OS Sierra, so I can’t test it. I will try however on El Capitan later today and I’ll post an update if needed.

      • 1. Wow! Very kind! And a swift reply to boot.

        2. I don’t think the version should matter that much though. This is basic networking, and I can’t imagine Apple would enable/disable anything so basic at TCP/IP stuff.

        3. Please allow me to writeup my config, which I’ll post later on.

        BIG thanks!

  9. Internet > ISP > DSL modem > Ethernet cable > AirPort Express > WiFi > MacMini

    That’s basically my current setup. Other Macs also connecting to the Internet over WiFi, but seems irrelevant. Anyway, That MacMini sits next to my TV in the living, and I simply want to share its Internet connection (from WiFi) over the Ethernet port, just so I can hook up my TV/DVD player/DVR so that’ll have Internet access as well. That’s either device, not all at once, no hub, couplers or anything.

    1. MacMini/SysPrefs/WiFi connects to AirPort Express, successfully, getting its IP over DHCP.
    2. MacMini/SysPrefs/Ethernet enabled. Set it to DHCP, but don’t know if that should be the case. DHCP with manual address didn’t work either, not does a static IP.
    3. MacMini/SysPrefs/Internet Sharing. Set to ’Share your connection from: WiFi…to computers using: Ethernet. (I have Remote Management enabled, as well as ssh and Screen Sharing, but that shouldn’t matter, right?)
    4. LAN cable, a straight one or CrossOver – doesn’t matter; neither works.
    5. DVR set to DHCP, doesn’t work. (Neither does static IP)
    6. Checked the port config on both. Can’t config the DVR, but the MacMini is set to automatically (instead of hardcoded 1000Mbps / Full Duplex bladibla)

    Various blogs and articles to be found on the Internet. But as they say, it’s an oasis of info. But getting something useful is another matter.

    • Hi, I tested mac os El Capitan and it seems to work.
      Specifically, my setup is:
      modem/router > ethernet cable > macbook pro > ethernet cable > access point.
      The devices that need to access the shared connection connects to the access point.
      DHCP is enabled everywhere.

  10. Thanks for getting back to me.

    It doesn’t work at my end, config:
    Internet > ISP > DSL modem > Ethernet cable > AirPort Express > WiFi > MacMini > Ethernet port on MacMini > (straight) LAN cable > DVR.

    All set to DHCP.
    On Mac, which has a valid IP and connects to the Internet:
    1) /SysPrefs/Sharing/Internet Sharing/ Share your connection from: WiFi To computers using: Ethernet.
    2) /SysPrefs/Network/Ethernet/DHCP and it gives me a 169 address.
    The DVR is set to DHCP and doesn’t get an IP.

    I’m missing something so obvious I’m completely overlooking it…

    • Try to connect an access point or router before the dvr and check if it works

      • Succes! I hooked up a laptop, DHCP is getting an 10.0.0. address What I don’t understand is:
        1) The Internet Sharing on the MacMini is giving a 169 address to the ethernet port. I would’ve expected a subnet of the 10.0.0.0 address, but I have no knowledge on subletting, so there.
        2) The client is getting a 192.254.* address: why isn’t that a 169.* address?
        3) The more important question, for me, is: My Mac Pro is on the same WiFi as the MacMini. Why can’t I ping that 192.254 address from there? I can only reach it from he MacMini. Perhaps that’s just as good as well: this way I’m forced to ftp onto the DVR from the MacMini, making me copy content on a USB stick or SD Card. That will be so much faster than ftp-ing over WiFi (n).

        Anyway, thank you very much for your time and help. Much appreciated!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: