12

I'm running a Samba server on my MacBook and I've also set up port forwarding to said server from my router.

My public IP is 106.51.x.x (according to google and a few other services) and my Mac's local IP is 192.168.x.x, but when I head to my router's configuration page, it says my external IP is 10.242.x.x.

This is what I don't understand, when connected to my home WiFi, using the 10.242.x.x address works just fine. But if I try to access the same over 4G, the connection times out.

As for the public address, neither WiFi nor 4G works.

Is there some setting on my Mac (I'm running MacOS Sierra) that I must alter to make it visible to the public?

6
  • 2
    The question is now why - following grawity's answer - the asker wants to open up a samba server to public access over the web, seems unusual. Why not use FTP over SSL, say? Perhaps they really want to share between local machines?
    – pbhj
    Commented Aug 26, 2017 at 15:32
  • 6
    As @pbhj says, opening up samba to the Internet is a spectacularly bad idea.
    – Darren
    Commented Aug 26, 2017 at 19:02
  • Thank you for your advice. Im going to try and use vsftp instead.
    – Zohair
    Commented Aug 26, 2017 at 19:08
  • 2
    I believe some ISPs outright block the port, so even if you had a public IP address it could very well not work.
    – user541686
    Commented Aug 27, 2017 at 6:55
  • 1
    maybe try ngrok.io?
    – anna328p
    Commented Aug 28, 2017 at 16:26

1 Answer 1

26

Your router's address, 10.242.x.x, is also in a private-address range (all of 10.0.0.0/8 is reserved for LANs). This usually means your ISP implemented CGNAT and is sharing the same public 106.51.x.x address between several customers. (Just like your home router does, but at a broader scope.)

In this situation, you don't actually have a public address and cannot access your network from the outside directly.

Your first option is to set up a VPN connection to some external server, which has its own public IP address and can forward connections back to your home network (via the VPN).


As a side note, even though Samba is less risky than Windows, it's still not a very good idea to expose SMB to the public Internet. Older protocol versions don't support encryption (SMBv3 does, but it requires Samba 4.7 or Windows 8), so you would risk revealing your passwords and file data.

If you go with the VPN approach, I would recommend to use the VPN not just for the main server↔home link, but also when you're accessing the server itself from public 4G/Wi-Fi. (There are mobile apps for strongSwan, OpenVPN, OpenConnect...) That way you'll have a secure connection and won't need any port-forwarding.

8
  • 5
    This is very good advice. If you are going to expose a file server to the internet, make it only accessible, if you are connected to a VPN.
    – Ramhound
    Commented Aug 26, 2017 at 16:16
  • 3
    If all devices involved and the carriers too support IPv6, that could be a viable alternative. Also, some carriers can give you a public IPv4 on request.
    – matega
    Commented Aug 26, 2017 at 17:18
  • @matega IPv6 would only give him an external IPv6 address, not an IPv4 address. Also, IPv6 used to be quite popular, but that seems to be waning; I've seen more and more ISPs move to CGNAT instead out of security concerns. Many home users and small businesses don't know how to firewall IPv6, or are even aware of IPv6. Commented Aug 26, 2017 at 17:53
  • 2
    @KevinKeane According to Google's statistics, IPv6 use is still growing consistently.
    – marcelm
    Commented Aug 26, 2017 at 19:06
  • @KevinKeane: If customers are using ISP-provided (and ISP-configured) routers, then the security concerns are completely made up: the router can just as easily have a stateful firewall blocking incoming IPv6 connections as it [hopefully] already does for IPv4. Forgetting to do that is only a concern for custom setups. Commented Aug 26, 2017 at 19:21

You must log in to answer this question.

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