一OSPF路由协议(单区域)
 
                        OSPF单区域拓扑图 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1、 路由器上的配置

hostname "rr"

!

ip firewall

!

interface eth 0/1

  ip address  30.1.1.1  255.255.255.0 

  no shutdown

!

interface eth 0/2

  ip address  10.1.1.1  255.255.255.0 

  no shutdown

!

router ospf

  network 10.1.1.0 0.0.0.255 area 0.0.0.0

  network 30.1.1.0 0.0.0.255 area 0.0.0.0

2、 SW1上的配置

hostname "sw1" 

ip routing 

snmp-server community "public" Unrestricted 

vlan 1 

   name "DEFAULT_VLAN" 

   untagged 1-2,4,6-24 

   ip address dhcp-bootp 

   no untagged 3,5 

   exit 

vlan 10 

   name "VLAN10" 

   untagged 3 

   ip address 10.1.1.2 255.255.255.0 

   exit 

vlan 20 

   name "VLAN20" 

   ip address 20.1.1.1 255.255.255.0 

   tagged 5 

   exit 

ip router-id 10.1.1.2      (自动生成)

router ospf

   area backbone

   exit

vlan 10

   ip ospf area backbone

   exit

vlan 20

   ip ospf area backbone

   exit

3、 SW2上的配置

hostname "sw2" 

ip routing 

snmp-server community "public" Unrestricted 

vlan 1 

   name "DEFAULT_VLAN" 

   untagged 1-18,20-24 

   ip address dhcp-bootp 

   no untagged 19 

   exit 

vlan 20 

   name "VLAN20" 

   ip address 20.1.1.2 255.255.255.0 

   tagged 5 

   exit 

vlan 40 

   name "VLAN40" 

   untagged 19 

   ip address 40.1.1.1 255.255.255.0 

   exit 

ip router-id 20.1.1.2

router ospf

   area backbone

   exit

vlan 20

   ip ospf area backbone

   exit

vlan 40

   ip ospf area backbone

   exit