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:~#
上一篇 VMware安装OpenWrt-18.06.2虚拟机
下一篇 OpenWrt软件包管理及LUCI汉化
目录
文章列表
1 PHP删除数组中某元素
PHP删除数组中某元素
2
通过 Kuboard 部署 busybox
通过 Kuboard 部署 busybox
3
MathJax基础之矩阵
MathJax基础之矩阵
4
微服务网关 Spring Cloud Gateway 进阶
微服务网关 Spring Cloud Gateway 进阶
5
MySQL 事务
MySQL 事务
最新评论
一位WordPress评论者
一位WordPress评论者
2月12日
您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar。