Openwrt初始化基本配置

Openwrt初始化基本配置

针对x86_64平台

openwrt Version: 24.10

每个版本的依赖都不一样报错也会不一样。

1.修改网卡配置

配置文件路径,修改成dhcp或者静态IP

root@OpenWrt:~# cat /etc/config/network 

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd2c:ae00:bb0d::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0'

config interface 'lan'
	option device 'br-lan'
	option proto 'dhcp'
	
service network restart
ip a # 查看IP地址

2.修改登陆和ssh密码

根据获取到的IP地址浏览器访问登陆默认用户名密码

root

admin

system -> administrator
修改默认密码

2.修改系统时间

system -> system

修改为上海时区。

3.修改软件源

ssh root@获取到的IP地址 登陆终端

sed -i 's#downloads.openwrt.org#mirrors.tuna.tsinghua.edu.cn/openwrt#g' /etc/opkg/distfeeds.conf
opkg update

4.扩容分区(可选)

镜像默认的/分区只有98M可以按需单独扩容一下。

# 参考地址
https://openwrt.org/docs/guide-user/advanced/expand_root



opkg update
opkg install parted losetup resize2fs blkid
 
# Download expand-root.sh
wget -U "" -O expand-root.sh "https://openwrt.org/_export/code/docs/guide-user/advanced/expand_root?codeblock=0"
 
# Source the script (creates /etc/uci-defaults/70-rootpt-resize and /etc/uci-defaults/80-rootpt-resize, and adds them to /etc/sysupgrade.conf so they will be re-run after a sysupgrade)
chmod +x expand-root.sh
./expand-root.sh
 
# Resize root partition and filesystem (will resize partiton, reboot resize filesystem, and reboot again)
sh /etc/uci-defaults/70-rootpt-resize

5.安装主题

# 参考地址
https://github.com/jerrykuku/luci-theme-argon/blob/master/README_ZH.md

opkg update
opkg install luci-compat luci-lib-ipkg
wget --no-check-certificate https://github.com/jerrykuku/luci-theme-argon/releases/download/v2.3.2/luci-theme-argon_2.3.2-r20250207_all.ipk
opkg install luci-theme-argon_2.3.2-r20250207_all.ipk

# 汉化包
opkg install luci-i18n-base-zh-cn

6.安装passwall

opkg update
opkg remove dnsmasq

wget -O passwall.pub https://master.dl.sourceforge.net/project/openwrt-passwall-build/passwall.pub
opkg-key add passwall.pub

read release arch << EOF
$(. /etc/openwrt_release ; echo ${DISTRIB_RELEASE%.*} $DISTRIB_ARCH)
EOF
for feed in passwall_luci passwall_packages passwall2; do
  echo "src/gz $feed https://master.dl.sourceforge.net/project/openwrt-passwall-build/releases/packages-$release/$arch/$feed" >> /etc/opkg/customfeeds.conf
done

opkg update
opkg install luci-app-passwall  # dnsmasq-full 会被作为依赖安装

# 汉化包,注意和仓库中的版本对应
touch /etc/uci-defaults/luci-i18n-passwall-zh-cn
https://github.com/xiaorouji/openwrt-passwall/releases/download/25.11.1-1/luci-24.10_luci-i18n-passwall-zh-cn_25.11.1_all.ipk

opkg install https://github.com/xiaorouji/openwrt-passwall/releases/download/25.11.1-1/luci-24.10_luci-i18n-passwall-zh-cn_25.11.1_all.ipk

6.1 安装核心依赖

# 参考地址:
https://github.com/xiaorouji/openwrt-passwall

# 使用这两个核心插件差不多就包含了所有的上网协议,下载相应架构的包解压安装下面的两个包

xray-core
xray-plugin

xray-core_25.10.15-r1_x86_64.ipk
xray-plugin_1.8.24-r1_x86_64.ipk

opkg install kmod-nft-socket kmod-nft-tproxy
posted @ 2025-11-26 15:47  Gshelldon  阅读(149)  评论(0)    收藏  举报