# OpenWRT 默认 ip 是 192.168.1.1
# 复制所有内容去执行 ssh root@192.168.1.1
#
# 执行完就自动拨号和 内网改成 10.0.0.1
## 备份
cp -r /etc/config /etc/back
cp /etc/opkg/distfeeds.conf /etc/back
mv /etc/back /etc/config
## 备份
## hosts
cp /etc/hosts /etc/config/back/hosts.back
echo "" >> /etc/hosts
echo "" >> /etc/hosts
echo "10.0.0.38 fanconn.com" >> /etc/hosts
echo "10.0.0.38 www.fanconn.com" >> /etc/hosts
echo "10.0.0.38 adgh.fanconn.com" >> /etc/hosts
echo "10.0.0.38 wiki.fanconn.com" >> /etc/hosts
echo "10.0.0.38 build.fanconn.com" >> /etc/hosts
echo "10.0.0.38 adgh.zhuihoude.cn" >> /etc/hosts
echo "10.0.0.39 o.zhuihoude.cn" >> /etc/hosts
echo "" >> /etc/hosts
## hosts
## dropbear
echo "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIOLdYRLReUZimXLydJkmY1RSVo9xoVENGDE6JjjXb8DAAAAAEXNzaDpZdWJpS2V5IDUgTkZD YubiKey 5 NFC" > /etc/dropbear/authorized_keys
echo "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIKAKnnA3jxx3APkOdkFF5YdenP+odIHUSRqJvboSXZqPAAAAEHNzaDpZb3VydGV4dGhlcmU= Canokey Pigeon" >> /etc/dropbear/authorized_keys
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICIr9eesAHrubwNDzdI0+idKJhpEjmapRsPn7PHawrYR roy@HUAWEIMagicMiniM4.lan" >> /etc/dropbear/authorized_keys
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICDz1pQD1GiY1YSfsxds0QIjLgpJuOTkG7fYyoYoL0eH Shelly-15" >> /etc/dropbear/authorized_keys
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOlBMlUhmfBuuovEFO8vak0ekNKeie+OkgxJQd2X/ojQ ServerCat" >> /etc/dropbear/authorized_keys
uci set dropbear.main.PasswordAuth='off'
uci set dropbear.main.RootPasswordAuth='off'
uci set dropbear.main.GatewayPorts='on'
## dropbear
uci commit
## PPPOE
uci del network.wan6
#
uci set network.wan.proto='pppoe'
uci set network.wan.username='02004172213@163.gd'
uci set network.wan.password='PZAYINOU'
uci set network.wan.ipv6='auto'
## PPPOE
uci commit
## Network
uci set network.lan.ipaddr='10.0.0.1'
uci set network.lan.netmask='255.255.252.0'
# uci set network.lan.gateway='10.0.0.1'
# uci set network.lan.dns='202.96.128.86,202.96.134.33'
## Network
uci commit
## 正常 dhcp
uci del dhcp.wan6
uci set dhcp.lan.dns_service='0'
#
# uci set dhcp.lan=dhcp
# uci set dhcp.lan.force=1 # 强制分配
uci set dhcp.lan.leasetime='2h'
uci set dhcp.lan.start=100
uci set dhcp.lan.limit='512'
# uci set dhcp.@dnsmasq[0].port='53'
uci set dhcp.@dnsmasq[0].sequential_ip=0 # 按顺序分配 IP
#
# Option
uci delete dhcp.lan.dhcp_option
uci add_list dhcp.lan.dhcp_option='3,10.0.0.1' # DHCP 选项 3 指定网关
uci add_list dhcp.lan.dhcp_option='6,10.0.0.38,10.0.0.1'
## 正常 dhcp
uci commit
################ 外网 ipv6 防火墙
## 防火墙
## Nas 开放防火墙
uci add firewall rule # 创建新规则
uci set firewall.@rule[-1].name='Allow-IPv6-NAS' # 设备名 NAS
uci set firewall.@rule[-1].src='*' # 源区域为 wan/*
uci set firewall.@rule[-1].dest='*' # 目标区域为 lan/*
uci set firewall.@rule[-1].dest_mac='90:09:D0:7B:83:ED,90:09:D0:7B:83:EE,90:09:D0:7B:83:EF,90:09:D0:7B:83:F0,38:4C:4F:E7:58:F3,38:4C:4F:E7:58:F4,00:11:32:90:55:6F' # 替换为设备的 MAC 地址
uci set firewall.@rule[-1].family='ipv6' # IPV6
uci set firewall.@rule[-1].target='ACCEPT' # 允许通过
## Nas 开放防火墙
## G4560
uci add firewall rule # 创建新规则
uci set firewall.@rule[-1].name='Allow-IPv6-G4560' # 设备名
uci set firewall.@rule[-1].src='*' # 源区域为 wan/*
uci set firewall.@rule[-1].dest='*' # 目标区域为 lan/*
uci set firewall.@rule[-1].dest_mac='D8:9E:F3:26:D2:F7' # 替换为设备的 MAC 地址
uci set firewall.@rule[-1].family='ipv6' # IPV6
uci set firewall.@rule[-1].target='ACCEPT' # 允许通过
## G4560
## Rk3588
uci add firewall rule # 创建新规则
uci set firewall.@rule[-1].name='Allow-IPv6-RK3588' # 设备名
uci set firewall.@rule[-1].src='*' # 源区域为 wan/*
uci set firewall.@rule[-1].dest='*' # 目标区域为 lan/*
uci set firewall.@rule[-1].dest_mac='66:21:CB:99:DA:85' # 替换为设备的 MAC 地址
uci set firewall.@rule[-1].family='ipv6' # IPV6
uci set firewall.@rule[-1].target='ACCEPT' # 允许通过
## Rk3588
## 树莓派
uci add firewall rule # 创建新规则
uci set firewall.@rule[-1].name='Allow-IPv6-CM5' # 设备名
uci set firewall.@rule[-1].src='*' # 源区域为 wan/*
uci set firewall.@rule[-1].dest='*' # 目标区域为 lan/*
uci set firewall.@rule[-1].dest_mac='2C:CF:67:B0:C6:B5,2C:CF:67:B0:C6:B6' # 替换为设备的 MAC 地址
uci set firewall.@rule[-1].family='ipv6' # IPV6
uci set firewall.@rule[-1].target='ACCEPT' # 允许通过
## 树莓派
## USB网卡
uci add firewall rule # 创建新规则
uci set firewall.@rule[-1].name='Allow-IPv6-USB-Card' # 设备名
uci set firewall.@rule[-1].src='*' # 源区域为 wan/*
uci set firewall.@rule[-1].dest='*' # 目标区域为 lan/*
uci set firewall.@rule[-1].dest_mac='00:E0:4C:68:00:D3' # 替换为设备的 MAC 地址
uci set firewall.@rule[-1].family='ipv6' # IPV6
uci set firewall.@rule[-1].target='ACCEPT' # 允许通过
## USB网卡
uci commit
## 防火墙
################ 静态 DHCP 根据情况来
## dhcp 38-51 3.0-3.5
## tag
uci delete dhcp.fq
uci delete dhcp.fq
uci set dhcp.fq='tag'
uci set dhcp.fq.name='fq'
uci add_list dhcp.fq.dhcp_option="3,10.0.0.39"
uci add_list dhcp.fq.dhcp_option="6,10.0.0.38,10.0.0.1,114.114.114.114"
## tag
uci commit
# delete
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
uci delete dhcp.@host[-1]
# delete
uci commit
## 固定 IP 38-55
uci add dhcp host # =
uci set dhcp.@host[-1].name='RK3588'
uci set dhcp.@host[-1].ip='10.0.0.38'
uci set dhcp.@host[-1].mac='66:21:cb:99:da:85'
# uci add_list dhcp.@host[-1].tag='fq'
# Lan 2 2c:fd:a1:8c:74:57
uci add dhcp host # =
uci set dhcp.@host[-1].name='2955U'
uci set dhcp.@host[-1].ip='10.0.0.39'
uci set dhcp.@host[-1].mac='A0:00:BA:D0:0B:AD'
# uci add_list dhcp.@host[-1].tag='fq'
# Lan 2 2c:fd:a1:8c:74:57
uci add dhcp host # =
uci set dhcp.@host[-1].name='UPS-SNMP'
uci set dhcp.@host[-1].ip='10.0.0.40'
uci set dhcp.@host[-1].mac='00:20:85:E5:98:0E'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='NAS'
uci set dhcp.@host[-1].ip='10.0.0.41'
uci set dhcp.@host[-1].mac='00:11:32:90:55:6F'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='RaspberryPI'
uci set dhcp.@host[-1].ip='10.0.0.42'
uci set dhcp.@host[-1].mac='2C:CF:67:B0:C6:B5'
# uci add_list dhcp.@host[-1].tag='fq' # 2C:CF:67:B0:C6:B6
uci add dhcp host # =
uci set dhcp.@host[-1].name='G4560'
uci set dhcp.@host[-1].ip='10.0.0.43'
uci set dhcp.@host[-1].mac='D8:9E:F3:26:D2:F7'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='HUAWEIMagicMiniM4-L'
uci set dhcp.@host[-1].ip='10.0.0.44'
uci set dhcp.@host[-1].mac='D0:11:E5:85:45:48'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='HUAWEIMagicMiniM4-W'
uci set dhcp.@host[-1].ip='10.0.0.45'
uci set dhcp.@host[-1].mac='D0:11:E5:8A:E6:4B'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='HUAWEIMagicMini5-L'
uci set dhcp.@host[-1].ip='10.0.0.46'
uci set dhcp.@host[-1].mac='18:81:0E:F0:7D:0D'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='HUAWEIMagicMini5-W'
uci set dhcp.@host[-1].ip='10.0.0.47'
uci set dhcp.@host[-1].mac='F0:18:98:88:86:32'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='MacBookPro16'
uci set dhcp.@host[-1].ip='10.0.0.48'
uci set dhcp.@host[-1].mac='A4:83:E7:D2:36:B5'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='HUAWEINova15'
uci set dhcp.@host[-1].ip='10.0.0.49'
uci set dhcp.@host[-1].mac='90:2C:09:C9:C1:5E'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='Sony'
uci set dhcp.@host[-1].ip='10.0.0.50'
uci set dhcp.@host[-1].mac='28:3F:69:CC:D7:9F'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='AlanMac'
uci set dhcp.@host[-1].ip='10.0.0.51'
uci set dhcp.@host[-1].mac='A6:C9:D5:F7:81:1A'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='LJL-A'
uci set dhcp.@host[-1].ip='10.0.0.52'
uci set dhcp.@host[-1].mac='68:A0:3E:AF:05:6B'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='LJL-B'
uci set dhcp.@host[-1].ip='10.0.0.53'
uci set dhcp.@host[-1].mac='5C:3A:45:EB:29:C7'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='PS5'
uci set dhcp.@host[-1].ip='10.0.0.54'
uci set dhcp.@host[-1].mac='5C:84:3C:D3:68:7A'
# uci add_list dhcp.@host[-1].tag='fq'
## 固定 IP 38-55
uci commit
## 开发板 1.0-7
uci add dhcp host # =
uci set dhcp.@host[-1].name='DC686-L'
uci set dhcp.@host[-1].ip='10.0.1.0'
uci set dhcp.@host[-1].mac='68:2D:70:BD:70:96'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='DC686-W'
uci set dhcp.@host[-1].ip='10.0.1.1'
uci set dhcp.@host[-1].mac='00:0a:f5:52:d6:94'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='DC665-L'
uci set dhcp.@host[-1].ip='10.0.1.2'
uci set dhcp.@host[-1].mac='66:2d:2c:c6:a8:8c'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='DC665-W'
uci set dhcp.@host[-1].ip='10.0.1.3'
uci set dhcp.@host[-1].mac='00:0A:F5:82:51:AF'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='DC690-HYJ-L'
uci set dhcp.@host[-1].ip='10.0.1.4'
uci set dhcp.@host[-1].mac='AA:2D:B4:F2:F1:B9'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='DC690-HYJ-W'
uci set dhcp.@host[-1].ip='10.0.1.5'
uci set dhcp.@host[-1].mac='D4:8A:3B:A3:F2:5E'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='GT686PRO-W'
uci set dhcp.@host[-1].ip='10.0.1.6'
uci add_list dhcp.@host[-1].mac='B0:5A:44:04:56:1F'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='Xiaoping'
uci set dhcp.@host[-1].ip='10.0.1.7'
uci add_list dhcp.@host[-1].mac='00:0A:F5:2F:10:B5'
# uci add_list dhcp.@host[-1].tag='fq'
## 开发板 1.0-7
uci commit
### 漏油器交换机 1.10-13
uci add dhcp host # =
uci set dhcp.@host[-1].name='USB-CARD'
uci set dhcp.@host[-1].ip='10.0.1.10'
uci set dhcp.@host[-1].mac='00:e0:4c:68:00:d3'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='XIKE'
uci set dhcp.@host[-1].ip='10.0.1.11'
uci set dhcp.@host[-1].mac='1C:2A:A3:1A:9E:D0'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='NestWifiRouter'
uci set dhcp.@host[-1].ip='10.0.1.12'
uci set dhcp.@host[-1].mac='24:29:34:D9:F2:1E'
# uci add_list dhcp.@host[-1].tag='fq'
uci add dhcp host # =
uci set dhcp.@host[-1].name='NestWifiRouter'
uci set dhcp.@host[-1].ip='10.0.1.13'
uci set dhcp.@host[-1].mac='24:29:34:D9:F2:1F'
# uci add_list dhcp.@host[-1].tag='fq'
### 漏油器交换机 1.10-13
uci commit
## dhcp 38-51 3.0-3.5
## 全生效
rm -fr /tmp/dhcp.leases
service dropbear restart
service dnsmasq restart
service firewall restart # 重启防火墙服务
service network reload # 重启 网络 服务
## 全生效