NFV之OpenWRT IN OpenStack的实践

1.OpenWRT网络配置完成

NFV之OpenWRT IN OpenStack的实践_第1张图片

文档上有一行小字:
wan is a unique logical interface name //只要把wan替换成wan2就可以了
OpenWRT的网络配置链接如下:
http://wiki.openwrt.org/doc/uci/network

2.确保route -n 的默认网关正确。Ping8.8.8.8成功

3.通过编辑/etc/resolv.conf文件,往里边添加内容
nameserver 202.96.128.86
nameserver 202.96.128.166
nameserver 8.8.8.8
nameserver 8.8.4.4
然后保存退出,前面的是当地DNS,后面的是谷歌公开的DNS。如下图所示

NFV之OpenWRT IN OpenStack的实践_第2张图片

4.更新软件源
root@myOpenWrt:/usr/sbin# opkg update
5.安装quagga主程序
root@myOpenWrt:/usr/sbin# opkg install quagga
6.选择安装quagga常用模块
其中还有watchdog和vtysh两个模块是辅助模块,一般都需要选上。
root@myOpenWrt:/usr/sbin# opkg install quagga-zebra quagga-ripd quagga-ospfd quagga-watchquagga quagga-vtysh

7.完成以上安装过程后,会新产生/etc/quagga目录,其中quagga的配置文件都在其中。

8.启动quagga
root@myOpenWrt:/etc/quagga# /etc/init.d/quagga start
quagga.init: Starting zebra … done.
quagga.init: Starting ripd … done.
quagga.init: Starting watchquagga … done.
可以参看运行后的网路监听端口,分别默认是2601(zebra)和2602(ripd)
root@myOpenWrt:/etc/quagga# netstat -anp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:2601 0.0.0.0:* LISTEN 3131/zebra
tcp 0 0 0.0.0.0:2602 0.0.0.0:* LISTEN 3137/ripd

9.登录管理台进行设置
myOpenWrt>
输入/etc/quagga/ripd.conf第一行设置的密码后就进入到ripd的管理控制台,至此,一台强大的真正的rip路由器就呈现在你面前啦。
简答输入几个命令看看,至此超多命令呢,而且都是和Cisco路由器的命令基本一直,想学CCIE的筒子们有福气啦。

  1. 支持RIP路由协议
    (1)配置之前,先看看我的Openwrt网卡设置,基本可以看到我的Openwrt网络拓扑:
    通过RIP协议实现的主要目标是这三个网段可以互访,最关键是不需要设置静态路由。
    root@myOpenWrt:/etc/quagga# ifconfig
    br-lan Link encap:Ethernet HWaddr 00:90:4C:C0:04:51
    inet addr:10.10.7.1 Bcast:10.10.7.255 Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:43 errors:0 dropped:0 overruns:0 frame:0
    TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:10988 (10.7 KiB) TX bytes:10384 (10.1 KiB)

br-wan Link encap:Ethernet HWaddr 00:90:4C:C0:04:51
inet addr:10.10.8.30 Bcast:10.10.8.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:66125 errors:0 dropped:6060 overruns:0 frame:0
TX packets:40913 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8414640 (8.0 MiB) TX bytes:4575110 (4.3 MiB)

eth0 Link encap:Ethernet HWaddr 00:90:4C:C0:04:51
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:273997 errors:0 dropped:0 overruns:0 frame:0
TX packets:44407 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:82347347 (78.5 MiB) TX bytes:5276107 (5.0 MiB)
Interrupt:4

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:940 errors:0 dropped:0 overruns:0 frame:0
TX packets:940 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:125091 (122.1 KiB) TX bytes:125091 (122.1 KiB)

tap0 Link encap:Ethernet HWaddr D2:34:15:87:F5:38
inet addr:10.10.6.10 Bcast:10.10.6.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1846 errors:0 dropped:289 overruns:0 frame:0
TX packets:792 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100

