本章主要参考: https://wiki.openwrt.org/doc/uci/network
/etc/config/network主要用于配置vlan、接口和路由,修改network文件后执行下列命令应用新的配置
# /etc/init.d/network reload
switch
config switch_vlan
option device 'switch0' # 定义设备
option vlan '1' # vlan号
option ports '1 2 3 4 6t' # 端口
interface
config interface 'lan'
option type 'bridge' # 接口模式,这里是桥模式
option ifname 'eth0.1' # 接口名称
option proto 'static' # 协议类型,可选项有‘dhcp’、‘pppoe’、‘3g’、‘ppp’等
option netmask '255.255.255.0' # 掩码
option ipaddr '192.168.1.3' # ip
route
config ‘route’
option ‘interface’ ‘lan’ # 接口名称
option ‘target’ ‘172.16.123.0’ # 目标网络
option ‘netmask’ ‘255.255.255.0’ # 掩码
option ‘gateway’ ‘172.16.123.100’ # 网关