OpenWrt安装
固件准备
kvm虚拟机,固件 openwrt-24.10.5-x86-64-generic-ext4-combined-efi.img.gz
固件下载地址: https://openwrt.org/downloads
使用StarWind V2V Converter工具转换一下
通过网盘分享的文件:starwindconverter.exe
链接: https://pan.baidu.com/s/1TSuHvFrzHWwiUHkf7BHurg?pwd=w52a
提取码: w52a
转换后的格式
openwrt-24.10.5-x86-64-generic-ext4-combined-efi.vmdk
创建虚拟机
openwrt-24.10.5这个版本使用Linux 6.x 64 的内核
两块网卡,一个桥接(作为WAN),一个vmnet2(创建一个, 作为Lan,需要把VM的DHCP关掉)
硬盘使用转换后的.VMDK文件(记得需要扩展一下硬盘大小)
启动
默认没有密码,可以设置一个(123456)
需要扩展一下系统硬盘
1、扩展根分区
安装包
| Bash |
|---|
| opkg update
opkg install parted
|
识别磁盘名称和分区号(主要找那个ext4的Number,这里是2)parted -l -s
| Bash |
|---|
| root@OpenWrt:~# parted -l -s
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
128 17.4kB 262kB 245kB bios_grub
1 262kB 17.0MB 16.8MB fat16 legacy_boot
2 17.0MB 126MB 109MB ext4
|
扩展根分区
parted -f -s /dev/sda resizepart 2 100%
重启
reboot
2、扩展根文件系统
安装包
| Bash |
|---|
| opkg update
opkg install losetup resize2fs
|
将loop设备映射到根分区
losetup /dev/loop0 /dev/sda2 2> /dev/null
扩展根文件系统
resize2fs -f /dev/loop0
重启
reboot
网卡配置
| Bash |
|---|
| 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 'fd7f:d6e9:2799::/48'
option packet_steering '1'
config interface 'wan'
option device 'eth0'
option proto 'dhcp'
config interface 'lan'
option proto 'static'
option device 'eth1'
option ipaddr '192.168.100.1'
option netmask '255.255.255.0'
config device
option name 'eth1'
option ipv6 '0'
config device
option name 'eth0'
option ipv6 '0'
|
重启网卡:
service network restart
汉化:
| Bash |
|---|
| opkg update
opkg install luci-i18n-base-zh-cn
|
在启动一个windows虚拟机,连接Vmnet2,页面访问 http://192.168.100.1