public:it:openwrt

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

后一修订版
前一修订版
public:it:openwrt [2022/08/15 15:06] – 创建 oakfirepublic:it:openwrt [2022/09/27 17:56] (当前版本) – [VLAN] oakfire
行 1: 行 1:
 ====== OpenWrt ====== ====== OpenWrt ======
 +  * [[https://openwrt.org/]]
 +  * [[https://openwrt.org/packages/start|Packages]], ''opkg''
 +===== device =====
 +  * https://openwrt.org/docs/guide-developer/adding_new_device
 +===== Tips =====
 +  * openwrt 内 ''git clone'' 时遇到 报错 <code>git: 'remote-https' is not a git command. See 'git --help'</code>,安装 git-http 可解决此问题 ''opkg install git-http''
 +===== feeds =====
 +  * https://openwrt.org/docs/guide-developer/feeds
 +  * [[https://openwrt.org/docs/guide-developer/toolchain/single.package|Building a single package]] - 编译单一 package的步骤
 +===== ubus =====
 +  * https://openwrt.org/docs/techref/ubus
 +===== UCI =====
 +  * https://openwrt.org/docs/guide-user/base-system/uci
 +  * ''/etc/config/''
 +===== LuCI =====
 +  * https://github.com/openwrt/luci
 +  * https://github.com/openwrt/luci/wiki/Documentation
 +  * [[http://openwrt.github.io/luci/api/index.html|Server side Lua APIs]]
 +  * 大部分数据获取通过 [[https://openwrt.org/docs/techref/ubus|ubus]], 由实现 jsonrpc2.0 协议的 ''uhttpd-mod-ubus'' 模块提供功能
  
 +===== uHTTPd =====
 +  * https://openwrt.org/docs/guide-user/services/webserver/http.uhttpd
 +  * https://openwrt.org/docs/guide-user/services/webserver/uhttpd
 +
 +===== VLAN =====
 +  * [[https://info.support.huawei.com/info-finder/encyclopedia/zh/VLAN.html|VLAN介绍]]
 +  * [[https://openwrt.org/docs/guide-user/network/vlan/switch_configuration|openwrt 对于 vlan 操作的介绍]], 
 +    * 使用 openwrt swconfig 驱动方式的 switch 设备可以用 ''switch_vlan'' 的方式进行 vlan 划分;
 +    * 而使用 linux 最新 DSA switch 驱动方式的,则使用 openwrt v21.0 之后的luci 界面表现的 ''bridge_vlan'' 方式划分vlan。
 +    * DSA switch 驱动会把每个lan口都表现为一个lan设备, ifconfig 会看到 lan1到lan4不等
 +
 +===== VMWare 创建 OpenWrt 虚拟机 =====
 +
 +  - 在官网下载 **x86/64** 的img, 比如 https://downloads.openwrt.org/releases/21.02.3/targets/x86/64/openwrt-21.02.3-x86-64-generic-ext4-combined-efi.img.gz
 +  - 使用工具 **StarWind V2V Converter** 把 img 转为 vmdk
 +  - 在 VMWare 创建虚拟机,系统选择【 Linux / 其他 Linux 5.x 及更高版本内核 64 位】
 +  - 网络选择 NAT (VMWare 需提前创建好 NAT模式虚拟网络)
 +  - 选择已有的硬盘,加载之前转换好的 vmdk 文件
 +  - 开机,进去修改网络:<code bash> 
 +uci set network.lan.proto=dhcp
 +uci commit network
 +/etc/init.d/network restart</code>
 +  - ''ifconfig'' 查看 lan 的 ip, host 主机浏览该 ip 即可看到 LuCI 页面。
 +  - 扩展硬盘, 参考[[https://blog.csdn.net/duandao123/article/details/99689383|此文]]:
 +    - 在 vmware 扩展硬盘;
 +    - 进入openwrt, 安装必要软件: ''opkg update'', ''opkg install block-mount e2fsprogs fdisk blkid''
 +    - 配置新分区<code bash>fdisk /dev/sda
 +m  # enter help
 +n  # add new
 +3  # 分区号选择默认3
 +默认默认
 +w  # 写入
 +# fdisk 结束
 +reboot # 重启
 +mkfs.ext4 /dev/sda3 # 格式化
 +reboot # 重启
 +</code>
 +    - 复制根目录到新分区<code bash>
 +mkdir /mnt/sda3
 +mount /dev/sda3 /mnt/sda3
 +mkdir -p /tmp/cproot
 +mount --bind / /tmp/cproot
 +tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda3 -xf -
 +umount /tmp/cproot
 +umount /mnt/sda3
 +</code>
 +    - 配置  fstab<code bash>
 +blkid -s UUID /dev/sda3 | cut -d\" -f2  # 得到 /dev/sda3 的uuid
 +f53ad0a2-18ba-4d37-8d1a-44ad3d1b4ce4  # uuid
 +
 +uci add fstab mount
 +uci set fstab.@mount[-1].uuid= <uuid> # 此处<uuid> 为上方得到的 uuid
 +uci set fstab.@mount[-1].options=rw,sync,noatime
 +uci set fstab.@mount[-1].fstype=ext4
 +uci set fstab.@mount[-1].enabled_fsck=1
 +uci set fstab.@mount[-1].enabled=1
 +uci set fstab.@mount[-1].target=/
 +uci set fstab.@mount[-1].device=/dev/sda3
 +uci commit fstab
 +
 +/etc/init.d/fstab enable
 +/etc/init.d/fstab start
 +
 +</code>
 +    - ''reboot'' 重启确认硬盘成功扩展
  • public/it/openwrt.1660547202.txt.gz
  • 最后更改: 2022/08/15 15:06
  • oakfire