路由器配置命令

  • 格式:doc
  • 大小:113.00 KB
  • 文档页数:4

路由器的配置模式

 用户模式:Router>

 特权模式:Router#

 全局配置模式:Router(config)#

 接口配置模式:Router(config-if)#

 子接口配置模式: Router(config)#interface fa0/0.1

Router(config-subif)#

 Line模式:Router(config-line)#

 路由模式:Router(config-router)#

静态路由的配置

Router A>enable

Router A#config terminal

Router A(config) #interface f0/0

Router A(config-if) #ip address 192.168.2.2 255.255.255.0

Router A(config-if)#no shutdown

Router A(config-if)#exit

Router A(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1

默认路由的配置

Router B>enable

Router B#config terminal

Router B(config) #interface f0/1

Router B(config-if) #ip address 192.168.2.1 255.255.255.0

Router B(config-if)#no shutdown

Router B(config-if)#exit

Router B(config) #interface f0/0

Router B(config-if) #ip address 192.168.1.1 255.255.255.0

Router B(config-if)#no shutdown

Router B(config-if)#exit

Router B(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.2

查看路由表

RouterA#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2

i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

ia - IS-IS inter area, * - candidate default, U - per-user static route

o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

S 192.168.1.0/24 [1/0] via 192.168.2.1

C 192.168.2.0/24 is directly connected, FastEthernet0/0

RouterA#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2

i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

ia - IS-IS inter area, * - candidate default, U - per-user static route

o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

S 192.168.1.0/24 [1/0] via 192.168.2.1

C 192.168.2.0/24 is directly connected, FastEthernet0/0

配置路由器的控制台会话

 配置控制台会话时间

teacher(config)#line console 0

teacher(config_line)#exec-timeout 0 0

 配置控制台输出日志同步

teacher(config)#line console 0

teacher(config_line)#logging synchronous

 配置禁用DNS

teacher(config)#no ip domain-lookup

路由器与交换机之间的单臂路由

Router(config)# interface f0/0.1

Router(config-subif)# encapsolution dot1q 1

Router(config-subif)# ip address 192.168.1.1 255.255.255.0

Router(config)# interface f0/0.2

Router(config-subif)# encapsolution dot1q 2

Router(config-subif)# ip address 192.168.2.1 255.255.255.0