Web界面修改
文章来源:https://www.toymoban.com/news/detail-518862.html
vi /etc/config/network /etc/config/wireless /etc/config/firewall
root@OpenWrt:/# cat /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan'
option ifname 'eth1'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option dns '114.114.114.114 101.226.4.6 218.30.118.6 123.125.81.6 140.207.198.6 8.8.8.8 8.8.4.4' (域名解析)
config interface 'wan'
option ifname 'eth0'
option proto 'dhcp'
option metric '0'
config switch
option name 'eth1'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'eth1'
option vlan '1'
option ports '0 1 2 3 4'
root@OpenWrt:/# cat /etc/config/wireless
config wifi-device wifi0
option type qcawifi
option channel auto
option macaddr 94:a4:08:ef:fc:c0
option hwmode 11ng
# REMOVE THIS LINE TO ENABLE WIFI:
config wifi-iface
option device wifi0
option network 'lan'
option mode ap
option ssid OpenWrt
option encryption none
root@OpenWrt:/# cat /etc/config/firewall
config defaults
option syn_flood '1'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
option disabled '0'
config zone
option name 'lan'
option network 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
config zone
option name 'wan'
option network 'wan'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
config forwarding
option src 'lan'
option dest 'wan'
uci 命令修改
UCI命令讲解文章来源地址https://www.toymoban.com/news/detail-518862.html
源码修改
设置LAN默认IP
package/base-files/files/lib/functions/uci-defaults.sh
ucidef_set_interface_lan() {
local ifname=$1
uci batch <<EOF
set network.lan='interface'
set network.lan.ifname='$ifname'
set network.lan.type='bridge'
set network.lan.proto='static'
set network.lan.ipaddr='192.168.1.1'
set network.lan.netmask='255.255.255.0'
EOF
}
修改dns,域名解析
vi /etc//etc/resolv.conf (由于/tmp/resolv.conf 创建软链接是缓存目录下面文件重启会消失)
nameserver 8.8.8.8
vi /etc/config/network
修改lan
option dns 8.8.8.8
阿里公共DNS:223.5.5.5,223.6.6.6 类型选择:UDP
阿里加密DNS:aliDNS_ip/DNS-query 类型选择:https
阿里加密DNS:DNS.aliDNS.com/DNS-query 类型选择:https
腾讯公共DNS+:119.29.29.29 类型选择:UDP
腾讯加密DNS:doh.pub/DNS-query 类型选择:https
腾讯加密DNS:sm2.doh.pub/DNS-query 类型选择:https
百度公共DNS:180.76.76.76 类型选择:UDP
华为云公共DNS :122.112.208.1,139.9.23.90 类型选择:UDP
114公共DNS:114.114.114.114,114.114.115.115 类型选择:UDP
OpenerDNS:42.120.21.30 类型选择:UDP
DNS派 电信 / 移动 / 铁通:101.226.4.6,218.30.118.6 类型选择:UDP
DNS派 联通:123.125.81.6,140.207.198.6 类型选择:UDP
Google DNS:8.8.8.8,8.8.4.4 类型选择:tls(UDPTCP也可以加入)
Google加密DNS:dns.google/dns-query 类型选择:https
Google加密DNS:dns.google 类型选择:tls
CloudFlare:1.1.1.1类型选择:tls(UDPTCP也可以加入)
IBM Quad9:9.9.9.9类型选择:tls(UDPTCP也可以加入)
IBM Quad9:doh.opendns.com/dns-query 类型选择:https
Norton ConnectSafe:199.85.126.10 199.85.127.10 类型选择:UDP
威瑞信:64.6.64.6 64.6.65.6 类型选择:UDP
Comodo**安全DNS:** 8.26.56.2 68.20.247.20 类型选择:UDP
DNS Watch**:** 84.200.69.80 84.200.70.40 类型选择:UDP
OpenDNS:208.67.222.222,208.67.220.220类型选择:tls(UDPTCP也可以加入)
韩国电信DNS:168.126.63.1,168.126.63.2类型选择:tls(UDPTCP也可以加入)
V2EX DNS:199.91.73.222,178.79.131.110类型选择:tls(UDPTCP也可以加入)
路由表
到了这里,关于OpenWrt 网络设置(六)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!