Bind AFP and CIFS to seperate IPs and Hostnames?

Status
Not open for further replies.

Spunky12

Dabbler
Joined
Sep 7, 2015
Messages
15
I've tried finding a solution to this but I just can't seem to find anything about it.

I have both Macs and Windows systems in my house. Since Macs can speak bot AFP and CIFS and windows can only do CIFS I settled on CIFS as my default file sharing method. I would however like to have a dedicated AFP share running to support Time Machine backups for my Macs. As per the FreeNAS docs it's not good to share out the same share under both AFP and CIFS so I have a dedicated share and dataset for just Time Machine use. The issue I am having is that the Macs can only browse the AFP share by default and not see any of the CIFS shares on my FreeNAS server. I can of course browse to them using the "connect to server" option in finder and enter "smb://freenasserver" but this is a pain for the less technical members of the household.

So, is there a way in FreeNAS to setup a dedicated IP address for AFP and one for CIFS and have them show up in my network accordingly?

Thanks!
 

rogerh

Guru
Joined
Apr 18, 2014
Messages
1,111
I don't think it is a complete solution by any means, as I can't really get the CIFS shares to advertise themselves on the network, but you can use a different netbios name in the Service/CIFS dialogue from the FreeNAS hostname, and that does make it easier to separate the two services on the Mac. If you also give the AFP shares a unique username and password that only Time Machine knows then users aren't bothered by seeing these shares at all.
But, as I say, I haven't really got it all to work transparently.
 

Spunky12

Dabbler
Joined
Sep 7, 2015
Messages
15
I have a separate data set already for AFP and for CIFS shares. I am only sharing out one thing using AFP and that is the data set I am using for time machine backups.

The problem is that Macs will by default use AFP and not see the CIFS shares.

I want to know if there is a way to have this:
server - freenas box for management and such
serverA - sharing via AFP for time machine
serverB - sharing via CIFS

Have all the above coming out of just one physical server running FreeNAS.
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
3 servers? You can't use 3 servers as one with freenas.

You can share the same dataset out over 2 different protocols, but its not recommended, due to possible corruption of open files, etc.
 

Robert Trevellyan

Pony Wrangler
Joined
May 16, 2014
Messages
3,778
The issue I am having is that the Macs can only browse the AFP share by default and not see any of the CIFS shares on my FreeNAS server.
Did you check the box labelled "Zeroconf share discovery:" in the CIFS service settings?
 

Spunky12

Dabbler
Joined
Sep 7, 2015
Messages
15
All, they are not 3 seperate servers.

server is the phyiscal box and the base IP address, say 192.168.1.41.
servera is an alias on the phyiscal interface, say 192.168.1.42.
serverb is an alias on the physical interface, say 192.168.1.43.

Can you bind servera to AFP and server b to CIFS?

My DNS is currently running on a Windows 2012 Server.
 

rogerh

Guru
Joined
Apr 18, 2014
Messages
1,111
All, they are not 3 seperate servers.

server is the phyiscal box and the base IP address, say 192.168.1.41.
servera is an alias on the phyiscal interface, say 192.168.1.42.
serverb is an alias on the physical interface, say 192.168.1.43.

Can you bind servera to AFP and server b to CIFS?

My DNS is currently running on a Windows 2012 Server.
I'm pretty sure you can't do it in the FreeNAS GUI. Whether you can do it at all in FreeBSD I have no idea.
 

rogerh

Guru
Joined
Apr 18, 2014
Messages
1,111
I don't see why you couldn't.
I am definitely not an expert, but a glance at man smb.conf suggests that you can confine nmbd and smbd to one subnet, but not to one IP address on a particular subnet. I could, of course, be wrong.
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
I am definitely not an expert, but a glance at man smb.conf suggests that you can confine nmbd and smbd to one subnet, but not to one IP address on a particular subnet. I could, of course, be wrong.
Yeah. I was thinking that you could specify the IP address that the service listens on...
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
You can confine samba to a single IP address. The parameter even has an entry in the webgui. Services -> CIFS "Bind IP Address", which corresponds to the interfaces parameter in the smb.conf file.
I was actually looking for this in the docs but have been busy and only on here from my phone since yesterday. Didn't have access to my system to try it out for myself.
 

Nick2253

Wizard
Joined
Apr 21, 2014
Messages
1,633

Savage

Dabbler
Joined
Jul 7, 2014
Messages
21
Alas it is probably best to just set it up with pure SMB. Or chuck a usb drive on some random desktop mac and put the now cheap mac os x server on it just for the time machine service.

FreeNAS does some sort of zeroconfig/bonjour funkyness when it advertises that tweaks OSX being able to pickup both SMB and AFP shares off of it. When queried OSX or linux devices will show as distinctive afp and smb servers. Freenas just shows as one or the other. There are transitional add-ons for samba to help with samba/netatalk integration that FreeNAS doesn't have either. Basically you are stuck doing things AFP only or SMB only.

On my macs I get around this crap due to using Path Finder which has a different interface for connection and using saved afp:// smb:// urls is more convenient. Not a solution that helps 99% of other mac users :/.

So. .semi-simple workaround. You could Applescript your way around the problem. Use the Script editor and export the following as an application. Set to run @login or put it in your kid's dock to click-to-connect the SMB shares. It will show the standard user/password prompt that allows saving the password to the keychain. Or if you aren't as security conscious you can specify the url as 'smb://username:password@192.168.1.1/foo' etc.

Code:
tell application "Finder"
    tell application "Finder" to open location "smb://192.168.1.*/sharename1"
    tell application "Finder" to open location "smb://192.168.1.*/sharename2"
    tell application "Finder" to open location "smb://192.168.1.*/sharename3"
end tell
 

Spunky12

Dabbler
Joined
Sep 7, 2015
Messages
15
I don't think it is a complete solution by any means, as I can't really get the CIFS shares to advertise themselves on the network, but you can use a different netbios name in the Service/CIFS dialogue from the FreeNAS hostname, and that does make it easier to separate the two services on the Mac. If you also give the AFP shares a unique username and password that only Time Machine knows then users aren't bothered by seeing these shares at all.
But, as I say, I haven't really got it all to work transparently.

Everyone, thanks to all of you for your responses.

I tried them all out but I found the quote above from "rogerh" to work the best.

Doing Time Machine to CIFS works the best but when you want to restore via the Command R option on the MACs it can't find the CIFS share.

Basically what I settled was allowing the AFP to share out with the hostname of the FreeNAS box and binding AFP to the main IP through the AFP Service dialog. I then added an alias to my main NIC (lagg0) and then entered a new name in my DNS for that IP. Then through the CIFS Service dialog I entered that server name for the NETBIOS name and then bound the service to the alias IP. So far it's accomplishing what I want, two seperate entries for my FreeNAS box with native file shares on each.

Again, thanks to all!
 

rogerh

Guru
Joined
Apr 18, 2014
Messages
1,111
Using an alias and local DNS seems like a definite improvement on my system - I've never got WINS service to work properly.
 

jchan94

Explorer
Joined
Jul 30, 2015
Messages
55
Everyone, thanks to all of you for your responses.

I tried them all out but I found the quote above from "rogerh" to work the best.

Doing Time Machine to CIFS works the best but when you want to restore via the Command R option on the MACs it can't find the CIFS share.

Basically what I settled was allowing the AFP to share out with the hostname of the FreeNAS box and binding AFP to the main IP through the AFP Service dialog. I then added an alias to my main NIC (lagg0) and then entered a new name in my DNS for that IP. Then through the CIFS Service dialog I entered that server name for the NETBIOS name and then bound the service to the alias IP. So far it's accomplishing what I want, two seperate entries for my FreeNAS box with native file shares on each.

Again, thanks to all!

Read your post and found it very interesting. I'm wondering if you've figured out a more elegant solution as I have a very similar setup that can mimic yours.

I currently use CIFS for Windows Shares, and an AFP time machine backup for my MBP but since CIFS doesn't advertise the shares/machine, I have to manually connect to it. I'm wondering how you handle cross platform sharing (unless you just manually connect to the CIFS shares).
 
Status
Not open for further replies.
Top