Computer network lab tips

[TOC]

Static Route

其作用是有两个及以上的router连接不同类型的IPv4/IPv6时候需要配置的static route/dynamic route来连接。

Advantage

  • There is no overhead on the router CPU.

    路由器CPU上没有开销。

  • There is no bandwidth usage between routers.

    路由器之间不存在带宽占用。手动配置没有流量产出

  • It adds security because the administrator can choose to allow routing access to certain networks only.

    它增加了安全性,因为管理员可以选择只允许对某些网络进行路由访问。

Disadvantage

  • The administrator must really understand the internetwork and how each router is connected in order to configure routes correctly.

    管理员必须真正了解内联网和每个路由器的连接方式,以便正确配置路由。

  • If a network is added to the internetwork, the administrator has to add a route to it on all routers—manually.

    如果一个网络被添加到国际网络中,管理员必须在所有路由器上手动添加一个路由到它。

  • It’s not possible in large networks because maintaining it would be a full-time job in itself.

    这在大型网络中是不可能的,因为维护它本身就是一项全职工作。

Command

CLI set static route command

  • Router(config)#**ip route 172.16.20.0 255.255.255.0 172.16.10.2**

    • 172.16.20.0 = destination network //目的网络

    • 255.255.255.0 = subnet mask //子网掩码

    • 172.16.10.2 = next-hop address //下一跳的地址

    To get to the destination network of 172.16.20.0, with a subnet mask of 255.255.255.0, send all packets to 172.16.10.2

  • Router(config)#**ip route 172.16.20.0 255.255.255.0 s0/0**

    • 172.16.20.0 = destination network //目的网络

    • 255.255.255.0 = subnet mask //子网掩码

    • s0/0 = exit interface //从该接口发送数据包

    To get to the destination network of 172.16.20.0, with a subnet mask of 255.255.255.0, send all packets out interface Serial 0/0

  • 命令解释

    • ip route The command used to create the static route.(重要)

      创建静态网络

    • destination_network The network you’re placing in the routing table.

      你要放入路由表的网络

    • mask The subnet mask being used on the network.

      子网掩码

    • next-hop_address The address of the next-hop router that will receive the packet and forward it to the remote network.

      下一跳路由器的地址,它将会接受数据包并转发给远程网络

    • exit_interfaceUsed in place of the next-hop address if you want, and shows up as a directly connected route.

      可以用它代替下一跳地址,并显示直接网络的路由

    • administrative_distance By default, static routes have an administrative distance of 1 (or even 0 if you use an exit interface instead of a next-hop address).

      默认情况下,静态路由的管理距离是1,如果使用出口接口而不是下一跳地址甚至是0(重要)

    • permanent Keyword (Optional) Without the permanent keyword in a static route statement, a static route will be removed if an interface goes down. Adding the permanent keyword to a static route statement will keep the static routes in the routing table even if the interface goes down and the directly connected networks are removed.

      在静态路由语句中没有永久关键字,如果一个接口发生故障,静态路由将被删除。在静态路由语句中添加永久关键字,即使接口宕机,直接连接的网络被删除,静态路由也会保留在路由表中。

static route 显示配置,但其实更多使用命令行。

static routes 配置

  • 效果和命令行相同

  • 不能配置默认路由和出口接口路由

    Bangor(config)#ip route 0.0.0.0 0.0.0.0 s1

    Buffalo(config)#ip route 172.16.10.0 255.255.255.0 s1

  • 默认路由(Default route),是对IP数据包中的目的地址找不到存在的其他路由时,路由器所选择的路由。目的地不在路由器的路由表里的所有数据包都会使用默认路由。这条路由一般会连去另一个路由器,而这个路由器也同样处理数据包: 如果知道应该怎么路由这个数据包,则数据包会被转发到已知的路由;否则,数据包会被转发到默认路由,从而到达另一个路由器。每次转发,路由都增加了一跳的距离。

DHCP in Router

DHCP-Command

lab file

起作用是自动寻找ip地址

例子如下图

Comfigure DHCP and static route

Command

  • Router
  • R0(config)#ip dhcp pool ip_pool1

    创建 DHCP 服务器地址池的名称并进入 DHCP 池配置模式。

  • R0(dhcp-config)#domain-name itcarlow.ie

    指定客户端的域名,设置domain-name为itcarlow.ie

  • R0(dhcp-config)#dns-server 192.77.1.100

    指定可用于 DHCP 客户端的 DNS 服务器的 IP 地址。 需要一个 IP 地址,但是,您最多可以在一个命令行中指定八个 IP 地址。 服务器应按优先顺序列出。

  • R0(dhcp-config)#default-router 192.168.1.1

    指定 DHCP 客户端的默认路由器的 IP 地址。 IP 地址应与客户端位于同一子网中。

  • R0(dhcp-config)#network 192.168.1.0 255.255.255.0

    指定 DHCP 地址池的子网网络号和掩码。

  • R0(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.100

    我们可以选100以外的IP address

  • PC
  • C:\> ipconfig/release

    显示ip的配置

  • C:\> ipconfig/renew

    刷新ip设置

  • router查看dhcp情况
  • R0# show ip dhcp pool
  • show ip dhcp binding

Router# show ip route
Codes: C - connected, S - static, * - candidate default

S* 0.0.0.0/0 [1/0] via 172.1.1.1

C 172.1.1.0/30 is directly connected, Serial0

C 170.2.2.0/24 is directly connected, TokenRing0

C 192.77.203.0/24 is directly connected, Ethernet0

PPP with PAP

PPP 点对点协议,pap的作用是验证用户。

PPP with PAP configue

Command

set password

  • Carlow(config)#enable password class
  • Carlow(config)#line console 0
  • Carlow(config-line)#password class
  • Carlow(config-line)#login

enable 是特权密码

line console是用户密码

Vey password,用于telnet或ssh,ppp实验用不到

  • (config)#line vty 0 4
  • (config-line)#pasword cisco
  • (config-line)#login

secret password

  • (config-line)#enable secret cisco
  • Ppp with chap

command

  • 第一步设置static route,可根据上面来设置

  • Dublin(config)#username Carlow password cisco

  • Carlow(config)#username Dublin password cisco

  • Carlow(config)#int s0/1/0

  • Carlow(config-if)#encapsulation ppp

  • Dublin(config)#int s0/0

  • Dublin(config-if)#encapsulation ppp

  • Carlow(config)#int s0/1/0

  • Carlow(config-if)#ppp authentication pap

  • Carlow(config-if)#ppp pap sent-username Dublin pssword cisco

  • Dublin(config)#int s0/0

  • Dublin(config-if)#ppp authentication pap

  • Dublin(config-if)#ppp pap sent-username Carlow pssword cisco

  • #copy run start

Checking the options available at each stage.

Dublin(config)#int s0/0

Dublin(config-if)#ppp ?

Dublin(config-if)#ppp pap ?

Dublin(config-if)#ppp pap sent user-name xxxxx password xxxxxx

PPP with chap

Chap

command

  • Dublin(config)#username Carlow password cisco

  • Dublin(config)#int s0/0

  • Dublin(config-if)#encapsulation ppp

  • Dublin(config-if)#ppp authentication chap

  • Carlow(config)#username Dublin password cisco

  • Carlow(config)#int s0/1/0

  • Carlow(config-if)#encapsulation ppp

  • Carlow(config-if)#ppp authentication chap

RIP configure

RIP configure

Command

Loopback address

  • C206(config)#int loopback1

  • C206(config-if)#ip add 4.4.4.4 255.255.255.255

  • C206(config-if)#do write

rip configure in router

  • R1(config)#router rip

  • R1(config-router)#version 2

  • R1(config-router)#no auto-summary

  • R1(config-router)#network 192.168.12.0

  • R1(config-router)#network 192.168.13.0

  • R2(config)#router rip

  • R2(config-router)#version 2

  • R2(config-router)#no auto-summary

  • R2(config-router)#network 192.168.12.0

  • R3(config)#router rip

  • R3(config-router)#version 2

  • R3(config-router)#no auto-summary

  • R3(config-router)#network 192.168.13.0

Static route

  • R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.14.4
  • R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.12.2
  • R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.13.3

Advertise it in RIP

  • R1(config)#router rip

  • R1(config-router)#default-information originate

Let’s see what we have on R2 and R3:

  • R2#show ip route rip

via 是通过的意思

  • Use debug to observe RIP communications
  • R1#debug ip rip
  • R1#undebug all

OSPF

OSPF

disable dns look up

(config)#no ip domain-lookup

message of the day banner

(config)#banner motd E

Command

Configure the LAN network 172.16.1.16/28 to be included in the OSPF updates theat are sent out of R1

enter a process ID of 1 for the process-ID parameter

  • R1(config)#router ospf 1

area ID of 0 for the OSPF area id parameter.

  • R1(config-router)#network 172.16.1.16 0.0.0.15 area 0
  • R1(config-router)#network 192.168.10.0 0.0.0.3 area 0
  • R1(config-router)#network 192.168.10.4 0.0.0.3 area 0

other router is same witht R1

to know what is the router ID and other information

  • #show ip protocols

  • #show ip ospf

  • #show ip ospf interface

set loopback address to change the Router ID

  • (config)#interface loopback 0
  • (config-if)#ip address 10.1.1.1 255.255.255.255

other router is same with R1, R2 is 10.2.2.2 , R3 is 10.3.3.3

Verify router ID have changed

  • #show ip ospf neighbor

use therouter-id command to change the router ID on the R1 router.

  • (config)#router ospf 1
  • (config-router)#router-id 10.4.4.4
  • #clear ip ospf process and type yes

like r1 want to change router ID to 10.4.4.4 ,which will be changed.

Remove the configured Router ID with the no router-id command

  • (config)#router ospf 1
  • (config-router)#no router-id 10.4.4.4
  • #clear ip ospf process and type yes

use the show ip route command to know the cost of router

  • #show ip route 65 is the router cost from that way

use the show interfaces serial0/0/0 command on the R1 router to view the bandwidth of the serial 0/0/0 interface.

#show interface serial0/0/0

use the bandwidth command to change the bandwidth of the serial interface of the R1 and R2

  • (config)#interface serial0/0/0
  • (config-if)#bandwidth 64

the cost will be 1564 = 10^8/64000 bpa

use the show ip ospf interface to know cost

Use the ip ospf cost command to configrue the ospf cost on the R3 router.

(config)#inertface s0/0/0

(config-if)#ip ospf cost 1562

then use the show ip ospf inerface we can see the cost become 1562.

configure loopback address

(config)#interface loopback1

(config-if)#ip address 172.30.1.1 255.255.255.252

then config static route of the loopback address

(config)#ip route 0.0.0.0 0.0.0.0 loopback1

Use the default-information originate command to include static route in the ospf updatas

(config)#int ospf 1

(config-router)#default-information originate

Use theshow ip route on R2, wen can see the static route on the table by ospf updatas

Use the auto-cost reference-bandwidth command to comfigrue the reference bandwidth

(config-router)#auto-cost reference-bandwidth 10000

Use the show ip route command can see the cost become 65635

configrue the ospf hello and dead omtervals

(config)#interface serial0/0/0

(config-if)#ip ospf hello-interval 5

(config-if)#ip ospf dead-interval 20

password recovory

sh ver to see the current value of you’re configuration

Start:

I don’t know my enable password

  • turn off router, and turn it back on

  • ctrl+break on you keyboard when start !!!!!!

  • rommon1>confer 0x2142

  • rommon2> reset

  • Router#copy run start

  • Router# show run config 然后可以看一下以前密码是多少。

  • Router(config)#enable password 123 可以改密码

  • Router(config)#config-register 0x2102

  • Router#copy run start

  • Rtouter#reload

  • Copyrights © 2022-2024 Jessy Huang
  • Visitors: | Views:

请我喝杯咖啡吧~