Saturday, July 26, 2008

Configuration of bind, named, dns server

This is simple guide for configuration of bind, named, dns server and so...

Let's go to install named(bind) from your linux distribution...

There is one general configuration file:

---------------------------------

/etc/named.conf

options {
directory "/var/named";

};

# named.root is available at ftp://ftp.internic.net/domain/named.root

zone "." IN {
type hint;
file "named.root";
};

# Here is zone for domain ustrem.org

zone "ustrem.org" IN {
type master;
file "ustrem.org";
allow-transfer { none; };
allow-update { none; };

};

# Here is reverse zone zone for net 192.168.2.0/255.255.255.0

zone "2.168.192.in-addr.arpa" {
type master;
file "loc";
allow-update { none; };
};

----------------------------------------------------

Here is ustrem.org's zone file

-----------------------------

/var/named/ustrem.org

$ORIGIN .
$TTL 86400 ; 1 day
ustrem.org IN SOA pns.ustrem.org. onzi.ustrem.org. (

# onzi.ustrem.org is email for contacts (onzi_at_ustrem_dot_org)


2006083102 ; serial

# This is stamp for date and time and number of day change


3600 ; refresh (8 hours)
1800 ; retry (4 hours)
86400 ; expire (5 weeks 6 days 16 hours)
3600 ; minimum (1 day)
)
NS pns.ustrem.org.
NS ns1.xname.org.

# NS records for domain


A 213.240.243.12

# This line shows "ustrem.org" is with IP 213.240.243.12


MX 10 mail.ustrem.org.

# Here is SMTP server which received mails for ustrem.org


TXT "v=spf1 mx a:mail.b-trust.org a:mailrelay.bsbg.net -all"

# This is text record for prevent from spammers and spoofers. Here is SMTP-s which sends emails from ustrem.org

$ORIGIN ustrem.org.

* A 213.240.243.12

# some-does-not-described.ustrem.org is with IP 213.240.243.12


bobi A 213.240.227.125
pns A 213.240.243.12

*.bobi CNAME bobi.ustrem.org.

boiko A 84.238.128.65
george A 213.240.242.107


laptoper4e A 192.168.2.18
mitkosipc A 192.168.2.4
pi-server A 192.168.2.15
pz A 217.10.245.249
router A 192.168.2.24

----------------------------------------------------------------------------------

Here is reverse resolv

---------------------------------------------

/var/named/loc

$ORIGIN .
$TTL 86400 ; 1 day
2.168.192.in-addr.arpa IN SOA pns.ustrem.org. onzi.ustrem.org. (
2006080302 ; serial
28800 ; refresh (8 hours)
14400 ; retry (4 hours)
3600000 ; expire (5 weeks 6 days 16 hours)
86400 ; minimum (1 day)
)
NS pns.ustrem.org.
NS sns.ustrem.org.

$ORIGIN 2.168.192.in-addr.arpa.
4 PTR mitkosipc.ustrem.org.
18 PTR laptoper4e.ustrem.org.
15 PTR pi-server.ustrem.org.
24 PTR router.ustrem.org.

---------------------------------------------

This is enougt for BIND9 to work.

Now you can start and test it....

# dig ustrem.org @127.0.0.1

;; QUESTION SECTION:
;ustrem.org. IN A

;; ANSWER SECTION:
ustrem.org. 86400 IN A 213.240.243.12

# dig ustrem.org @127.0.0.1 MX

;; QUESTION SECTION:
;ustrem.org. IN MX

;; ANSWER SECTION:
ustrem.org. 86400 IN MX 10 mail.ustrem.org.

# dig -x 192.168.2.4 @127.0.0.1

;; QUESTION SECTION:
;4.2.168.192.in-addr.arpa. IN PTR

;; ANSWER SECTION:
4.2.168.192.in-addr.arpa. 86400 IN PTR mitkosipc.ustrem.org.

That is all ;)

Tuesday, July 22, 2008

Control Samba access via group rights

1. Adding and Managing user

groupadd acctg
useradd acct_user1 -m -s /bin/bash -G acctg
passwd acct_user1

smbpasswd -a acct_user1

existing user change

usermod -s /bin/bash

change .bashrc
smbpasswd


2. Adding Samba share - grouping

sudo mkdir -p /home/shares/acctg

sudo chown -R root:acctg /home/shares/acctg

#to share all user to access certain directory
sudo chmod -R ug+rw,o+rx-w /home/shares/allusers

3. Edit smb.conf - to add share

[acctg]
comment = Accounting Foldoers
path = /home/shares/acctg
valid users = @acctg
force group = acctg
create mask = 0660
directory mask = 0771
writable = yes


5. Sometimes vista OS have problem accessing Samba share edit registry
HKLM->System/CurrentControlset/control/LSA -> LMCombatibilitylevel = 3 to 1

Share Ubuntu Home Directories

1) create unix user (e.g. wsuser)
2) sudo apt-get install samba smbfs
3) sudo smbpasswd -a wsuser
4) sudo gedit /etc/samba/smbusers
#add this line
wsuser = "wsuser"
5) sudo gedit /etc/samba/smb.conf
# add two lines after "####### Authentication #######"
security = user
username map = /etc/samba/smbusers

