# 访问控制

{% hint style="info" %}

* 本功能通过iptables实现设备黑白名单，优先级高于内核访问控制规则
  {% endhint %}

<figure><img src="/files/9BBCorhx7j3ZooQh8pUW" alt=""><figcaption></figcaption></figure>

#### 访问控制匹配方法：

* <mark style="color:orange;">**IP+MAC匹配**</mark>**：**&#x5339;配到设备IP或者MAC既遵循访问控制设置
* <mark style="color:orange;">**仅IP匹配**</mark>**：**&#x5339;配到设备IPv4地址既遵循访问控制设置
* <mark style="color:orange;">**仅MAC匹配**</mark>**：**&#x5339;配到设备MAC地址既遵循访问控制设置

{% hint style="info" %}

* **不通过代理：**&#x8BBE;定的设备流量不经过MC，直接访问互联网
* **通过Clash：**&#x8BBE;定的设备流量经过MC访问互联网，经过Clash的YAML配置设定分流
* **支持自定义端口号**（只支持<mark style="color:blue;">通过Clash</mark>）**：**&#x5148;点<mark style="color:blue;">加号</mark>添加，然后点击 <mark style="color:blue;">all</mark>/<mark style="color:blue;">端口号</mark> 修改
* **多端口格式：**&#x38;0,443  代表80和443端口          666:777   代表666到777端口
* **IP地址支持CIDR格式：**&#x5982;：192.168.50.0/24
  {% endhint %}

{% hint style="warning" %}

* IP地址匹配仅支持IPv4，无法控制设备的IPv6流量
* 使用MAC地址匹配时，请关闭iPhone等设备的随机MAC地址功能
* 设置完成后，需要重启MC应用设置
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://mcreadme.gitbook.io/mc/base/control.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.
