cisco 路由器或三层交换机上均可配置
下面是思科三层交换机(35系列)的详细配置
SW1 配置
sW1(config)#do sh run
Building configuration...
Current configuration : 1429 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname sW1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 172.18.254.20 255.255.255.0
!
interface FastEthernet0/0
no switchport
ip address 192.168.1.2 255.255.255.0
!
interface FastEthernet0/1
no switchport
ip address 172.18.252.1 255.255.255.252
!
interface FastEthernet0/2
no switchport
no ip address
shutdown
!
interface FastEthernet0/3
no switchport
ip address 172.18.252.5 255.255.255.252
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface Vlan1
no ip address
!
router ospf 7
router-id 172.18.254.20
log-adjacency-changes
network 172.18.252.0 0.0.0.3 area 0
network 172.18.252.4 0.0.0.3 area 0
network 172.18.254.0 0.0.0.255 area 0
default-information originate
!
ip http server
ip route 0.0.0.0 0.0.0.0 192.168.1.1
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
!
end
SW2 配置
SW2#sh run
Building configuration...
Current configuration : 1739 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname SW2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 172.18.254.30 255.255.255.0
!
interface FastEthernet0/0
!
interface FastEthernet0/1
no switchport
ip address 172.18.252.2 255.255.255.252
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
switchport mode trunk
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface Vlan1
no ip address
!
interface Vlan110
ip address 172.18.110.254 255.255.255.0
!
interface Vlan111
ip address 172.18.111.254 255.255.255.0
!
interface Vlan112
ip address 172.18.112.254 255.255.255.0
!
interface Vlan113
ip address 172.18.113.254 255.255.255.0
!
interface Vlan114
ip address 172.18.114.254 255.255.255.0
!
interface Vlan115
ip address 172.18.115.254 255.255.255.0
!
router ospf 7
router-id 172.18.254.30
log-adjacency-changes
network 172.18.110.0 0.0.0.255 area 1
network 172.18.111.0 0.0.0.255 area 1
network 172.18.112.0 0.0.0.255 area 1
network 172.18.113.0 0.0.0.255 area 1
network 172.18.114.0 0.0.0.255 area 1
network 172.18.115.0 0.0.0.255 area 1
network 172.18.252.0 0.0.0.3 area 0
network 172.18.254.0 0.0.0.255 area 0
!
ip http server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
login
!
!
end
SW3 配置
sw3#sh run
Building configuration...
Current configuration : 1385 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname sw3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 172.18.254.40 255.255.255.0
!
interface FastEthernet0/0
!
interface FastEthernet0/1
no switchport
ip address 172.18.252.6 255.255.255.252
!
interface FastEthernet0/2
!
interface FastEthernet0/3
switchport access vlan 120
!
interface FastEthernet0/4
switchport access vlan 121
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface Vlan1
no ip address
!
interface Vlan120
ip address 172.18.120.254 255.255.255.0
!
interface Vlan121
ip address 172.18.121.254 255.255.255.0
!
router ospf 7
router-id 172.18.254.40
log-adjacency-changes
network 172.18.120.0 0.0.0.255 area 2
network 172.18.121.0 0.0.0.255 area 2
network 172.18.252.4 0.0.0.3 area 0
network 172.18.254.0 0.0.0.255 area 0
!
ip http server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
!
!
end
参考资料:http://hi.baidu.com/zhentao_cn/blog/item/b96ca40a3d2aad1195ca6baf.html