# Linked Server

{% hint style="info" %}
Linked Server 설정을 위한 두개의 서버 자원은 각각 다음과 같습니다.

1. ACS.LOCAL

   IP : 192.168.1.15

   인스턴스 : SQLExpress

   sa 계정정보 : sa / Password123!

2. CONTOSO.COM

   IP : 192.168.1.15

   인스턴스 : SQLExpress

   sa 계정정보 : sa / Password123!
   {% endhint %}

3. ACS.LOCAL의 SQL Server 콘솔에서 다음 쿼리 입력

```sql
EXEC sp_addlinkedserver
    @server     = 'LinkedServer-CONTOSO',
    @srvproduct = '',
    @provider   = 'SQLNCLI',
    @datasrc    = '10.0.2.30\SQLExpress';

EXEC sp_addlinkedsrvlogin
    @rmtsrvname = 'LinkedServer_10_0_2_30',
    @useself    = 'false',
    @locallogin = NULL,
    @rmtuser    = 'sa',
    @rmtpassword= 'Password123!';

EXEC sp_serveroption 'LinkedServer-CONTOSO', 'rpc out', 'true';
EXEC sp_serveroption 'LinkedServer-CONTOSO', 'rpc', 'true';
```

2. CONTOSO.COM의 SQL Server 콘솔에서 다음 쿼리 입력

```sql
EXEC sp_addlinkedserver
    @server     = 'LinkedServer-ACS',
    @srvproduct = '',
    @provider   = 'SQLNCLI',
    @datasrc    = '192.168.1.15\SQLExpress';

EXEC sp_addlinkedsrvlogin
    @rmtsrvname = 'LinkedServer_192_168_1_15',
    @useself    = 'false',
    @locallogin = NULL,
    @rmtuser    = 'sa',
    @rmtpassword= 'Password123!';

EXEC sp_serveroption 'LinkedServer-ACS', 'rpc out', 'true';
EXEC sp_serveroption 'LinkedServer-ACS', 'rpc', 'true';
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.pentestwiki.com/home-lab/active-directory/linked-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
