拓扑图:
命令:
R0:
int f 0/1
no shutdown
ip add 172.16.1.2 255.255.255.252
int f0/0
no shutdown
ip add 221.186.32.2 255.255.255.252
ex
router ospf 1
network 172.16.1.0 0.0.0.3 area 0
network 221.186.32.0 0.0.0.3 area 1
R1:
int f 0/1
no shutdown
ip add 172.16.1.1 255.255.255.252
int f 0/0
no shutdown
int f/0.1
encapsulation dot1Q 10
ip add 192.168.10.1 255.255.255.0
int f/0.2
encapsulation dot1Q 20
ip add 192.168.20.1 255.255.255.0
int f0/0.3
encapsulation dot1Q 255
ip add 192.168.255.1 255.255.255.0
ex
router ospf 1
network 192.168.0.0 0.0.255.255 area 0
network 172.16.1.0 0.0.0.3 area 0
R2:
int f 0/0
no shutdown
ip add 221.186.32.1 255.255.255.252
int f 0/1
no shutdown
ip add 172.16.2.1 255.255.255.0
ex
router ospf 1
network 221.186.32.0 0.0.0.3 area 1
network 172.16.2.0 0.0.0.255 area 1
sw1:
vlan 10
vlan 20
vlan 255
ex
int f 0/24
switchport mode trunk
switchport trunk allowed vlan 10,20,255
int f 0/1
switchport mode access
switchport access vlan 10
int f 0/11
switchport mode access
switchport access vlan 20
int f 0/21
switchport mode access
switchport access vlan 255
终端IP地址配置: