任务需求是达成全网互通
首先我们先进行配置pc机的ip的地址,子网掩码,和网关
pc0的配置
pc1的配置
接下来我们进行交换机中的配置
en(特权模式)
config(全局配置模式)
vlan 10 #创建vlan10
exit退出
vlan 20 #创建vlan20
exit
int f0/2
switchport access vlan 10 #将端口0/2添加到vlan 10 中
exit
int f0/1
switchport access vlan 20 #将端口f0/3添加到vlan 20 中
exit
int 0/1
switchport mode trunk #将f0/1设置为trunk接口
接下来我们进行路由器中的配置
en
config
int f0/0
no shutdown #开启端口
exit
int f0/0.1 #开启一个虚拟的子接口
encap dot1q 10 #把vlan 10 规划到这个子接口中
ip add 192.168.2.254 255.255.255.0 #路由器只能写网关地址
end #退出全部
en
config
int f0/0.2
encap dot1q 20
ip add 192.168.1.254 255.255.255.0
exit
最后进行ping测试
发现ping测试成功(ps:有些时候不通可能是因为导致线属于黄色状态多等一会就好)
#本人第一次做yp有很多不足地方望各位师傅手下多多指教。
#本人会不定时发布思科各种题配置思路