前言

未命名文件.png

安装openwrt

➜  qemu-img convert -f raw -O vmdk openwrt-22.03.3-x86-64-generic-ext4-combined.img openwrt-22.03.3-x86-64-generic-ext4-combined.vmdk
➜  ls -al openwrt-22.03.3-x86-64-generic-ext4-combined.vmdk 
.rw-r--r-- kali-team users 25 MB Sun Apr  2 13:26:57 2023  openwrt-22.03.3-x86-64-generic-ext4-combined.vmdk

Untitled

Untitled

Untitled

配置单网卡

Untitled

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 'fd84:83b8:ea18::/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 '10.168.1.3'
        option netmask '255.255.255.0'
        option ip6assign '60'

Untitled

Web管理界面

Untitled

Untitled

Untitled

安装中文界面

root@OpenWrt:~# sed -i 's_downloads.openwrt.org_mirrors.tuna.tsinghua.edu.cn/openwrt_' /etc/opkg/distfeeds.conf
root@OpenWrt:~# opkg update
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/targets/x86/64/packages/Packages.gz>
Updated list of available packages in /var/opkg-lists/openwrt_core
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/targets/x86/64/packages/Packages.sig>
Signature check passed.
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/packages/x86_64/base/Packages.gz>
Updated list of available packages in /var/opkg-lists/openwrt_base
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/packages/x86_64/base/Packages.sig>
Signature check passed.
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/packages/x86_64/luci/Packages.gz>
Updated list of available packages in /var/opkg-lists/openwrt_luci
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/packages/x86_64/luci/Packages.sig>
Signature check passed.
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/packages/x86_64/packages/Packages.gz>
Updated list of available packages in /var/opkg-lists/openwrt_packages
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/packages/x86_64/packages/Packages.sig>
Signature check passed.
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/packages/x86_64/routing/Packages.gz>
Updated list of available packages in /var/opkg-lists/openwrt_routing
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/packages/x86_64/routing/Packages.sig>
Signature check passed.
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/packages/x86_64/telephony/Packages.gz>
Updated list of available packages in /var/opkg-lists/openwrt_telephony
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/packages/x86_64/telephony/Packages.sig>
Signature check passed.
root@OpenWrt:~# opkg install luci-i18n-base-zh-cn
Installing luci-i18n-base-zh-cn (git-23.090.61754-f7f34d4) to root...
Downloading <https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.3/packages/x86_64/luci/luci-i18n-base-zh-cn_git-23.090.61754-f7f34d4_all.ipk>
Configuring luci-i18n-base-zh-cn.

添加多网卡

Untitled

Untitled

Untitled

Untitled

Untitled

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 'fda9:ae83:3e7a::/48'

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

config interface 'lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        list dns '8.8.8.8'
        list dns '1.1.1.1'
        option device 'eth1'
        option ipaddr '192.168.233.1'
        option broadcast '192.168.233.255'

config device
        option name 'eth0'

config interface 'wan'
        option proto 'dhcp'
        option device 'br-lan'
config defaults                                                                                                                                                               
        option syn_flood        1
        option input            ACCEPT
        option output           ACCEPT
        option forward          REJECT
# Uncomment this line to disable ipv6 rules 
#       option disable_ipv6     1

config zone
        option name             lan
        list   network          'lan'
-        option input            ACCEPT
-        option output           ACCEPT
-        option forward          ACCEPT
+        option input            REJECT
+        option output           REJECT
+        option forward          REJECT

config zone
        option name             wan
        list   network          'wan'
        list   network          'wan6'
-        option input            REJECT
+        option input            ACCEPT
        option output           ACCEPT
-        option forward          REJECT
+        option forward          ACCEPT
        option masq             1
        option mtu_fix          1

config forwarding
        option src              lan
        option dest             wan
root@OpenWrt:/etc/init.d/firewall restart
root@OpenWrt:~#

Untitled

设置防火墙

Untitled

Untitled

Untitled

Untitled

Untitled

总结

参考

Powered by Kali-Team