思科單臂路由配置

思科單臂路由配置
 
網絡的組建:
路由器F0/0端口與交換機的上聯端口F0/5相連,交換機的下聯端口F0/11和F0/12分別接PC1和PC2,交換機下聯口劃分爲兩個VLAN,分別是
VLAN10和VLAN20,其中PC1屬於VLAN10,PC2屬於VLAN20;
1、路由器的配置:
R1(config)#int f0/0       //進入f0/0端口;
R1(config-if)#no sh  //打開端口;
R1(config-if)#int f0/0.1  //進入f0/0子端口1;
R1(config-subif)#ip add 192.168.1.1 255.255.255.0 //配置IP地址;
R1(config-subif)#encapsulation dot1q 10   //用IEEE802.Q封裝協議封裝,指定給VLAN 10
R1(config-subif)#no sh
R1(config-subif)#int f0/0.2  //進入f0/0子端口2;
R1(config-subif)#ip add 192.168.2.1 255.255.255.0 //配置IP地址;
R1(config-subif)#encapsulation dot1q 20   //用IEEE802.Q封裝協議封裝,指定給VLAN 20
R1(config-subif)#no sh
-----------------------------------------------------------------------------------------------------------------------
2.交換機上的配置:
SW1(config)#int f1/5  //進入f1/5端口;
SW1(config-if)#switchport mode trunk  //設置幹道模式;
SW1(config-if)#switchport trunk encapsulation dot1q   //用IEEE802.Q封裝協議封裝;
SW1(config-if)#no sh
SW1(config-if)#end
SW1#vlan database  //進入vlan配置模式;
SW1(vlan)#vlan 10 name v10 //新建VLAN 10;
SW1(vlan)#vlan 20 name v20 //新建VLAN 20;
SW1#conf t
SW1(config)#int f1/11
SW1(config-if)#switchport access vlan 10  //把f1/11端口劃分給VLAN 10;
SW1(config-if)#no sh
SW1(config-if)#int f1/12
SW1(config-if)#switchport access vlan 20 //把f1/11端口劃分給VLAN 10;
SW1(config-if)#no sh
-----------------------------------------------------------------------------------------------------------------------
PC1上的配置:
PC1#if eth0 192.168.1.100 netmask 255.255.255.0  //配置IP地址;
PC1# route add default gw 192.168.1.1   //配置網關;
PC2上的配置:
PC2#if eth0 192.168.2.100 netmask 255.255.255.0  //配置IP地址;
PC2# route add default gw 192.168.2.1   //配置網關;
-----------------------------------------------------------------------------------------------------------------------
測試:
在PC1上PING PC2的IP地址,結果如下:
PC1#ping 192.168.2.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/50/56 ms
在PC2上PING PC1的IP地址,結果如下:
PC2#ping 192.168.1.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/52/72 ms
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章