웹사이트 검색

장애 조치 복제를 위해 추가 Ubuntu DC를 Samba4 AD DC에 연결 - 5부


이 튜토리얼에서는 Ubuntu 16.04 서버에 프로비저닝된 두 번째 Samba4 도메인 컨트롤러를 기존 Samba AD DC 포리스트에 순서대로 추가하는 방법을 보여줍니다. 일부 중요한 AD DC 서비스, 특히 SAM 데이터베이스가 포함된 DNS 및 AD DC LDAP 스키마와 같은 서비스에 대해 일정 수준의 로드 밸런싱/장애 조치를 제공합니다.

요구사항

  1. Ubuntu에서 Samba4를 사용하여 Active Directory 인프라 생성 – 1부

이 글은 다음과 같은 Samba4 AD DC 시리즈의 5부입니다.

1단계: Samba4 설정을 위한 초기 구성

1. 실제로 두 번째 DC에 대한 도메인 가입을 시작하기 전에 몇 가지 초기 설정을 처리해야 합니다. 먼저 Samba4 AD DC에 통합될 시스템의 호스트 이름에 설명적인 이름이 포함되어 있는지 확인하세요.

첫 번째 프로비저닝된 영역의 호스트 이름adc1이라고 가정하면 일관된 이름 지정 체계를 제공하기 위해 adc2로 두 번째 DC의 이름을 지정할 수 있습니다. 도메인 컨트롤러 전반에 걸쳐.

시스템 호스트 이름을 변경하려면 아래 명령을 실행할 수 있습니다.

hostnamectl set-hostname adc2

그렇지 않으면 /etc/hostname 파일을 수동으로 편집하고 원하는 이름으로 새 줄을 추가할 수 있습니다.

nano /etc/hostname

여기에 호스트 이름을 추가하세요.

adc2

2. 다음으로, 로컬 시스템 확인 파일을 열고 아래 그림과 같이 IP 주소 마녀가 기본 도메인 컨트롤러의 짧은 이름과 FQDN을 가리키는 항목을 추가합니다. 스크린샷.

이 튜토리얼을 통해 기본 DC 이름은 adc1.tecmint.lan이고 192.168.1.254 IP 주소로 확인됩니다.

nano /etc/hosts

다음 줄을 추가합니다.

IP_of_main_DC		FQDN_of_main_DC 	short_name_of_main_DC

3. 다음 단계에서 /etc/network/interfaces를 열고 아래 스크린샷에 표시된 대로 시스템에 고정 IP 주소를 할당합니다.

dns-nameserversdns-search 변수에 주의하세요. DNS 확인이 올바르게 작동하려면 이러한 값이 기본 Samba4 AD DC 및 영역의 IP 주소를 다시 가리키도록 구성되어야 합니다.

변경 사항을 반영하려면 네트워크 데몬을 다시 시작하세요. /etc/resolv.conf 파일을 확인하여 네트워크 인터페이스의 두 DNS 값이 모두 이 파일로 업데이트되었는지 확인하세요.

nano /etc/network/interfaces

사용자 정의 IP 설정을 편집하고 바꿉니다.

auto ens33
iface ens33 inet static
        address 192.168.1.253
        netmask 255.255.255.0
        brodcast 192.168.1.1
        gateway 192.168.1.1
        dns-nameservers 192.168.1.254
        dns-search tecmint.lan

네트워크 서비스를 다시 시작하고 변경 사항을 확인합니다.

systemctl restart networking.service
cat /etc/resolv.conf

dns-search 값은 짧은 이름(FQDN을 형성함)으로 호스트를 쿼리할 때 자동으로 도메인 이름을 추가합니다.

4. DNS 확인이 예상대로 작동하는지 테스트하려면 아래 스크린샷에 표시된 대로 도메인 짧은 이름, FQDN 및 영역에 대해 일련의 ping 명령을 실행하세요.

이 모든 경우에 Samba4 AD DC DNS 서버는 기본 DC의 IP 주소로 응답해야 합니다.

5. 주의해야 할 마지막 추가 단계는 기본 도메인 컨트롤러와의 시간 동기화입니다. 아래 명령을 실행하여 시스템에 NTP 클라이언트 유틸리티를 설치하면 됩니다.

apt-get install ntpdate

6. samba4 AD DC와의 시간 동기화를 수동으로 강제 실행하려는 경우 다음 명령을 실행하여 기본 DC에 대해 ntpdate 명령을 실행합니다.

ntpdate adc1

2단계: 필수 종속성과 함께 Samba4 설치

7. Ubuntu 16.04 시스템을 도메인에 등록하려면 먼저 Samba4, Kerberos 클라이언트 및 몇 가지를 설치합니다. 아래 명령을 실행하여 Ubuntu 공식 저장소에서 나중에 사용할 다른 중요한 패키지:

apt-get install samba krb5-user krb5-config winbind libpam-winbind libnss-winbind

8. 설치 중에 Kerberos 영역 이름을 제공해야 합니다. 도메인 이름을 대문자로 입력하고 [Enter] 키를 누르면 설치가 완료됩니다.

9. 패키지 설치가 완료되면 kinit 명령을 사용하여 도메인 관리자에게 Kerberos 티켓을 요청하여 설정을 확인합니다. 부여된 Kerberos 티켓을 나열하려면 klist 명령을 사용하세요.

kinit domain-admin-user@YOUR_DOMAIN.TLD
klist

3단계: Samba4 AD DC에 도메인 컨트롤러로 가입

10. 시스템을 Samba4 DC에 통합하기 전에 먼저 시스템에서 실행 중인 모든 Samba4 데몬이 중지되었는지 확인하고 시작하려면 기본 Samba 구성 파일의 이름을 바꾸십시오. 깨끗한. 도메인 컨트롤러를 프로비저닝하는 동안 Samba는 처음부터 새 구성 파일을 생성합니다.

systemctl stop samba-ad-dc smbd nmbd winbind
mv /etc/samba/smb.conf /etc/samba/smb.conf.initial

11. 도메인 가입 프로세스를 시작하려면 먼저 samba-ad-dc 데몬만 시작한 다음 samba-tool을 실행합니다. 도메인에 대한 관리 권한이 있는 계정을 사용하여 영역에 가입하는 명령입니다.

samba-tool domain join your_domain DC -U "your_domain_admin"

도메인 통합 발췌:

samba-tool domain join tecmint.lan DC -U"tecmint_user"
샘플 출력
Finding a writeable DC for domain 'tecmint.lan'
Found DC adc1.tecmint.lan
Password for [WORKGROUP\tecmint_user]:
workgroup is TECMINT
realm is tecmint.lan
checking sAMAccountName
Deleted CN=ADC2,CN=Computers,DC=tecmint,DC=lan
Adding CN=ADC2,OU=Domain Controllers,DC=tecmint,DC=lan
Adding CN=ADC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=tecmint,DC=lan
Adding CN=NTDS Settings,CN=ADC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=tecmint,DC=lan
Adding SPNs to CN=ADC2,OU=Domain Controllers,DC=tecmint,DC=lan
Setting account password for ADC2$
Enabling account
Calling bare provision
Looking up IPv4 addresses
Looking up IPv6 addresses
No IPv6 address will be assigned
Setting up share.ldb
Setting up secrets.ldb
Setting up the registry
Setting up the privileges database
Setting up idmap db
Setting up SAM db
Setting up sam.ldb partitions and settings
Setting up sam.ldb rootDSE
Pre-loading the Samba 4 and AD schema
A Kerberos configuration suitable for Samba 4 has been generated at /var/lib/samba/private/krb5.conf
Provision OK for domain DN DC=tecmint,DC=lan
Starting replication
Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan] objects[402/1550] linked_values[0/0]
Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan] objects[804/1550] linked_values[0/0]
Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan] objects[1206/1550] linked_values[0/0]
Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan] objects[1550/1550] linked_values[0/0]
Analyze and apply schema objects
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[402/1614] linked_values[0/0]
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[804/1614] linked_values[0/0]
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[1206/1614] linked_values[0/0]
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[1608/1614] linked_values[0/0]
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[1614/1614] linked_values[28/0]
Replicating critical objects from the base DN of the domain
Partition[DC=tecmint,DC=lan] objects[97/97] linked_values[24/0]
Partition[DC=tecmint,DC=lan] objects[380/283] linked_values[27/0]
Done with always replicated NC (base, config, schema)
Replicating DC=DomainDnsZones,DC=tecmint,DC=lan
Partition[DC=DomainDnsZones,DC=tecmint,DC=lan] objects[45/45] linked_values[0/0]
Replicating DC=ForestDnsZones,DC=tecmint,DC=lan
Partition[DC=ForestDnsZones,DC=tecmint,DC=lan] objects[18/18] linked_values[0/0]
Committing SAM database
Sending DsReplicaUpdateRefs for all the replicated partitions
Setting isSynchronized and dsServiceName
Setting up secrets database
Joined domain TECMINT (SID S-1-5-21-715537322-3397311598-55032968) as a DC

12. Samba4 소프트웨어가 포함된 Ubuntu가 도메인에 통합된 후 Samba 기본 구성 파일을 열고 다음 줄을 추가합니다.

nano /etc/samba/smb.conf

smb.conf 파일에 다음 발췌문을 추가합니다.

dns forwarder = 192.168.1.1
idmap_ldb:use rfc2307 = yes

   template shell = /bin/bash
   winbind use default domain = true
   winbind offline logon = false
   winbind nss info = rfc2307
        winbind enum users = yes
        winbind enum groups = yes

DNS 전달자 IP 주소를 자신의 DNS 전달자 IP로 바꿉니다. Samba는 도메인 권한 영역 외부에 있는 모든 DNS 확인 쿼리를 이 IP 주소로 전달합니다.

13. 마지막으로 삼바 데몬을 다시 시작하여 변경 사항을 반영하고 다음 명령을 실행하여 Active Directory 복제를 확인합니다.

systemctl restart samba-ad-dc
samba-tool drs showrepl

14. 또한 /etc 경로에서 초기 Kerberos 구성 파일의 이름을 바꾸고 이를 프로비저닝하는 동안 Samba에서 생성된 새로운 krb5.conf 구성 파일로 바꿉니다. 도메인.

파일은 /var/lib/samba/private 디렉토리에 있습니다. Linux 심볼릭 링크를 사용하여 이 파일을 /etc 디렉터리에 연결합니다.

mv /etc/krb5.conf /etc/krb5.conf.initial
ln -s /var/lib/samba/private/krb5.conf /etc/
cat /etc/krb5.conf

15. 또한 Samba krb5.conf 파일로 Kerberos 인증을 확인합니다. 관리자를 위한 티켓을 요청하고 아래 명령을 실행하여 캐시된 티켓을 나열합니다.

kinit administrator
klist

4단계: 추가 도메인 서비스 유효성 검사

16. 수행해야 할 첫 번째 테스트는 Samba4 DC DNS 확인입니다. 도메인 DNS 확인을 확인하려면 아래 스크린샷에 표시된 몇 가지 중요한 AD DNS 레코드에 대해 host 명령을 사용하여 도메인 이름을 쿼리하세요.

이제 DNS 서버는 각 쿼리에 대해 두 개의 IP 주소 쌍을 사용하여 재생해야 합니다.

host your_domain.tld
host -t SRV _kerberos._udp.your_domain.tld  # UDP Kerberos SRV record
host -t SRV _ldap._tcp.your_domain.tld  # TCP LDAP SRV record

17. 이러한 DNS 레코드는 RSAT 도구가 설치된 등록된 Windows 시스템에서도 볼 수 있습니다. DNS 관리자를 열고 아래 이미지에 표시된 대로 도메인 TCP 레코드를 확장합니다.

18. 다음 테스트에서는 도메인 LDAP 복제가 예상대로 작동하는지 표시해야 합니다. samba-tool을 사용하여 두 번째 도메인 컨트롤러에 계정을 만들고 해당 계정이 첫 번째 Samba4 AD DC에 자동으로 복제되는지 확인합니다.

ADC2에서:
samba-tool user add test_user
adc1에서:
samba-tool user list | grep test_user

19. Microsoft AD UC 콘솔에서 계정을 만들고 해당 계정이 두 도메인 컨트롤러 모두에 표시되는지 확인할 수도 있습니다.

기본적으로 계정은 두 Samba 도메인 컨트롤러 모두에서 자동으로 생성되어야 합니다. wbinfo 명령을 사용하여 adc1에서 계정 이름을 쿼리합니다.

20. 실제로 Windows에서 AD UC 콘솔을 열고 도메인 컨트롤러로 확장하면 등록된 두 DC 시스템이 모두 표시됩니다.

5단계: Samba4 AD DC 서비스 활성화

21. 시스템 전체에서 samba4 AD DC 서비스를 활성화하려면 먼저 일부 오래되고 사용되지 않는 Samba 데몬을 비활성화하고 아래 명령을 실행하여 samba-ad-dc 서비스만 활성화하십시오. :

systemctl disable smbd nmbd winbind
systemctl enable samba-ad-dc

22. Microsoft 클라이언트에서 Samba4 도메인 컨트롤러를 원격으로 관리하거나 다른 Linux 또는 Windows 클라이언트가 도메인에 통합되어 있는 경우 adc2의 IP 주소를 언급해야 합니다. 중복성을 확보하기 위해 머신을 네트워크 인터페이스 DNS 서버 IP 설정에 추가합니다.

아래 스크린샷은 Windows 또는 Debian/Ubuntu 클라이언트에 필요한 구성을 보여줍니다.

192.168.1.254가 있는 첫 번째 DC가 오프라인이 된다고 가정하면 구성 파일에서 DNS 서버 IP 주소의 순서를 반대로 바꾸어 사용할 수 없는 항목을 먼저 쿼리하지 않도록 합니다. DNS 서버.

마지막으로 Samba4 Active Directory 계정을 사용하여 Linux 시스템에서 로컬 인증을 수행하거나 Linux에서 AD LDAP 계정에 루트 권한을 부여하려는 경우 Linux 명령줄에서 Samba4 AD 인프라 관리 튜토리얼의 2단계와 3단계를 읽어보세요.