思科rip、dhcp、vlan

三层交换机设置:

Switch#
Switch#configure terminal
Switch(config)#ip routing
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#exit
Switch(config)#interface vlan 10
Switch(config-if)#ip address 192.168.1.254 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface vlan 20
Switch(config-if)#ip address 192.168.2.254 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#no shutdown
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk

Switch(config-if)#exit
Switch(config)#router rip
Switch(config-router)#version 2
Switch(config-router)#no auto-summary
Switch(config-router)#network 192.168.1.0
Switch(config-router)#network 192.168.2.0
Switch(config-router)#network 192.168.4.0
Switch(config-router)#exit
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#no switchport
Switch(config-if)#ip address 192.168.4.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#ip dhcp pool vlan10
Switch(dhcp-config)#network 192.168.1.0 255.255.255.0
Switch(dhcp-config)#default-router 192.168.1.254
Switch(dhcp-config)#dns-server 202.102.128.68
Switch(dhcp-config)#exit
Switch(config)#ip dhcp pool vlan20
Switch(dhcp-config)#network 192.168.2.0 255.255.255.0
Switch(dhcp-config)#default-router 192.168.2.254
Switch(dhcp-config)#dns-server 202.102.128.68
Switch(dhcp-config)#

交换机1设置:

Switch>ena
Switch#configure terminal
Switch(config)#interface fastEthernet 0/3
Switch(config-if)#switchport mode trunk
Switch(config-if)#exit
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#exit
Switch(config)#interface f0/1
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#interface f0/2
Switch(config-if)#switchport access vlan 20
pc0自动获取vlan10的地址,pc1自动获取vlan20的地址

路由器设置:

Router>ena
Router#configure t
Router(config)#interface fastEthernet 0/0
Router(config-if)#ip address 192.168.4.2 255.255.255.0
Router(config-if)#no shutdown

Router(config-if)#exit

Router(config)#interface fastEthernet 0/1
Router(config-if)#ip address 192.168.3.254 255.255.255.0
Router(config-if)#no shutdown

Router(config-if)#exit
Router(config)#router rip
Router(config-router)#version 2
Router(config-router)#no auto-summary
Router(config-router)#network 192.168.3.0
Router(config-router)#network 192.168.4.0
Router(config-router)#end
Router#configure terminal 
Router(config)#ip dhcp pool vlan30
Router(dhcp-config)#network 192.168.3.0 255.255.255.0
Router(dhcp-config)#default-router 192.168.3.254
Router(dhcp-config)#dns-server 202.102.128.68
pc2自动获取vlan30ip地址。

你可能感兴趣的:(VLAN,思科rip)