配置>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
config dhcp \'lan\' option interface \'lan\' # 绑定接口 option start \'100\' # 不再使用 option limit \'150\' option force \'1\' option leasetime \'720m\' # option ignore \'0\' # Specifies whether dnsmasq should ignore this pool if set to1option ra_management \'1\' # DHCPv6模式 RA management mode : no M-Flag but A-Flag (0), both M and A flags (1), M flag but not A flag (2) option ra_mininterval \'10\' # 最小RA间隔 Minimum time interval between RAs (in seconds) option ra_maxinterval \'15\' # 最大RA间隔 Maximum time interval between RAs (in seconds) option ra \'relay\' # 路由通告 Specifies whether Router Advertisements should be enabled (server), relayed (relay) or disabled (disabled) option dhcpv6 \'server\' # DHCPv6服务 Specifies whether DHCPv6 server should be enabled (server), relayed (relay) or disabled (disabled) option ndp \'relay\' # NDP代理 Specifies whether NDP should be relayed (relay) or disabled (disabled) list dhcp_option \'43,192.168.1.3\' # 43 表示供应商指定信息
list dhcp_option \'3,192.168.1.3\' # 3 默认路由
list dhcp_option \'6,192.168.1.3\' # 6 默认dns
list range \'192.168.1.20 192.168.1.30\' # dhcp地址范围, 用空格分开
openwrt 官方文档: --> https://openwrt.org/docs/guide-user/base-system/dhcp
保存>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
save_dhcp_server
/etc/init.d/network reload >/dev/null 2>/dev/null;
/etc/init.d/dnsmasq restart
/etc/init.d/dhcpd stop;sleep 1;/etc/init.d/dhcpd start;/etc/init.d/odhcpd restart
dhcrelay配置>>>>>>>>>>>>>>>>>>>>>>>>>>>>
config dhcrelay \'ipv4\'
option dhcpserver \'10.10.10.254\' # v4目标服务器
option enabled \'1\' # 在接口上启用DHCPv4中继
option relay_mode \'forward\' # 代理选项 What to do about packets that already have a relay option
option upstream_interfaces \'lan\' # 监听上行口
option downstream_interfaces \'yy\' # 监听下行口
config dhcrelay \'ipv6\'
option dhcpserver \'2001:db8:1::1\' #v6 目标服务器
option enabled \'1\' # 启用开关
option upper \'wan\' # 监听上行口
list lower \'yy\' # 监听下行口
/etc/init.d/dhcrelay4 restart ;/etc/init.d/dhcrelay6 restart
静态路由
config route6 \'ww\' option name \'ww\' # 配置名称 option metric \'12\' # metric option mtu \'1500\' # MTU option target \'1.1.1.1\' # 目的地址 option gateway \'2.2.2.2\' # IPv6 网关 option type \'broadcast\' # 路由类型 option table \'main\' # 路由表 option onlink \'1\' # 路由在线 option interface \'lan\' # 接口
os.execute("/etc/init.d/network reload;")