OpenWRT with OpenvSwitch 刷路由器教程

wiki: https://wiki.openwrt.org/doc/howto/buildroot.exigence

编译环境 ubuntu12.04

1.安装依赖

升级组件包 sudo apt-get update

安装编译需要的组件 sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf

gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term zlib1g-dev subversion git

gawk asciidoc libz-dev

sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term zlib1g-dev subversion git-core gawk asciidoc libz-dev

2.获取 Openwrt 源码并添加 OVS

获取 openwrt 源码

trunk (main development tree)
  • Main repository
    git clone git://git.openwrt.org/openwrt.git
  • Packages feed
    git clone git://git.openwrt.org/packages.git
12.09 branch (Attitude Adjustment)
  • Main repository
    git clone git://git.openwrt.org/12.09/openwrt.git
  • Packages feed
    git clone git://git.openwrt.org/12.09/packages.git

进入代码目录 cd openwrt/

更新最新代码 ./scripts/feeds update –a

安装最新组件 ./scripts/feeds install –a

更新版本号

svn up

添加 openwrt 代码连接 echo 'src-git openvswitch git://github.com/pichuang/openvwrt.git' >>feeds.conf

更新 ./scripts/feeds update openvswitch

安装 ./scripts/feeds install -a -p openvswitch

添加一个 patch

wget https://gist.githubusercontent.com/pichuang/7372af6d5d3bd1db5a88/raw/4e2290e3e184288de7623c02f63fb57c536e035a/openwrt-add-libatomic.patch -q -O - | patch -p1


注:

Luci feed

Note: The location of the Luci feed has not been corrected in feeds.conf.default after the move to Github, so you need to manually edit feeds.conf.default to pull Luci from Github:

src-git luci https://github.com/openwrt/luci.git;luci-0.11

3.编译固件

make defconfig //测试编译环境

选择编译组件 make menuconfig

1.选择 CPU 型号

Target System—–Atheros AR71xx/AR7240/AR913x/AR934x

2.选择路由型号

Target Profile—-TP-LINK TL-MR1043ND/选择自己的路由器型号

WNDR3800:

  TargetSystem–>AtherosAR9XXX //主芯片,cpu型号

  TargetProfile–>NETGEARWNDR3800 //路由器型号

   选择Toolchain

WRT1200AC:



3.添加 luci

LuCI—>Collections—– <*> luci

4.添加 luci 的中文语言包

LuCI—>Translations—- <*> luci-i18n-chinese

5.添加 DDNS

LuCI—>Applications —> <*>luci-app-ddns.

6.添加 UTF8 编码

Kernel modules —> Native Language Support —> <*> kmod-nls-utf8

7.添加复位键支持

Utilities —> <*> restorefactory ///trunk 默认是不带的。

8.添加 openvswitch

Network -> openvswitch-switch, openvswitch-switch, openvswitch-ipsec

(Optional)

9.其他 Advanced configuration options (for developers) -> Toolchain Options ->

Binutils Version -> Linaro binutils 2.24(SELECT)

Advanced configuration options (for developers) -> Target Options -> Build

packages with MIPS16 instructions(UNSELECT)

10. save

echo '# CONFIG_KERNEL_BRIDGE is not set' >> .config (每次 menuconfig 后都要执行)

编译 make V=99 (要联网)

编译前按照下面网页修改配置源码 支持 TL-WR1043ND- V2

https://dev.openwrt.org/changeset/38958/trunk


4.刷机

1.编译完成后会在 bin/目录下出现几个.bin 文件,其中*factory.bin 是从原厂刷到

OpenWRT 的固件,如果是从 OpenWRT 升级,则用*sysupgrade.bin。

2.登录路由器的管理界面 192.168.0(1).1,就像普通升级固件一样刷入.bin 文件就

可以了。刷成功以后没有 luci,一般也用不到界面,那就只能用 telnet 登录路由了。登

录后设置登录密码。此后 telnet 服务会自动关闭,莫慌,再次登录用 ssh 就可以了。

3.此外,大多刷完以后默认是无线功能不开启的。此时需要修改

/etc/config/wireless 文件,其中有个 wireless disable 1,将 1 改为 0 后 reboot。再

起来后就 OK 了。

4.如果刷完机发现,有线无线都连不上了。恭喜你,成砖了,莫慌,TTL 线搞起吧。

不过为了避免 TTL,大家看看有没有在编译时候加上 restorefactory 包的方法吧。我有

TLL,所以没找加这个功能的办法。


5 启动 openvswitch

/etc/init.d/openvswitch start


6 openvswitch 中 bridge 配置

配置网桥端口和协议,和连接控制器啥的,就参见 OVS 的操作吧。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值