OpenClash in OpenWrt
Setup OpenClash in OpenWrt x86 under VMWare ESXi
- Download latest image from https://mirror-03.infra.openwrt.org/releases/
- Convert to vmdk in ubuntu
qemu-img convert -f raw -O vmdk <imput.img> <output.vmdk> - Create a new VM in ESXi and upload the vmdk
Ssh to ESXi and execute in default folder
vmkfstools -i /vmfs/volumes/datastore1/openwrt2/input.vmdk /vmfs/volumes/datastore1/openwrt2/output.vmdk- Launch VM and
vim /etc/config/network, change ip to 172.16.68.9, reboot - Change network interface config in web portal, set gateway and DNS server to 172.16.68.1, disable DHCP
- Copy settings from the old openwrt
- Change to aliyun source lists,
sed -i 's_downloads.openwrt.org_mirrors.aliyun.com/openwrt_' /etc/opkg/distfeeds.conf - Remove the
option check_signaturein /etc/opkg.conf opkg updateandopkg install open-vm-tools nano- Expand the disk size to 16GB in ESXi
- Follow https://openwrt.org/docs/guide-user/advanced/expand_root
1 2 3 4 5 6 7 8 9 10 11 12
# Install packages 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) . ./expand-root.sh # Resize root partition and filesystem (will resize partiton, reboot resize filesystem, and reboot again) sh /etc/uci-defaults/70-rootpt-resize opkg remove dnsmasq- Follow https://github.com/vernesong/OpenClash/releases/tag/v0.47.024, use nftables
1 2 3 4
#nftables opkg update opkg install bash dnsmasq-full curl ca-bundle ip-full ruby ruby-yaml kmod-tun kmod-inet-diag unzip kmod-nft-tproxy luci-compat luci luci-base opkg install /tmp/openclash.ipk
Download the ipk and install it in web portal
- Setup VRRP via https://zhuanlan.zhihu.com/p/675745631, don’t forget to add
option alt_config_file "/etc/keepalived/keepalived.confin /etc/config/keepalived1 2
opkg update opkg install keepalived
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
! Configuration File for keepalived global_defs { router_id LVS_DEVEL } vrrp_instance VI_1 { state MASTER interface br-lan virtual_router_id 51 priority 110 advert_int 1 virtual_ipaddress { 172.16.68.10 } } /etc/init.d/keepalived enable
This post is licensed under CC BY 4.0 by the author.