之前一直打算寫博客,總是沒有開好頭,最近總算有了一個方向,於是決定把以前有的資料整理一下,一是形成習慣,二是做個備份。此次更新是第一次更新,內容包括計算機網絡管理的基礎內容。
交換機路由器配置,通過配置實現兩邊路由器到pc連通,同時,通過配置靜態路由實現左邊與右邊區域互相通信。網絡拓撲圖如下:
pc0、pc2屬於vlan1,pc1、pc3屬於vlan2,首先通過基礎配置,實現同一vlan間相互通信,再在三層交換機配置ip routing,實現vlan1和vlan2通信,再在三層交換機和路由器上配置路由表(ospf、rip、靜態路由其中一種),實現pc到路由器的通信,右邊區域同理,最後在R0和R1上配置靜態路由,實現兩個區域的通信。
代碼:
##基礎配置
#ms0
en conf t vlan 10 vlan 20 int vlan 10 ip add 192.168.10.1 255.255.255.0 int vlan 20 ip add 192.168.20.1 255.255.255.0 exit vtp mode server vtp domain abin vtp password 123 int f0/1 switchport trunk encapsulation dot1q swi mo tr int f0/2 switchport trunk encapsulation dot1q swi mo tr exit ip routing int f0/3 no switchport ip add 172.168.10.1 255.255.255.0 no shut exit router ospf 1 network 192.168.10.0 0.0.0.255 area 1 network 192.168.20.0 0.0.0.255 area 1 network 172.168.10.0 0.0.0.255 area 1 exit ip route 0.0.0.0 0.0.0.0 172.168.10.2
#s0
en conf t vtp mode client vtp domain abin vtp password 123 int f0/1 sw mo ac sw ac v 10 int f0/2 sw mo ac sw ac v 20 int f0/3 sw mo tr
#s1
en conf t vtp mode client vtp domain abin vtp password 123 int f0/1 sw mo ac sw ac v 10 int f0/2 sw mo ac sw ac v 20 int f0/3 sw mo tr
#r0
en conf t int f0/0 ip add 172.168.10.2 255.255.255.0 no shut int s0/0/0 ip add 10.1.1.1 255.255.255.0 no shut exit router ospf 1 network 172.168.10.0 0.0.0.255 area 1 exit ip route 0.0.0.0 0.0.0.0 10.1.1.2
#ms1
en conf t vlan 30 vlan 40 int vlan 30 ip add 192.168.30.1 255.255.255.0 int vlan 40 ip add 192.168.40.1 255.255.255.0 exit vtp mode server vtp domain abin vtp password 123 int f0/1 switchport trunk encapsulation dot1q swi mo tr int f0/2 switchport trunk encapsulation dot1q swi mo tr exit ip routing int f0/3 no switchport ip add 172.168.20.1 255.255.255.0 no shut exit router ospf 1 network 192.168.30.0 0.0.0.255 area 1 network 192.168.40.0 0.0.0.255 area 1 network 172.168.20.0 0.0.0.255 area 1 exit ip route 0.0.0.0 0.0.0.0 172.168.20.2
#s2
en conf t vtp mode client vtp domain abin vtp password 123 int f0/1 sw mo ac sw ac v 30 int f0/2 sw mo ac sw ac v 40 int f0/3 sw mo tr
#s3
en conf t vtp mode client vtp domain abin vtp password 123 int f0/1 sw mo ac sw ac v 30 int f0/2 sw mo ac sw ac v 40 int f0/3 sw mo tr
#r1
en conf t int f0/0 ip add 172.168.20.2 255.255.255.0 no shut int s0/0/0 ip add 10.1.1.2 255.255.255.0 no shut exit router ospf 1 network 172.168.20.0 0.0.0.255 area 1 exit ip route 0.0.0.0 0.0.0.0 10.1.1.1
結果檢測:
使用ping命令通過pc0向pc6發送icmp數據包: