1. 实验示意图
2. 要求
- SW1,R1之间运行静态路由,R1,R2之间运行OSPF,R2,SW2之间运行静态路由,PC1和PC2之间互通。
3. 当前配置
3.1 PC1、PC2配置
- 配置PC1和PC2的ip地址、子网掩码和网关(在模拟器中,右键PC图标,选择“启动”,然后右键PC图标,选择“配置”)
3.2 SW1配置(Cisco)
sys
hostname SW1
interface Vlan2
ip address 10.208.4.1 255.255.255.192
interface Vlan100
ip address 10.208.1.2 255.255.255.252
interface GigabitEthernet1/0/4
switchport mode access
switchport access vlan 100
interface GigabitEthernet1/0/8
switchport mode access
switchport access vlan 2
ip route 10.213.1.0 255.255.255.0 10.208.1.1
line vty 0 4
password cisco
login
3.3 R1配置(Cisco)
enable
hostname R1
card type e1 0 0
controller E1 0/0/1
channel-group 0 unframed
interface Serial0/0/1:0
ip address 10.208.1.5 255.255.255.252
encapsulation ppp
interface GigabitEthernet0/0
ip address 10.208.1.1 255.255.255.252
router ospf 1
redistribute static subnets
redistribute connected subnets
network 10.208.1.4 0.0.0.3 area 0
ip route 10.208.4.0 255.255.255.0 10.208.1.2
3.4 R2配置(Huawei)
sys
sysname R2
interface Serial4/0/0
link-protocol ppp
ip address 10.208.1.6 255.255.255.252
fe1 unframed
interface GigabitEthernet0/0/1
ip address 10.208.1.9 255.255.255.252
ospf 1
import-route static
import-route direct
area 0.0.0.0
network 10.208.1.4 0.0.0.3
ip route-static 10.213.1.0 255.255.255.192 10.208.1.10
3.5 SW2配置(Cisco)
enable
hostname SW2
interface Vlan-interface2
ip address 10.213.1.1 255.255.255.192
interface Vlan-interface100
ip address 10.208.1.10 255.255.255.252
interface Ethernet0/4
switchport access vlan 100
interface Ethernet0/8
switchport access vlan 2
ip route 10.208.4.0 255.255.255.0 10.208.1.9
4. 遇到的问题和解决方案
- 问题:在未连接PC1和PC2时,从SW1无法ping通10.213.1.1,可能因为未接PC,vlan2没起来
- 解决方案:可使用ping –a 10.208.4.1 10.213.1.1,要求用10.208.4.1来ping10.213.1.1