也不知是静态路由设置问题,还是高恪固件问题,反正每次失效后,我只要打开静态路由页面重新提交一下就可以,也找不到问题所在,干脆写个脚本,定时去点击一下提交,这下总不会失效了吧/
贴上python代码
#!/usr/bin/python3
#coding=utf-8
import requests
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
import time
chrome_options = Options()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--headless')
browser = webdriver.Chrome(chrome_options=chrome_options)
browser.get('http://192.168.2.1/cgi-bin/webui/admin#/user/login')
time.sleep(5)
browser.find_element(By.ID,"password").send_keys("路由登陆密码")
time.sleep(2)
browser.find_element(By.XPATH, "//button[@class='ant-btn antd-pro-src-components-login-index-submit ant-btn-primary ant-btn-lg ant-btn-two-chinese-chars']").click()
time.sleep(2)
browser.get('http://192.168.2.1/cgi-bin/webui/admin#/network/staticroute/cfg02c8b4')
time.sleep(2)
browser.find_element(By.XPATH, "//button[@class='ant-btn ant-btn-primary ant-btn-two-chinese-chars']").click()
time.sleep(2)
browser.quit()
以上IP换成高恪路由IP,加入crontab定时执行即可.