网络设计之DHCP服务器及spanning-tree portfast(生成树协议)
效果图
1、声明VLAN
vlan 1
no shutdown
exit
vlan 2
no shutdown
exit
vlan 3
no shutdown
exit
vlan 4
no shutdown
exit
2、给vlan配IP
10.0.0.1
interface vlan 1
ip address 10.0.0.1
no shutdown
exit
interface vlan 2
ip address 172.16.2.1
no shutdown
exit
interface vlan 3
ip address 172.16.3.1
no shutdown
exit
10.0.0.2
interface vlan 1
ip address 10.0.0.2
no shutdown
exit
interface vlan 4
ip address 172.16.3.1
no shutdown
exit
3、10.0.1.1配vlan和默认网关
interface vlan 1
ip address 10.0.1.1
no shutdown
exit
ip default-gateway 10.0.0.2
4、配端口
10.0.0.1
interface ethernet 0/0
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 1-4
switchport mode trunk
no shutdown
exit
interface ethernet 0/1
switchport access vlan 2
switchport mode access
no shutdown
exit
10.0.0.2
interface ethernet 0/0
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 1-4
switchport mode trunk
no shutdown
exit
interface ethernet 0/1
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 1,4
switchport mode trunk
no shutdown
exit
10.0.1.1
interface ethernet 0/1
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 1,4
switchport mode trunk
no shutdown
exit
interface ethernet 0/2
switchport access vlan 4
switchport mode access
no shutdown
exit
5、生成树协议
10.0.1.1
interface ethernet 0/2
spaningtree portfast
no shutdown
exit
6、主机配ip
172.16.1.2
ip 172.16.1.2 255.255.255.0 172.16.1.1
172.16.2.2
ip 172.16.2.2 255.255.255.0 172.16.2.1
7、配置DHCP服务
10.0.0.2
ip dhcp pool pool-name
network 172.16.3.0 /24
defult-router 172.16.3.1
dns-server 202.4.130.100 202.4.130.101
成功后是这个样子
完成!
要做到全部ping通
不然第一时间去no shutdown vlan
版权声明:本文为w20000213原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。