By accessing the website and accepting the Cookie Policy, you agree to use the cookies provided by the Site in accordance with to analyze traffic, remember your preferences, and optimize your experience.
debian9为本机与虚拟IP进行绑定
虚拟网 ip    2018-11-23 17:07:33    175    0    0
emengweb   虚拟网 ip

1.首先,在/etc/rc.local文件中加入

bash /root/bindip.sh​

2.绑定ip地址

写入绑定ip/root/bindip.sh文件

cat > /root/bindip.sh <<EOF
#!/bin/sh
 
# delay 5 sec.
sleep 5
sudo nohup ip rule add from 192.168.10.1/24 table ZTWFUEJS3H &
sudo nohup ip route add default via 192.168.10.1 table ZTWFUEJS3H &
EOF​

3.设置执行权限:

chmod +x /root/bindip.sh​

重启即可自动运行脚本,并绑定ip地址。


注意:更改自启脚本后,需要重新运行一下命令已使其生效。

systemctl enable rc-local

systemctl start rc-local.service


上一篇: 在Debian 9 (Stretch) 上安装Docker Engine

下一篇: Hetzner独服使用Proxmox创建VPS

175 人读过
文档导航