1.網絡拓撲圖,交換機只充當轉發功能
在電腦上指定ip 網關,eg:20.1.1.1 255.255.255.0 20.1.1.254
在路由器Route 0配置
--- System Configuration Dialog ---
Continue with configuration dialog? [yes/no]: no
% Please answer 'yes' or 'no'.
Continue with configuration dialog? [yes/no]: n
Press RETURN to get started!
Router>en
Router#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostn
Router(config)#hostname wyq
wyq(config)#int f0/0
wyq(config-if)#ip add 10.1.1.254 255.255.255.0
wyq(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
wyq(config-if)#exit
wyq(config)#int f0/1
wyq(config-if)#ip add 20.1.1.254 255.255.255.0
wyq(config-if)#no sh
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
#可以觀察到燈是綠的,證明已經配置成功!
#全網互通,可以相互通信
#
#路由器配置
wyq(config-if)#exit
wyq(config)#config
% Incomplete command.
wyq(config)#username oldxu password 123456
wyq(config)#line vty 0 4
wyq(config-line)#login local
測試10.1.1.1
#現在呢,交換機2950-24很嘚瑟,他說我也要被控制,咋辦?
#打開交換機進行配置(左邊第一台交換機)
Switch>en
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#username oldxu password 123456
Switch(config)#line vty 0 4
Switch(config-line)#login local
Switch(config-line)#exit
Switch(config)#int f0/1
Switch(config)#int vlan 1
Switch(config-if)#ip add 10.1.1.253 255.255.255.0
Switch(config-if)#no shut
#在pc端ping 10.1.1.253,測試可以ping 通
PC>ping 10.1.1.253
Pinging 10.1.1.253 with 32 bytes of data:
Reply from 10.1.1.253: bytes=32 time=30ms TTL=255
Reply from 10.1.1.253: bytes=32 time=20ms TTL=255
Ping statistics for 10.1.1.253:
Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 20ms, Maximum = 30ms, Average = 25ms
Control-C
^C
PC>telnet 10.1.1.253
Trying 10.1.1.253 ...Open
User Access Verification
Username: oldxu
Password:
Switch>
#第二台交換機同理
#打開交換機進行配置(右邊那台交換機)
Switch>en
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int vlan 1
Switch(config-if)#hostname sw2
sw2(config)#int vlan 1
sw2(config-if)#ip add 20.1.1.253 255.255.255.0
sw2(config-if)#no shut
%LINK-5-CHANGED: Interface Vlan1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
sw2(config-if)#exit
sw2(config)#line vty 0 4
sw2(config-line)#login local
sw2(config-line)#exit
sw2(config)#username oldxu password 123456
sw2(config)#
#使用20.1.1.1進行測試,證明配置成功了
PC>ping 20.1.1.254
Pinging 20.1.1.254 with 32 bytes of data:
Reply from 20.1.1.254: bytes=32 time=13ms TTL=255
Reply from 20.1.1.254: bytes=32 time=12ms TTL=255
PC>telnet 20.1.1.253
Trying 20.1.1.253 ...Open
User Access Verification
Username: oldxu
Password:
sw2>
#但是10.1.1.1這台pc是連不上右邊這台交換機的,那么應該怎么做才可以被管理呢?
給交換機配網關,希望這個交換機可以被跨網段管理
#在右邊交換機sw2上面配置網關,進入全局模式
sw2(config)#ip default-gateway 20.1.1.254
#現在10.1.1.1可以管理sw2了,oldxu是不是很開心???