Blogger Information
Blog 60
fans 0
comment 0
visits 66662
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
【阿里云镜像】使用VM虚拟机安装OpenWRT并更换阿里云镜像源
大宝
Original
2670 people have browsed it

一、参考链接

阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区 (aliyun.com)

openwrt镜像-openwrt下载地址-openwrt安装教程-阿里巴巴开源镜像站 (aliyun.com)

VMware安装OpenWrt让宿主机上网&旁路由(两种方案)_Algorithm的博客-CSDN博客_vmware 旁路由

VM虚拟机搭建openwrt系统环境配置和使用_weixin_41782780的博客-CSDN博客_openwrt vm

二、OpenWRT简介

OpenWRT(曾用名 LEDE)是一款广泛应用于路由器的嵌入式操作系统。本站提供 OpenWRT 的包管理器 opkg的镜像,以加快国内访问速度。

三、使用VM虚拟机安装OpenWRT操作步骤

1、下载OpenWRT.img镜像源

下载地址:https://mirrors.aliyun.com/openwrt

image-20211219145914763

2、将.img镜像文件转换成.vmdk虚拟硬盘格式文件

所需工具为:StarWind V2V Image Converter

(1)打开StarWind V2V Image Converter

image-20211219150359357

(2)选择将要转换的镜像文件存储的位置

(选择Local file)本地文件夹

image-20211219150534801

(3)选择源镜像文件

image-20211219150618775

(4)选择转换格式

image-20211219150654650

(5)选择磁盘格式

image-20211219150718266

(6)确认信息,开始转换

image-20211219150745518

(7)转换完成

image-20211219150830039

3、使用VM虚拟机创建OpenWRT

==部分关键截图如下图所示==

① 选择的客户机操作系统如下图所示

image-20211219151033407

② 使用NAT地址转换模式

image-20211219151135165

③ 选择磁盘,为刚刚转换过后的.vmdk磁盘格式文件

image-20211219151308758

image-20211219151333701

image-20211219151424001

④ 创建完成,点击“开启此虚拟机”

image-20211219151527356

⑤ 登录成功

image-20211219151648444

4、修改网络参数信息并SSH连接

root@OpenWrt:~# vi /etc/config/networkroot@OpenWrt:~# cat /etc/config/networkconfig 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 'fd33:8f52:e9fd::/48'config device        option name 'br-lan'        option type 'bridge'        list ports 'eth0'config interface 'lan'        option device 'br-lan'        option proto 'static'        option ipaddr '192.168.200.50'        option netmask '255.255.255.0'        option ip6assign '60'root@OpenWrt:~# ip a1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00    inet 127.0.0.1/8 scope host lo       valid_lft forever preferred_lft forever    inet6 ::1/128 scope host       valid_lft forever preferred_lft forever2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br-lan state UP qlen 1000    link/ether 00:0c:29:b4:2f:04 brd ff:ff:ff:ff:ff:ff5: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000    link/ether 00:0c:29:b4:2f:04 brd ff:ff:ff:ff:ff:ff    inet 192.168.200.50/24 brd 192.168.200.255 scope global br-lan       valid_lft forever preferred_lft forever    inet6 fd33:8f52:e9fd::1/60 scope global noprefixroute       valid_lft forever preferred_lft forever    inet6 fe80::20c:29ff:feb4:2f04/64 scope link       valid_lft forever preferred_lft foreverroot@OpenWrt:~#_________________________________________________________________C:\Users\xybdiy>ssh root@192.168.200.50The authenticity of host '192.168.200.50 (192.168.200.50)' can't be established.ED25519 key fingerprint is SHA256:uINCvTddAyG9bGGRCD/5R2b7DSmUoxLDcyNe4Pcr9OA.Are you sure you want to continue connecting (yes/no/[fingerprint])? yesWarning: Permanently added '192.168.200.50' (ED25519) to the list of known hosts.BusyBox v1.33.1 (2021-10-24 09:01:35 UTC) built-in shell (ash)  _______                     ________        __ |       |.-----.-----.-----.|  |  |  |.----.|  |_ |   -   ||  _  |  -__|     ||  |  |  ||   _||   _| |_______||   __|_____|__|__||________||__|  |____|          |__| W I R E L E S S   F R E E D O M ----------------------------------------------------- OpenWrt 21.02.1, r16325-88151b8303 -----------------------------------------------------=== WARNING! =====================================There is no root password defined on this device!Use the "passwd" command to set up a new passwordin order to prevent unauthorized SSH logins.--------------------------------------------------root@OpenWrt:~#

5、访问OpenWRT的WEB界面,输入配置的IP地址即可

image-20211219152730428

image-20211219152743381

四、更换阿里OpenWRT镜像源

手工替换
登录到路由器,并编辑 /etc/opkg/distfeeds.conf文件,

将其中的downloads.openwrt.org 替换为 mirrors.aliyun.com/openwrt`即可。

快捷替换
执行如下命令自动替换

sed -i 's_downloads.openwrt.org_mirrors.aliyun.com/openwrt_' /etc/opkg/distfeeds.conf

操作过程如下:

root@OpenWrt:~# cat /etc/opkg/distfeeds.confsrc/gz openwrt_core https://downloads.openwrt.org/releases/21.02.1/targets/x86/64/packagessrc/gz openwrt_base https://downloads.openwrt.org/releases/21.02.1/packages/x86_64/basesrc/gz openwrt_luci https://downloads.openwrt.org/releases/21.02.1/packages/x86_64/lucisrc/gz openwrt_packages https://downloads.openwrt.org/releases/21.02.1/packages/x86_64/packagessrc/gz openwrt_routing https://downloads.openwrt.org/releases/21.02.1/packages/x86_64/routingsrc/gz openwrt_telephony https://downloads.openwrt.org/releases/21.02.1/packages/x86_64/telephonyroot@OpenWrt:~# sed -i 's_downloads.openwrt.org_mirrors.aliyun.com/openwrt_' /etc/opkg/distfeeds.confroot@OpenWrt:~# cat /etc/opkg/distfeeds.confsrc/gz openwrt_core https://mirrors.aliyun.com/openwrt/releases/21.02.1/targets/x86/64/packagessrc/gz openwrt_base https://mirrors.aliyun.com/openwrt/releases/21.02.1/packages/x86_64/basesrc/gz openwrt_luci https://mirrors.aliyun.com/openwrt/releases/21.02.1/packages/x86_64/lucisrc/gz openwrt_packages https://mirrors.aliyun.com/openwrt/releases/21.02.1/packages/x86_64/packagessrc/gz openwrt_routing https://mirrors.aliyun.com/openwrt/releases/21.02.1/packages/x86_64/routingsrc/gz openwrt_telephony https://mirrors.aliyun.com/openwrt/releases/21.02.1/packages/x86_64/telephonyroot@OpenWrt:~#

五、总结与问题反馈

暂未解决使用VM虚拟机创建的OpenWRT系统,使其能够访问外网,已经尝试多种方法,依旧不行。问题留存,待解决。

root@OpenWrt:~# ping qq.comping: bad address 'qq.com'root@OpenWrt:~#
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post