标题: 配置路由器 [打印本页]
作者: WEI23931 时间: 2019-4-8 14:15
标题: 配置路由器
配置路由器的ip地址
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host
Router(config)#hostname R1
R1(config)#int f0/0
R1(config-if)#ip addr 1.1.0.1255.255.255.0
R1(config-if)#no shut
R1(config-if)#e
*Mar 1 00:04:15.299:%LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:04:16.299:%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed stateto upxit
R1(config)#int f0/1
R1(config-if)#ip addr 1.2.0.1255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
*Mar 1 00:04:41.843:%LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar 1 00:04:42.843:%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed stateto up
配置路由器的回环端口:
R1(config)#int lo0
R1(config-if)#ip add
*Mar 1 00:04:56.731:%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to upr100.1.0.1 255.255.255.0
R1(config-if)#exit
R1(config)#ip addr 100.1.1.1 255.255.255.0
^
% Invalid input detected at '^' marker.
R1(config)#int lo1
R1(config-if)#ip addr 100.1.1.1 255.255.255.0
*Mar 1 00:06:14.391:%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1,p addr 100.1.1.1255.255.255.0
R1(config-if)#int lo2
R1(config-if)#ip addr 100.1.1.1 255.255.255.0
*Mar 1 00:06:32.055:%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback2,p addr 100.1.2.1255.255.255.0
R1(config-if)#int lo3
R1(config-if)#ip addr 100.1.2.1 255.255.255.0
*Mar 1 00:06:54.587:%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback3,p addr 100.1.3.1255.255.255.0
R1(config-if)#exit
R1(config)#exit
R1#
*Mar 1 00:09:52.455:%SYS-5-CONFIG_I: Configured from console by console
R1#show proto
R1#show protocols
Global values:
Internet Protocol routing isenabled
FastEthernet0/0 is up, line protocol is up
Internet address is 1.1.0.1/24
FastEthernet0/1 is up, line protocol is up
Internet address is 1.2.0.1/24
Loopback0 is up, line protocol is up
Internet address is 100.1.0.1/24
Loopback1 is up, line protocol is up
Internet address is 100.1.1.1/24
Loopback2 is up, line protocol is up
Internet address is 100.1.2.1/24
Loopback3 is up, line protocol is up
Internet address is 100.1.3.1/24
R1#
配置静态路由:
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip route 101.1.0.0 255.255.255.0 1.1.0.2
R1(config)#ip route 101.1.0.0 255.255.255.0 1.2.0.25
R1(config)#ip route 101.1.2.0 255.255.255.0 1.1.0.2
R1(config)#ip route 101.1.2.0 255.255.255.0 1.2.0.25
R1(config)#ip route 101.1.1.0 255.255.255.0 1.2.0.2
R1(config)#ip route 101.1.1.0 255.255.255.0 1.1.0.25
R1(config)#ip route 101.1.3.0 255.255.255.0 1.2.0.2
R1(config)#ip route 101.1.3.0 255.255.255.0 1.1.0.25
R1(config)#exit
R1#show
*Mar 1 00:21:19.331:%SYS-5-CONFIG_I: Configured from console by consoleip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRPexternal, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA externaltype 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1,E2 - OSPF external type 2
i - IS-IS, su - IS-ISsummary, 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 - periodicdownloaded static route
Gateway of last resort is not set
1.0.0.0/24is subnetted, 2 subnets
C 1.1.0.0is directly connected, FastEthernet0/0
C 1.2.0.0is directly connected, FastEthernet0/1
100.0.0.0/24 is subnetted, 4subnets
C 100.1.1.0 is directlyconnected, Loopback1
C 100.1.0.0 is directlyconnected, Loopback0
C 100.1.3.0 is directlyconnected, Loopback3
C 100.1.2.0 is directlyconnected, Loopback2
101.0.0.0/24 is subnetted, 4subnets
S 101.1.0.0 [1/0] via 1.1.0.2
S 101.1.1.0 [1/0] via 1.2.0.2
S 101.1.2.0 [1/0] via 1.1.0.2
S 101.1.3.0 [1/0] via 1.2.0.2
关闭r1的f0/0端口:
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#shut
R1(config-if)#
*Mar 1 00:25:43.671:%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administrativelydown
*Mar 1 00:25:44.671:%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed stateto down
R1(config-if)#shut
R1(config-if)#end
R1#sh
*Mar 1 00:26:20.527:%SYS-5-CONFIG_I: Configured from console by consoleow ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRPexternal, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA externaltype 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1,E2 - OSPF external type 2
i - IS-IS, su - IS-ISsummary, 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 - periodicdownloaded static route
Gateway of last resort is not set
1.0.0.0/24is subnetted, 1 subnets
C 1.2.0.0is directly connected, FastEthernet0/1
100.0.0.0/24 is subnetted, 4subnets
C 100.1.1.0 is directlyconnected, Loopback1
C 100.1.0.0 is directlyconnected, Loopback0
C 100.1.3.0 is directlyconnected, Loopback3
C 100.1.2.0 is directlyconnected, Loopback2
101.0.0.0/24 is subnetted, 4subnets
S 101.1.0.0 [5/0] via 1.2.0.2
S 101.1.1.0 [1/0] via 1.2.0.2
S 101.1.2.0 [5/0] via 1.2.0.2
S 101.1.3.0 [1/0] via 1.2.0.2
打开r1的f0/0端口
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#no shut
R1(config-if)#
*Mar 1 00:28:45.635:%LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:28:46.635: %LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/0, changed state to up
配置动态路由:
R1(config-if)#
R1(config-if)#exit
R1(config)#no ip rout
R1(config)#no ip routing
R1(config)#ip routing
R1(config)#router rip
R1(config-router)#net
R1(config-router)#network 1.0.0.0
R1(config-router)#net
R1(config-router)#network 100.0.0.0
R1(config-router)#end
R1#sho
*Mar 1 00:32:48.867:%SYS-5-CONFIG_I: Configured from console by consolew ip rotoc
R1#show ip proto
R1#show ip protocols
Routing Protocol is "rip"
Outgoing update filter list forall interfaces is not set
Incoming update filter list forall interfaces is not set
Sending updates every 30seconds, next due in 22 seconds
Invalid after 180 seconds, holddown 180, flushed after 240
Redistributing: rip
Default version control: sendversion 1, receive any version
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 1 1 2
FastEthernet0/1 1 1 2
Loopback0 1 1 2
Loopback1 1 1 2
Loopback2 1 1 2
Loopback3 1 1 2
Automatic network summarizationis in effect
Maximum path: 4
Routing for Networks:
1.0.0.0
100.0.0.0
Routing Information Sources:
Gateway Distance Last Update
1.2.0.2 120 00:00:03
1.1.0.2 120 00:00:02
Distance: (default is 120)
R1#
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router rip
R1(config-router)#vers
R1(config-router)#version 2
R1(config-router)#no-
R1(config-router)#no-auto
R1(config-router)#no auto-
R1(config-router)#no auto-summary
R1(config-router)#
R1 con0 is now available
Press RETURN to get started.
*Mar 1 00:48:02.803:%SYS-5-CONFIG_I: Configured from console by console
欢迎光临 (http://www.51hei.com/bbs/) |
Powered by Discuz! X3.1 |