VMware OpenWrt设置网络
(1)OpenWrt的虚拟机选择NAT模式,打开VMware编辑菜单中的虚拟网络编辑器
,查看NAT模式下虚拟网卡的子网地址,假设是192.168.111.0
。启动OpenWrt虚拟机,修改/etc/config/network
,将lan网卡的地址设为192.168.61.xxx
网段的地址
# vim /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fdee:fb18:75af::/48'
config interface 'lan'
option type 'bridge'
option ifname 'eth0'
option proto 'static'
option ipaddr '192.168.111.188'
option netmask '255.255.255.0'
option ip6assign '60'
# /etc/inid.d/network restart //重启服务
(2)在虚拟网络编辑器
对话框中,选中NAT 模式
,点击NAT 设置
,查看网关 IP
,例如192.168.111.2
(3)在openwrt上添加默认网关
修改:/etc/rc.local
添加:route add default gw (nat gateway ip)
# vim /etc/rc.local
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
route add default gw 192.168.111.2
exit 0
(4)Web控制台:http://192.168.111.188
(5)设置dns
在Web控制台中,选择Network
-> DHCP and DNS
-> DNS forwardings
输入 8.8.8.8
-> Save & Apply
(6)Xshell连接
Connecting to 192.168.111.188:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
BusyBox v1.28.4 () built-in shell (ash)
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
OpenWrt 18.06.2, r7676-cddd7b4c77
-----------------------------------------------------
root@OpenWrt:~#
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/04/02/vmware-openwrt-setting-network/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
共有 0 条评论