(2)配置命令
myOpenWrt> en
myOpenWrt> enable –进入管理权限
myOpenWrt# config
myOpenWrt# configure ter
myOpenWrt# configure terminal –进入终端设置模式
myOpenWrt(config)# route
route-map router
myOpenWrt(config)# router
rip zebra
myOpenWrt(config)# router rip –指定路由为rip
myOpenWrt(config-router)# ver
myOpenWrt(config-router)# version 2 –指定版本为rip v2
myOpenWrt(config-router)# network br-wan –配置openwrt的网卡1(重要的命令,将你需要互相访问的网卡都逐个设置
myOpenWrt(config-router)# network br-lan –配置openwrt的网卡2
myOpenWrt(config-router)# network tap0 –配置openwrt的网卡3
myOpenWrt(config-router)# exit —回到上一层
myOpenWrt(config)# in
myOpenWrt(config)# interface tap0 —指定需要配置的网卡 我的机器需要配置的是tap0
myOpenWrt(config-if)# ip rip authentication mode md5 —–认证模式为md5
myOpenWrt(config-if)# ip rip authen
myOpenWrt(config-if)# ip rip authentication str
myOpenWrt(config-if)# ip rip authentication string abc –认证字符串为abc
myOpenWrt(config-if)# exit —回到上一层
myOpenWrt(config)# exit —回到上一层
myOpenWrt# write —-!!!将上述配置写入配置文件,重启后一样生效。
Configuration saved to /etc/quagga/ripd.conf
myOpenWrt#
配置后生成的配置文件内容
root@myOpenWrt:/etc/quagga# cat ripd.conf
!
! Zebra configuration saved from vty
! 2013/06/29 22:04:51
!
password zebra
!
interface tap0
ip rip authentication mode md5 auth-length old-ripd
ip rip authentication string abc
!
router rip
version 2
network br-wan
network br-lan
network tap0
!
line vty
!
RIP协议由于没有hello包,比较不直观。但还是可以看到ripd服务已经起来了:
——
NFV之OpenWRT IN OpenStack的实践_第3张图片

11.ospf配置

Configure eth0 parameters:
site-A-RTR# configure terminal
site-A-RTR(config)# interface eth0
site-A-RTR(config-if)# ip address 10.10.10.1/30
site-A-RTR(config-if)# description to-site-B
site-A-RTR(config-if)# no shutdown
Go ahead and configure eth1 parameters:
site-A-RTR(config)# interface eth1
site-A-RTR(config-if)# ip address 192.168.1.1/24
site-A-RTR(config-if)# description to-site-A-LAN
site-A-RTR(config-if)# no shutdown
Now verify configuration:
site-A-RTR(config-if)# do show interface
site-A-RTR(config-if)# do show interface description
Interface Status Protocol Description
eth0 up unknown to-site-B
eth1 up unknown to-site-A-LAN
Save configuration permanently, and quit interface configuration mode.
site-A-RTR(config-if)# do write
site-A-RTR(config-if)# exit
site-A-RTR(config)# exit
site-A-RTR#
Quit vtysh shell to come back to Linux shell.
site-A-RTR# exit
Next, enable IP forwarding so that traffic can be forwarded between eth0 and eth1 interfaces.

Phase 2: Configuring OSPF

Now launch vtysh shell to continue with OSPF configuration:

vtysh

Enter router configuration mode:
site-A-RTR# configure terminal
site-A-RTR(config)# router ospf
Optionally, set the router-id manually:
site-A-RTR(config-router)# router-id 10.10.10.1
Add the networks that will participate in OSPF:
site-A-RTR(config-router)# network 10.10.10.0/30 area 0
site-A-RTR(config-router)# network 192.168.1.0/24 area 0
Save configuration permanently:
site-A-RTR(config-router)# do write
Repeat the similar OSPF configuration on site-B as well:
site-B-RTR(config-router)# network 10.10.10.0/30 area 0
site-B-RTR(config-router)# network 172.16.1.0/24 area 0
site-B-RTR(config-router)# do write

在openstack的Linux bridge qbr上可以监测到hello包:

NFV之OpenWRT IN OpenStack的实践_第4张图片

这个OpenWRT 的优势还是很明显的,大小10多M,只有VyOS的1/20,命令比VyOS更加接近Cisco路由器的命令。

你可能感兴趣的:(网络,openstack,openwrt,NFV)