思科三层交换机实现不同VLAN之间的DHCP通信

思科三层交换机实现不同VLAN之间的DHCP通信_第1张图片

 vlan10:192.168.10.0 255.255.255.0

 vlan20:192.168.20.0 255.255.255.0

 vlan30:192.168.30.0 255.255.255.0

1.switch2二层交换机:
switch(config)#vlan 10
switch(config-vlan)#vlan 20
switch(config)#int f0/2
switch(config-if)#switchport mode access
switch(config-if)#switchport access vlan 10
switch(config-if)#int f0/3
switch(config-if)#switchport mode access
switch(config-if)#switchport access vlan 20
switch(config-if)#int f0/1
switch(config-if)#switchport mode trunk

2.switch3二层交换机:

Switch>en
Switch#vlan database 

Switch(vlan)#vlan 10 name vlan10

Switch(vlan)#vlan 20 name vlan20

Switch(vlan)#vlan 30 name vlan30

switch(config)#int f0/2
switch(config-if)#switchport mode access
switch(config-if)#switchport access vlan 10
switch(config-if)#int f0/3
switch(config-if)#switchport mode access
switch(config-if)#switchport access vlan 20
switch(config-if)#int f0/4

switch(config-if)#switchport access vlan 30
switch(config-if)#int f0/1
switch(config-if)#switchport mode trunk

3.switch3二层交换机:

Switch>en
Switch#vlan database 

Switch(vlan)#vlan 10 name vlan10

Switch(vlan)#vlan 30 name vlan30
switch(config)#int f0/2
switch(config-if)#switchport mode access
switch(config-if)#switchport access vlan 10
switch(config-if)#int f0/3
switch(config-if)#switchport mode access
switch(config-if)#switchport access vlan 30
switch(config-if)#int f0/1
switch(config-if)#switchport mode trunk

4.switch0三层交换机

Switch>en
Switch#vlan database 

Switch(vlan)#vlan 10 name vlan10

Switch(vlan)#vlan 20 name vlan20

Switch(vlan)#vlan 30 name vlan30

Switch(config)#int vlan 10

Switch(config-if)#ip address 192.168.10.1  255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#exit

Switch(config)#int vlan 20

Switch(config-if)#ip address 192.168.20.1  255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#exit

Switch(config)#int vlan 30

Switch(config-if)#ip address 192.168.30.1  255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#exit

Switch(config)#ip routing     //开启三层交换机的路由功能

Switch(config)#ip dhcp pool vlan10     //配置vlan10的ip地址池

Switch(dhcp-config)#network 192.168.10.0 255.255.255.0    //给vlan10配置网络号,和子网掩码

Switch(dhcp-config)#default-router 192.168.10.1  //配置默认网关

Switch(dhcp-config)#dns-server 114.144.114.114    //配置默认的DNS服务器地址,这里不配置也行。

Switch(dhcp-config)#exit             

Switch(config)#ip dhcp pool vlan20    

Switch(dhcp-config)#network 192.168.20.0 255.255.255.0    

Switch(dhcp-config)#default-router 192.168.20.1  

Switch(dhcp-config)#dns-server 114.114.114.114 

Switch(dhcp-config)#exit              

Switch(config)#ip dhcp pool vlan30    

Switch(dhcp-config)#network 192.168.30.0 255.255.255.0    

Switch(dhcp-config)#default-router 192.168.30.1  

Switch(dhcp-config)#dns-server 114.114.114.114 

Switch(dhcp-config)#exit              

5.端口封装(三层交换机):
interface f0/1
switchport trunk encapsulation dot1q
switchport mode trunk
interface f0/2
switchport trunk encapsulation dot1q
switchport mode trunk

interface f0/3
switchport trunk encapsulation dot1q
switchport mode trunk

补充思科交换机删除端口vlan:
 int g0/1 
no swtichport access vlan 100
no int vlan 100
no vlan 100

允许所有VLAN通过某端口:
interface f0/24
switchport mode trunk
switchport trunk allowed vlan all

将多端口同时划给同一VLAN,省得一个一个加:
Switch(config)#interface range f0/1-5
Switch(config-if-range)#switchport mode access 
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit

你可能感兴趣的:(网络)