你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux下网络路由器的构建

[日期:2007-11-14] 来源:Linux公社  作者:Linuxidc [字体:大 中 小]

端口设置顺序:

User Access Verification

Password: zebra

speedmetal> enable

Password: zebra

speedmetal# configure terminal

speedmetal(config)# interface eth0

speedmetal(config-if)# ip address 192.168.2.1/30

speedmetal(config-if)# quit

speedmetal(config)# interface eth1

speedmetal(config-if)# ip address 192.168.1.1/30

speedmetal(config-if)# quit

speedmetal(config)# interface dummy0

speedmetal(config-if)# ip address 10.0.2.1/24

speedmetal(config-if)# write

Configuration saved to /etc/zebra/zebra.conf

speedmetal(config-if)# end

speedmetal# show run

Current configuration:

!

hostname speedmetal

password zebra

enable password zebra

!

interface lo

!

interface eth0

ip address 192.168.2.1/30

!

interface dummy0

ip address 10.0.2.1/24

!

interface eth1

ip address 192.168.1.1/30

!

!

line vty

!

end

注意:我们并没有按照常规方法在ThinkPad上设置IP地址,$]!x件#提{&l而是通过Zebra来设置它们的。这些设置保存在/etc/zebra/zebra.conf文件中,因此每当Zebra服务启动时,这些设置便被激活。

zebra.conf文件的主要内容如下:

/etc/zebra/zebra.conf文件的内容

!

! Zebra configuration saved from vty

!   2003/08/20 00:07:51

!

hostname speedmetal

password zebra

enable password zebra

!

interface lo

!

interface eth0

ip address 192.168.2.1/30

!

interface dummy0

ip address 10.0.2.1/24

!

interface eth1

ip address 192.168.1.1/30

!

!

line vty

!

我们也可以使用MRLG查看各网络端口的状态,具体步骤是选择缺省状态“router1”,然后选择“show interface”按键,点击“Execute”。

利用Zebra设置RIP路由选择

由于我们已在ThinkPad路由器上设置了网络端口,接下来我们就可以对路由器进行设置使它与RIP同步工作了。Zebra使用不同的无后台交互程序支持不同的路由协议,因此我们要先建立一个简单的设置文件/etc/zebra /ripd.conf。

基本/etc/zebra/ripd.conf文件:

hostname speedmetal-rip

password zebra

enable password zebra

运行ripd 无后台交互程序:

# service ripd start

然后,我们就可以通过连入Zebra路由器的2602接口,对RIP无后台交互程序进行设置了。

RIP设置:

User Access Verification

Password: zebra

speedmetal-rip> enable

Password: zebra

speedmetal-rip# configure terminal

speedmetal-rip(config)# router rip

speedmetal-rip(config-router)# network 10.0.0.0/8

speedmetal-rip(config-router)# network 192.168.0.0/16

speedmetal-rip(config-router)# end

speedmetal-rip# show run

Current configuration:

!

hostname speedmetal-rip

password zebra

enable password zebra

!

interface lo

!

interface eth0

!

interface dummy0

!

router rip

network 0.0.0.0/0

network 192.168.0.0/16

!

line vty

!

end

speedmetal-rip# write

Configuration saved to /etc/zebra/ripd.conf

speedmetal-rip#

设置后的/etc/zebra/ripd.conf 文件为:

!

! Zebra configuration saved from vty

!   2003/08/19 13:50:30

!

hostname speedmetal-rip

password zebra

enable password zebra

!

interface lo

!

interface eth0

!

interface eth1

!

interface dummy0

!

router rip

network 10.0.0.0/8

network 192.168.0.0/16

!

line vty

!

在Cisco路由器上建立RIP路由选择

为了使两台Cisco 3620路由器的设置更加简便,我们将其命名为“A”和“B”,我们这里只对做最基本的设置以便它们可以正常工作。这些设置包括设置端口IP地址、回送地址和用于正常串口通信的串口时钟频率。

对路由器A的设置:

Router#config terminal

Router(config)#hostname RouterA

RouterA(config)#int s0/0

RouterA(config-if)#ip address 192.168.0.1 255.255.255.252

RouterA(config-if)#no shut

RouterA(config-if)# interface fastEthernet 0/0

RouterA(config-if)#ip address 192.168.2.2 255.255.255.252

RouterA(config-if)#no shut

RouterA(config-if)#int loopback 0

RouterA(config-if)#ip address 10.0.0.1 255.255.255.0

RouterA(config-if)#end

RouterA#write

用同样的方法可以对路由器B进行设置:

Router#configure terminal

Router(config)#hostname RouterB

RouterB(config)#int s0/0

RouterB(config-if)#ip address 192.168.0.2 255.255.255.252

RouterB(config-if)#no shut

RouterB(config-if)#int fastEthernet0/0

RouterB(config-if)#ip address 192.168.1.2 255.255.255.252

RouterB(config-if)#no shut

RouterB(config-if)#int loopback 0

RouterB(config-if)#ip address 10.0.1.1 255.255.255.0

RouterB(config-router)#end

RouterB#write

在3620路由器上设置RIP与Zebra中的命令十分类似。我们通过控制线连接到两台3620路由器,

sXB教04l]|TG{}:8IB

Pqtoa垠MtK6教WViP~x业[并执行下列命令。

为路由器A设置RIP:

RouterA#conf t

Enter configuration commands, one per line. End with CNTL/Z.

RouterA(config)#router rip

RouterA(config-router)#network 10.0.0.0

RouterA(config-router)#network 192.168.0.0

RouterA(config-router)#network 192.168.2.0

RouterA(config-router)#version 2

RouterA(config-router)#end

RouterA#write

为路由器B设置RIP:

RouterB#conf t

Enter configuration commands, one per line. End with CNTL/Z.

RouterB(config)#router rip

RouterB(config-router)#network 10.0.1.0

RouterB(config-router)#network 192.168.0.0

RouterB(config-router)#network 192.168.1.0

RouterB(config-router)#version 2

RouterB(config-router)#end

RouterB#write

路由器的rip命令主要负责激活RIP进程,

cAJ({"N管Ezc)N

该网络命令可以告知路由器RIP将向哪个网络蔓延。

linux
相关资讯       Linux网络路由器  Linux路由器 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款