熟悉板子的上网设置
- 首先在了解上网设置之前需要配置参数的作用,首先是配置节点APWanInfo_Common 接入类型的是桥接的还是路由的,如果是路由的话再配置节点WanIfo_WanIF 的各种参数,主要关注点在 连接方式(是普通的linkIP呢,还是linkPPP呢),连接地址类型(是ipv4呢,还是ipv6呢,还是两个都支持),连接地址获取方式(是动态呢,还是静态呢,ipv4静态少一点,ipv6静态相对较多还外加PD使能)。
- 不管在哪种模式下有些配置都是一样的,管这种配置叫做默认,所以网页只管发关键的,默认的在后台会执行
接口函数映射关系:
DEMO: 桥模式:
#!/bin/sh
function Bridge()
{
tcapi set APWanInfo_Common FixedAPMode Bridge
tcapi set Account_Entry1 Logged 0
tcapi commit APWanInfo_Common
}
echo -e "\033[;7;32mSetting Bridge Mode !\033[0m"
Bridge
执行结果:
DEMO: 路由模式(普通的ipv4 DHCP方式):
function Route()
{
#路由模式
echo -e "\033[;31;7mDefaut and From web\033[0m"
#from web
tcapi set WanInfo_WanIF protocol_type IPv4
#from web
tcapi set WanInfo_WanIF PD_enable No
#from web
tcapi set WanInfo_WanIF mtu_ip 1500
#default
tcapi set WanInfo_WanPVC Action Modify
#from web 连接类型 Bridge 桥接 Route 路由
tcapi set APWanInfo_Common FixedAPMode Route
#default
tcapi set WanInfo_WanPVC VLANID 4096
tcapi set WanInfo_WanPVC DOT1P 0
tcapi set WanInfo_WanPVC VLANMode UNTAG
#defaut
tcapi set WanInfo_WanPVC ENCAP "1483 Bridged IP LLC"
#from web IP获取方式 0 DHCP;1 static ;2 PPPOE
tcapi set WanInfo_WanIF ISP 0
#default
isNPUSupported=`tcapi get WebCustom_Entry isNPUSupported`
if [ ${isNPUSupported} = "Yes" ]; then
tcapi set WanInfo_WanIF Active Yes
tcapi set APWanInfo_Common FixedAPMode Route
echo -e "\033[;7;31mActive Yes\033[0m"
else
tcapi set WanInfo_WanIF Active No
fi
#default
tcapi set WanInfo_WanIF ServiceList INTERNET
tcapi set WanInfo_WanIF BandActive N/A
tcapi set WanInfo_WanIF LAN1 No
tcapi set WanInfo_WanIF WanMode Route
#连接方式 IP方式; linkPPP pppoe方式
tcapi set WanInfo_WanIF LinkMode linkIP
tcapi set WanInfo_WanPVC VLANMode UNTAG
tcapi set WanInfo_WanIF dot1q No
tcapi set WanInfo_WanIF dot1p No
tcapi set WanInfo_WanIF NATENABLE Enable
tcapi set WanInfo_WanIF IGMPproxy No
tcapi set WanInfo_WanIF DHCPEnable 1
#ipv4
tcapi set WanInfo_WanIF PDOrigin None
#default
tcapi set WanInfo_WanIF IFIdx 1
tcapi save
tcapi commit WanInfo_WanPVC
}
echo -e "\033[;7;32mSetting Route Mode !\033[0m"
Route
执行结果:
上网设置节点详细记录:
开头中讲了,在了解之前,需要知道每一项是怎么设置的以及它的作用,这里是罗列了一些关键配置,一些默认配置在demo里有注释:
会根据json字段里相应的值修改:下方是一整套的,json里有这个名才会设置,例如:ipadd_ip
#判断协议版本
tcapi set WanInfo_WanIF protocol_type IPVERSION
#pppope拨号
tcapi set WanInfo_WanIF userName USERNAME
tcapi set WanInfo_WanIF password PASSWORD
#PD使能用
tcapi set WanInfo_WanIF IPv6_wan_type DHCPv6
tcapi set WanInfo_WanIF PD_enable PDEnable
tcapi set WanInfo_WanIF prefix DHCPv6PD
#设置静态ipv4时用
tcapi set WanInfo_WanIF ipadd_ip IPADDR
tcapi set WanInfo_WanIF Submask_ip NETMASK
tcapi set WanInfo_WanIF gateway_ip GATEWAY
tcapi set WanInfo_WanIF first_dns DNS
tcapi set WanInfo_WanIF sec_dns SecDNS
#设置静态ipv6时用
tcapi set WanInfo_WanIF IPv6_add IPADDR6
tcapi set WanInfo_WanIF IPv6_gateway GATEWAY6
tcapi set WanInfo_WanIF IPv6_add_prefix PREFIX6
tcapi set WanInfo_WanIF ipv6_first_dns DNS6
tcapi set WanInfo_WanIF ipv6_sec_dns SecDNS6
tcapi set APWanInfo_Common prefix_add PDPrefix
tcapi set APWanInfo_Common preferred_life PrefixPltime
tcapi set APWanInfo_Common Effective_life PrefixVltime
tcapi set WanInfo_WanIF mtu_ip MTU
节点 | 节点子项 | 子项配置值 |
---|---|---|
APWanInfo_Common | FixedAPMode | 接入类型 (配置或者查看) Bridge 桥接 Route 路由 |
Route 路由模式 | – | – |
WanInfo_WanIF | LinkMode | 连接方式 linkIP IP方式; linkPPP pppoe方式 |
↑ | IPVERSION | IP协议版本 IPv4; IPv6; IPv4/IPv6 |
↑ | ISP | IP获取方式 0 DHCP;1 static ;2 PPPOE |
↑ | MTU | 最传输单元 默认为1500 |
↑ | DHCPv6 | IPv6获取方式 Yes DHCP; No slaac; N/A static |
↑ | PDEnable | PD使能 YES 开; No 关 |
↑ | DHCPv6PD | 前缀模式 Yes auto; No manual |
IPv4 为static | – | – |
WanInfo_WanIF | IPADDR | IP |
↑ | GATEWAY | 网关 |
↑ | NETMASK | 子网掩码 |
↑ | DNS | DNS |
↑ | SecDNS | 辅DNS |
IPv6 为static | – | – |
WanInfo_WanIF | IPADDR6 | IP |
↑ | PREFIX6 | 长度 64/128 |
↑ | GATEWAY6 | 网关 |
↑ | DNS6 | DNS |
↑ | SecDNS6 | 辅DNS |
IPv6 PD使能开且前缀模式为manual | – | – |
APWaninfo_Common | PDPrefix | 前缀地址 |
↑ | PrefixPltime | 首选寿命 |
↑ | PrefixVltime | 有效寿命 |
Route 路由拨号 | – | – |
Waninfo_WanIF | USERNAME | PPPOE账号 |
↑ | PASSWORD | PPPOE密码 |
↑ | PPPGETIP | Dynamic |
↑ | ENCAP | PPPoE LLC |
PD使能是关于ipv6的:
若看原网页源码:
apps/private/webPage/Router/cmccv2/boaroot/cgi-bin/net-wanset.asp