Wednesday, 22 February 2017

Samba and IP Forwarding



Samba can be used to share file and printer between linux to linux, linux to Unix and Linux to windows.

Service Profile

Type            :        System V Manage
Package       :        Samba, samba-common, samba-client
Daemon       :       smbd, nmbd
Script           :        smb
Port             :        167,168,169
Configuration file    :        /etc/samba/smb.conf
                                             /etc/samba/smbpasswd

Edit the file smb.conf
#vi /etc/samba/smb.conf
Workgroup = CORP
Server String = Samba
Host allow = 172.24.254.254/255.255.0.0
Then copy last 8 line
[jeet]
Path = /data
Valid users = jeet Deepak
Public = no
Writeable = yes
Browse able = yes
Save and exit

Now create a Users
#adduser jeet
#adduser Deepak

#smbpasswd –a jeet
#smbpasswd –a Deepak

Start the service
#service smb restart
#chkconfig smb on

On client side
#smbclient //172.24.254.254/jeet –U jeet
GUI
Smb://172.24.254.254
Mounting share folder
#smbmount //172.24.254.254/data /mnt –o username=Deepak

 IP Forwarding:-

In Linux, we can’t use a computer with two network interface to route between two or more subnet. To be able to do this we need to make sure that we enable IP forwarding. We should make sure that module is loaded. To check type
#cat /proc/sys/net/ipv4/ip-forward
If forwarding is enabled, the number 1 is returned. If forwarding is not enabled, the number 0 is returned.
To enable IP forwarding
#vi /etc/sysctl.conf
Line no.7
Net.ipv4.ip_forward = 1
Save and exit
To activate permanently
 #sysctl –p
Or another method is
#echo 1 >/proc/sys/net/ip_forward
This work for temporary use till system is ‘ON’

Now for the first network

#netconfig
            IP address                   :          172.24.254.254
            Subnet                         :           255.255.0.0
            Default Gateway         :           172.25.254.254
            Primary server            :           172.24.254.254

Second network
#netconfig –d eth0:1                          (-d : virtual)
IP Address                    :         172.25.254.254
Subnet                           :         255.255.0.0
Default Gateway           :         172.24.254.254
            Primary Server             :         172.24.254.254




No comments: