mirror of https://github.com/bjdgyc/anylink.git
修改默认网段,防止用户冲突
This commit is contained in:
parent
d00293aaf9
commit
7299c0e761
49
README.md
49
README.md
|
@ -159,9 +159,9 @@ systemctl stop firewalld.service
|
||||||
systemctl disable firewalld.service
|
systemctl disable firewalld.service
|
||||||
|
|
||||||
# 请根据服务器内网网卡替换 eth0
|
# 请根据服务器内网网卡替换 eth0
|
||||||
iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -o eth0 -j MASQUERADE
|
iptables -t nat -A POSTROUTING -s 192.168.90.0/24 -o eth0 -j MASQUERADE
|
||||||
# 如果执行第一个命令不生效,可以继续执行下面的命令
|
# 如果执行第一个命令不生效,可以继续执行下面的命令
|
||||||
# iptables -A FORWARD -i eth0 -s 192.168.10.0/24 -j ACCEPT
|
# iptables -A FORWARD -i eth0 -s 192.168.90.0/24 -j ACCEPT
|
||||||
# 查看设置是否生效
|
# 查看设置是否生效
|
||||||
iptables -nL -t nat
|
iptables -nL -t nat
|
||||||
```
|
```
|
||||||
|
@ -169,17 +169,17 @@ iptables -nL -t nat
|
||||||
2.2 使用全局路由转发(二选一)
|
2.2 使用全局路由转发(二选一)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# 假设anylink所在服务器的内网ip: 10.1.0.10
|
# 假设anylink所在服务器的内网ip: 10.1.2.10
|
||||||
|
|
||||||
# 传统网络架构,在华三交换机添加以下静态路由规则
|
# 传统网络架构,在华三交换机添加以下静态路由规则
|
||||||
ip route-static 192.168.10.0 255.255.255.0 10.1.0.10
|
ip route-static 192.168.90.0 255.255.255.0 10.1.2.10
|
||||||
# 其他品牌的交换机命令,请参考以下地址
|
# 其他品牌的交换机命令,请参考以下地址
|
||||||
https://cloud.tencent.com/document/product/216/62007
|
https://cloud.tencent.com/document/product/216/62007
|
||||||
|
|
||||||
# 公有云环境下,需设置vpc下的路由表,添加以下路由策略
|
# 公有云环境下,需设置vpc下的路由表,添加以下路由策略
|
||||||
目的端: 192.168.10.0/24
|
目的端: 192.168.90.0/24
|
||||||
下一跳类型: 云服务器
|
下一跳类型: 云服务器
|
||||||
下一跳: 10.1.0.10
|
下一跳: 10.1.2.10
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -197,46 +197,19 @@ https://cloud.tencent.com/document/product/216/62007
|
||||||
#内网主网卡名称
|
#内网主网卡名称
|
||||||
ipv4_master = "eth0"
|
ipv4_master = "eth0"
|
||||||
#以下网段需要跟ipv4_master网卡设置成一样
|
#以下网段需要跟ipv4_master网卡设置成一样
|
||||||
ipv4_cidr = "192.168.10.0/24"
|
ipv4_cidr = "10.1.2.0/24"
|
||||||
ipv4_gateway = "192.168.10.1"
|
ipv4_gateway = "10.1.2.1"
|
||||||
ipv4_start = "192.168.10.100"
|
ipv4_start = "10.1.2.100"
|
||||||
ipv4_end = "192.168.10.200"
|
ipv4_end = "10.1.2.200"
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>tap设置</summary>
|
|
||||||
|
|
||||||
### ~~tap 设置~~
|
|
||||||
|
|
||||||
1. 创建桥接网卡
|
|
||||||
|
|
||||||
```
|
|
||||||
注意 server.toml 的ip参数,需要与 bridge-init.sh 的配置参数一致
|
|
||||||
```
|
|
||||||
|
|
||||||
2. 修改 bridge-init.sh 内的参数
|
|
||||||
|
|
||||||
> 以下参数可以通过执行 `ip a` 查看
|
|
||||||
|
|
||||||
```
|
|
||||||
eth="eth0"
|
|
||||||
eth_ip="192.168.10.4/24"
|
|
||||||
eth_broadcast="192.168.10.255"
|
|
||||||
eth_gateway="192.168.10.1"
|
|
||||||
```
|
|
||||||
|
|
||||||
3. 执行 bridge-init.sh 文件
|
|
||||||
|
|
||||||
```
|
|
||||||
sh bridge-init.sh
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## Systemd
|
## Systemd
|
||||||
|
|
||||||
1. 添加 anylink 程序
|
1. 添加 anylink 程序
|
||||||
|
|
||||||
- anylink 程序目录放入 `/usr/local/anylink-deploy`
|
- anylink 程序目录放入 `/usr/local/anylink-deploy`
|
||||||
|
- 添加执行权限 `chmod +x /usr/local/anylink-deploy/anylink`
|
||||||
|
|
||||||
2. systemd/anylink.service 脚本放入:
|
2. systemd/anylink.service 脚本放入:
|
||||||
|
|
||||||
|
|
|
@ -41,15 +41,15 @@ var configs = []config{
|
||||||
{Typ: cfgStr, Name: "jwt_secret", Usage: "JWT密钥", ValStr: defaultJwt},
|
{Typ: cfgStr, Name: "jwt_secret", Usage: "JWT密钥", ValStr: defaultJwt},
|
||||||
{Typ: cfgStr, Name: "link_mode", Usage: "虚拟网络类型[tun tap macvtap ipvtap]", ValStr: "tun"},
|
{Typ: cfgStr, Name: "link_mode", Usage: "虚拟网络类型[tun tap macvtap ipvtap]", ValStr: "tun"},
|
||||||
{Typ: cfgStr, Name: "ipv4_master", Usage: "ipv4主网卡名称", ValStr: "eth0"},
|
{Typ: cfgStr, Name: "ipv4_master", Usage: "ipv4主网卡名称", ValStr: "eth0"},
|
||||||
{Typ: cfgStr, Name: "ipv4_cidr", Usage: "ip地址网段", ValStr: "192.168.10.0/24"},
|
{Typ: cfgStr, Name: "ipv4_cidr", Usage: "ip地址网段", ValStr: "192.168.90.0/24"},
|
||||||
{Typ: cfgStr, Name: "ipv4_gateway", Usage: "ipv4_gateway", ValStr: "192.168.10.1"},
|
{Typ: cfgStr, Name: "ipv4_gateway", Usage: "ipv4_gateway", ValStr: "192.168.90.1"},
|
||||||
{Typ: cfgStr, Name: "ipv4_start", Usage: "IPV4开始地址", ValStr: "192.168.10.100"},
|
{Typ: cfgStr, Name: "ipv4_start", Usage: "IPV4开始地址", ValStr: "192.168.90.100"},
|
||||||
{Typ: cfgStr, Name: "ipv4_end", Usage: "IPV4结束", ValStr: "192.168.10.200"},
|
{Typ: cfgStr, Name: "ipv4_end", Usage: "IPV4结束", ValStr: "192.168.90.200"},
|
||||||
{Typ: cfgStr, Name: "default_group", Usage: "默认用户组", ValStr: "one"},
|
{Typ: cfgStr, Name: "default_group", Usage: "默认用户组", ValStr: "one"},
|
||||||
{Typ: cfgStr, Name: "default_domain", Usage: "要发布的默认域", ValStr: ""},
|
{Typ: cfgStr, Name: "default_domain", Usage: "要发布的默认域", ValStr: ""},
|
||||||
|
|
||||||
{Typ: cfgInt, Name: "ip_lease", Usage: "IP租期(秒)", ValInt: 1209600},
|
{Typ: cfgInt, Name: "ip_lease", Usage: "IP租期(秒)", ValInt: 1209600},
|
||||||
{Typ: cfgInt, Name: "max_client", Usage: "最大用户连接", ValInt: 100},
|
{Typ: cfgInt, Name: "max_client", Usage: "最大用户连接", ValInt: 200},
|
||||||
{Typ: cfgInt, Name: "max_user_client", Usage: "最大单用户连接", ValInt: 3},
|
{Typ: cfgInt, Name: "max_user_client", Usage: "最大单用户连接", ValInt: 3},
|
||||||
{Typ: cfgInt, Name: "cstp_keepalive", Usage: "keepalive时间(秒)", ValInt: 9},
|
{Typ: cfgInt, Name: "cstp_keepalive", Usage: "keepalive时间(秒)", ValInt: 9},
|
||||||
{Typ: cfgInt, Name: "cstp_dpd", Usage: "死链接检测时间(秒)", ValInt: 15},
|
{Typ: cfgInt, Name: "cstp_dpd", Usage: "死链接检测时间(秒)", ValInt: 15},
|
||||||
|
|
|
@ -40,10 +40,10 @@ link_mode = "tun"
|
||||||
|
|
||||||
#客户端分配的ip地址池
|
#客户端分配的ip地址池
|
||||||
ipv4_master = "eth0"
|
ipv4_master = "eth0"
|
||||||
ipv4_cidr = "192.168.10.0/24"
|
ipv4_cidr = "192.168.90.0/24"
|
||||||
ipv4_gateway = "192.168.10.1"
|
ipv4_gateway = "192.168.90.1"
|
||||||
ipv4_start = "192.168.10.100"
|
ipv4_start = "192.168.90.100"
|
||||||
ipv4_end = "192.168.10.200"
|
ipv4_end = "192.168.90.200"
|
||||||
|
|
||||||
#最大客户端数量
|
#最大客户端数量
|
||||||
max_client = 100
|
max_client = 100
|
||||||
|
|
|
@ -28,10 +28,10 @@ admin_addr = ":8800"
|
||||||
|
|
||||||
#客户端分配的ip地址池
|
#客户端分配的ip地址池
|
||||||
ipv4_master = "eth0"
|
ipv4_master = "eth0"
|
||||||
ipv4_cidr = "192.168.10.0/24"
|
ipv4_cidr = "192.168.90.0/24"
|
||||||
ipv4_gateway = "192.168.10.1"
|
ipv4_gateway = "192.168.90.1"
|
||||||
ipv4_start = "192.168.10.100"
|
ipv4_start = "192.168.90.100"
|
||||||
ipv4_end = "192.168.10.200"
|
ipv4_end = "192.168.90.200"
|
||||||
|
|
||||||
#是否自动添加nat
|
#是否自动添加nat
|
||||||
iptables_nat = false
|
iptables_nat = false
|
||||||
|
|
Loading…
Reference in New Issue