# Uncomment below three lines
[homes]
comment = Home Directories
browseable = yes
# add line
writable = yes

Thats it you can access this maching from windows using
//linuxserver-IP/wsuser

source:

http://www.howtogeek.com/howto/ubuntu/share-ubuntu-home-directories-using-samba/

Install OpenSSH server

#sometimes installation of new services on ubuntu is block

/etc/init.d/apparmor stop
update -rc.d -f apparmor remove

#install SSHD services

sudo apt-get install openssh-server

#start services

sudo /etc/init.d/ssh restart

Sunday, July 20, 2008

Virtualbox Ubuntu step by step

Follow the link :

https://help.ubuntu.com/community/VirtualBox

VirtualBox NAT Configuration

Sometimes it might be useful to be able to open network connections from the host machine to the guest machine. For instance the guest machine may be running a web server and it could be needed to connect to it from the host computer.

In Virtualbox, network connectivity to the guest system is usually provided by NAT. However Virtualbox NAT connectivity provides a way for the guest system to access outside network, but not a way the outside network, or even the host machine to connect to the guest.

The solution here is to use “Host Interface”. Virtualbox Host Interface is something like a “fake” network interface connecting host system and guest system. Both the operating systems see the interface as a real network interface they can use to communicate.

The setup I am describing here consists of Windows XP as Host and Gentoo Linux as Guest systems

Configure virtual machine networking

  1. Go to the network setup panel in the virtual machine configuration tool
  2. Add a new Host Interface. Just click the small icon with a “plus” near the host interfaces list. Just give a name to the interface (in the example: VirtualBoxHost 1). While the operation of adding the new interface is in progress, the actual driver of the interface will be installed, and windows will warn you about the fact that the driver itself is not certified bi Microsoft: continue anyway.
  3. Then select “Host Interface” in the “Attached To” combo box
  4. Finally select the newly created interface in the “Interface Name” combo box

Configure TCP/IP for the Virtualbox Host Interface

Before starting the virtual machine, the new interface should be configured in the Host system, just as any other network interface, assigning at least an IP address, a network mask and a default gateway. For instance: IP=10.0.0.1; Mask: 255.255.255.0; Gateway:10.0.0.1.

Configure TCP/IP for the Virtualbox Guest Interface

Now the guest system could be started. Once it is started, its network interface should be configured. In this case just disable DHCP and manually enter network configuration. For instance: IP: 10.0.0.2; Mask 255.255.255.0; Gateway: 10.0.0.1

Now the configuration is complete and you are able to open network connections freelyy between the two systems.

Virtualbox Bridging

The installation of VBox, creation of the guest and installation of Debian Etch was done in the normal fashion. Once that was completed I followed the following steps to setup networking.

I. Create Network Connection in VBox
1. Open VBox¬¬ Settings Network;
2. Click on “Attached to” and then select “Host Interfaces”;
3. In Host Interfaces click Add;
4. Type "VirtualBox Host Interface #" without the quotation marks where the # represents a number for the interface, usually 1 (on one computer the name of the virtual box host interface appeared automatically, on the other computer I had to type the information);
5. Click OK, and
6. Close VBox

II. Create a Network Bridge
1. Open Control PanelNetwork Connections;
2. While holding down Ctrl select the Local Area connection and click on the VirtualBox Host Interface;
3. Right click on one of the selected connections; and
4. From the drop-down menu select Create Network Bridge

Since I am using static IP’s on my network set up I had to configure the TCP/IP properties for the Network Bridge.

5. Right click on the Network Bridge that was just created;
6. Select TCP/IP;
7. Click on Properties;
8. Set the Static Connection Values; and
9. Close Network Connection.

III. Set Network Adapters to promiscuous mode

When VBox and the guest VM load Windows XP should put the network adapters into promiscuous mode, but sometimes this does not happen. Therefore, I think it is best to force the adapters into promiscuous mode. It is only necessary to do this once.

1. Open a Windows command prompt (StartRun and type "CMD" without the quotes and press ENTER;
2. Type "netsh bridge show adapter";
3. There will be a line of information displayed for each network adapter in the Bridge. Look for any adapter that is listed as disabled, note the number of the adapter and go to step four.
4. Type "netsh bridge set adapter # forcecompatmode=enable" for each adapter that was listed as disabled, inserting the number of the adapter for the #;
5. Type "netsh bridge show adapter" once again to check to see if your adapters have been enabled;
6. Exit the command prompt; and
7. Reboot the computer.

III. Configure the TCP/IP Properties for the Debian guest

Again, this is necessary because I am using static IP's in my LAN.

1. Open VBox;
2. Start Debian;
3. Since I have installed GNOME desktop I will open Networking by clicking DesktopAdministrationNetworking;
4. Select Ethernet Connection eth0;
5. Click on Properties;
6. Set the static configuration for the Debian VM;
7. Close Networking; and
8. Reboot Debian.

After Debian has rebooted LAN connections with the host and any other computers on the network should have been established.

That is it. It worked for me. Please let me know if you have any questions concerning this set up. I have typed these instructions from notes I made while I was setting up my computers. There may be a better way or a faster way to set this all up, but I could not find it. This is what works for me.