openwrt x86的安装与使用

前言

什么是openwrt?

它是一个适用于路由器的Linux发行版。和其他Linux发行版一样,它也内置了包管理工具,你可以从一个软件仓库里直接安装软件。OpenWrt可以用在所有需要嵌入式Linux的地方,它有众多功能,比如SSH服务器,VPN,流量整形服务,甚至是BitTorrent客户端。

准备工作

  1. openwrt固件下载, openwrt-x86-generic-combined-ext4.img.gz ,如果是虚拟机的话可以直接下载 openwrt-x86-generic-combined-ext4.vdi ,这里gz后缀的需要解压下。 
  2. 映像写入磁盘工具 physdiskwrite 
  3. 一台pc机,2块网卡,一块普通u盘 (因为必须要2块网卡才能实现路由器的功能,一个WAN口,一个LAN口)。

安装过程

  1. 使用physdiskwrite把openwrt img文件写入的U盘中,注意写入会导致U盘格式化。 
  2. 把U盘插入的x86电脑上,重启后,修改bios以便从U盘中启动。 如果无意外情况,openwrt就安装成功了。如下图openwrt
    注意安装最后一步,需要敲一下回车,才会进入上面的步骤,不过pc机中usb键盘会无效,必须使用ps2接口的键盘敲下回车。

配置openwrt

首先需要配置网卡使路由器(pc)能够上网,也就是linux里的network。

vim /etc/config/network

使用vim编辑network:

config interface 'loopback'  
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1' 
    option netmask '255.0.0.0'
config interface 'lan' 
    option ifname 'eth0'  
    option type 'bridge' 
    option proto 'static'  
    option ipaddr '192.168.0.111' 
    option netmask '255.255.255.0'
config interface 'wan'  
    option ifname 'eth1'  
    option type 'bridge' 
    option proto 'static'  
    option ipaddr '192.168.0.2'  
    option netmask '255.255.255.0'  
    option gateway '192.168.0.1'

配置LAN:使用第一块网卡,ip: 192.168.0.111 。

配置WAN:使用第二块网卡,使用 静态ip 方式,同时将网关设置为 192.168.0.1,这样pc路由就可以通过 192.168.0.1 这个路由来上网了。

接下来,就是安装更新软件包

opkg update  //更新包列表,这一步是必须的
opkg install luci  //安装luci,非常强大的web管理工具、
opkg install luci-i18n-chinses //安装luci中文语言包

到这里还无法使用luci管理,因为必须要设置密码才能访问!

passwd

修改完密码后,就可以用luci了。 接下来,感受强大的openwrt吧

赞 (102)

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址