If you want to give only read permission and not write permission, open up your configuration file, the path to which is
Inside this file, move down to the share name of your directory.
Now there must be an option write list. Either comment this or remove this option. This will now not allow anyone to write. To give read permissions, use these 2 options -
valid users=User1 user2 user3
Now to allow only hosts from particular IP addresses, use option hosts allow.
For example, if share name of your directory is abc, then your configuration for this file should like this:
valid users=john mike
hosts allow=127.0.0.0/24 // it must be IP of hosts you want to allow
Save your configuration file, enable service samba on firewall, and restart services smb nmb .