OSPF动态路由协议
拓扑图
配置pc的IP,子网掩码和网关
Pc1 IP 192.168.1.1 子网掩码 255.255.255.252 网关 192.168.1.2
Pc2 IP 192.168.5.2 子网掩码 255.255.255.252 网关 192.168.5.1
Pc3 IP 192.168.7.2 子网掩码 255.255.255.252 网关 192.168.7.1
配置接口地址
R1 int g0/0/0 192.168.1.2 30 int g0/0/2 192.168.2.1 30
R2 int g0/0/2 192.168.2.2 30 int g0/0/1 192.168.3.1 30 int g0/0/0 192.168.6.1 30
R3 int g0/0/1 192.168.3.2 30 int g0/0/0 192.168.4.1 30
R4 int g0/0/0 192.168.4.2 30 int g0/0/1 192.168.5.1 30
R5 int g0/0/0 192.168.6.2 30 int g0/0/1 192.168.7.1 30
配置ospf协议
R1 ospf router-id 1.1.1.1
Area 0
Network 192.168.1.2 0.0.0.0
Ntework 192.168.2.1 0.0.0.0
R2 ospf router-id 2.2.2.2
Area 0
Network 192.168.2.2 0.0.0.0
Network 192.168.3.1 0.0.0.0
Area 2
Ntework 192.168.6.1 0.0.0.0
R3 ospf router-id 3.3.3.3.
Area 0
Network 192.168.3.2 0.0.0.0
Area 1
Ntework 192.168.4.1 0.0.0.0
R4 ospf router-id 4.4.4.4
Area 1
Network 192.168.4.2 0.0.0.0
Ntework 192.168.5.1 0.0.0.0
R5 ospf router-id 5.5.5.5
Area 2
Network 192.168.6.2 0.0.0.0
Ntework 192.168.7.1 0.0.0.0
测试网络
这样pc1 能ping得通pc2 和pc3 就可以了。
Vlan三层交换
拓扑图
创建VLAN
sys
vlan batch 10 20
配置接口加入vlan
int e0/0/1
post link-type access
port default vlan 10
int e0/0/2
post link-type access
port default vlan 10
int e0/0/3
post link-type access
port default vlan 20
int e0/0/4
post link-type access
port default vlan 20
vlan间通过vlanlf进行通信
interface vlanif 10
ip address 192.168.1.254 255.255.255.0
interface vlanif 20
ip address 192.168.2.254 255.255.255.0
Pc1 ping 通pc4
Vlan配置
拓扑图
交换机1
vlan batch 10 20
interface Ethernet0/0/1
port link-type access
port default vlan 10
q
interface Ethernet0/0/2
port link-type access
port default vlan 20
q
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
交换机2
vlan batch 10 20
interface Ethernet0/0/1
port link-type access
port default vlan 10
q
interface Ethernet0/0/2
port link-type access
port default vlan 20
q
Pc1 ping 通 pc3