> For the complete documentation index, see [llms.txt](https://docs.lala.gg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lala.gg/ieplnat.md).

# IEPL NAT使用教程

## 第一步：安装系统

```
不使用密钥安装系统，安装好后，系统root密码会通过邮件发送给您。
```

<figure><img src="https://1689567706-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKx4TFNd9E6umfvz6uIPA%2Fuploads%2FxYeTthNSKF2WvYqSzuBM%2Fimage.png?alt=media&amp;token=27a4ec79-b9fb-42db-8177-90ce8df3e5b1" alt=""><figcaption></figcaption></figure>

## 第二步：进VNC

```
安装好系统后，默认是无法连接的，需要进VNC配置路由。
在【选项】里面启用VNC，并点击网页VNC（由于某种原因，网页vnc可能无法使用，则需要使用vnc客户端连接）
```

<figure><img src="https://1689567706-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKx4TFNd9E6umfvz6uIPA%2Fuploads%2Fatvz6c1S65FvT8tiJLwt%2Ftelegram-cloud-photo-size-5-6161037046475506525-x.jpg?alt=media&amp;token=12b1a051-4075-45ea-a4ae-ed5f649e6197" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
如果面板上网页VNC无法访问（连接失败），则只能使用境内客户端进行vnc连接。推荐使用vnc viewer进行连接，vnc的连接信息可以在【选项】页面里找到。

如果面板上网页VNC无法访问（连接失败），则只能使用境内客户端进行vnc连接。推荐使用vnc viewer进行连接，vnc的连接信息可以在【选项】页面里找到。

如果面板上网页VNC无法访问（连接失败），则只能使用境内客户端进行vnc连接。推荐使用vnc viewer进行连接，vnc的连接信息可以在【选项】页面里找到。
{% endhint %}

<figure><img src="https://1689567706-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKx4TFNd9E6umfvz6uIPA%2Fuploads%2FFEu5AZjkJJqI3lKsNh8P%2Fimage.png?alt=media&amp;token=49195aed-e615-4e49-9433-8a1f89a33f09" alt=""><figcaption></figcaption></figure>

## 第三步：登录系统，配置路由

輸入root账号密码登录系统（注意密码是邮件里面的登录密码，不是网页上显示的vnc登录密码），然后依次运行下面三条命令：(3线入口的nat机器，只需要配置一个内网ip的路由即可)

```
echo "101 CT" >> /etc/iproute2/rt_tables
ip route add default via 192.168.XX.1 dev eth0 table CT
ip rule add from 192.168.XX.XX table CT
```

{% hint style="danger" %}
第二条命令中的网卡名字 eth0 可能需要相应修改（本教程为debian11下写成，debian系应该可以直接使用，其他系统请使用ip a 命令查看具体的网卡名字，找192.168开头的ip所在的网卡名字）
{% endhint %}

{% hint style="danger" %}
注意将第二、三条命令中的ip需要替换为你机器的ip。（可以在网络中最后下面找到192.168开头的ip。特别注意只有需要修改命令中XX的部分，不是XX的请不要修改！不要修改！不要修改！）
{% endhint %}

```
例如：您的内网ip为 192.168.201.10，那么路由配置命令就是：
echo "101 CT" >> /etc/iproute2/rt_tables
ip route add default via 192.168.201.1 dev eth0 table CT
ip rule add from 192.168.201.10 table CT
（根据机器情况修改，切勿照搬）
```

{% hint style="danger" %}
每次重启后，若未配置第四步，则需要再次运行第二、第三两个命令。（第一条命令无需再运行）
{% endhint %}

<figure><img src="https://1689567706-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKx4TFNd9E6umfvz6uIPA%2Fuploads%2FA1cy2St9hsQozcdMyaeP%2Fimage.png?alt=media&amp;token=7ee45d6b-9d92-4cf0-a2ba-d28e8f2a0353" alt=""><figcaption></figcaption></figure>

配置好以后就可以正常使用了。

## 第四步（可选）：永久化路由

{% hint style="info" %}
配置此步后，每次重启无需再配置路由
{% endhint %}

### （一）新建脚本

```
#!/bin/bash

sleep 10
ip route add default via 192.168.XX.1 dev eth0 table CT
sleep 5
ip rule add from 192.168.XX.XX table CT
```

脚本内容如上,将上面XX同理进行替换,其他内容不变。（sleep时间可以调整，但不能太小，要保证脚本运行时候网卡已经正常启动起来，否则会失效）

脚本名字和路径可以自定义,这里我取名为rt.sh，路径为root根目录/root/

<figure><img src="https://1689567706-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKx4TFNd9E6umfvz6uIPA%2Fuploads%2FL0QAp5szakvUuhkTdV4O%2Fimage.png?alt=media&amp;token=0719fc42-cc2e-4537-baa6-4ca49d117142" alt=""><figcaption></figcaption></figure>

### （二）赋予脚本可执行权限

```
chmod +x /root/rt.sh
```

### （三）配置crontab

在crontab中新增一条记录：（crontab -e进行编辑）

```sh
@reboot /root/rt.sh
```

<figure><img src="https://1689567706-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKx4TFNd9E6umfvz6uIPA%2Fuploads%2Fjp4NYYF7oR6j65rtskFk%2Fimage.png?alt=media&amp;token=e4fd83d8-e224-42c3-abfd-1a7f241013d8" alt=""><figcaption></figcaption></figure>

保存即可。

***

## Trouble Shooting

### 流量统计为单向，为什么面板上显示双向？

专线机器为双网卡，我们只统计单网卡流量，虽然显示入向+出向，实际等于单向流量。

### 配置crontab时，运行crontab -e提示：“bash：crontab command not found”。

{% hint style="info" %}
表示系统中未安装cron服务，安装即可。

apt install cron

或

yum install cron
{% endhint %}
