组网TOP:
预配置:
R1:
interface Ethernet0/0
ip address 172.23.253.1 255.255.255.252
R2:
interface Ethernet0/0
ip address 172.23.253.2 255.255.255.252
interface Ethernet0/1
ip address 172.23.253.5 255.255.255.252
SW3:
interface Ethernet0/1
no switchport
ip address 172.23.253.6 255.255.255.252
配置思路(需求分析)
1)R1作为dhcp服务器,创建两个ip pool地址池,命名为VLAN-100、VLAN-200;为了实际应用中存在使用固定IP的情况,如打印机、网络设备管理IP等,预留出50个。
2)R2和SW3运行一个动态路由选择协议,这里选用OSPF;
SW3作为核心交换机,需配置dhcp中继,给不同用户分配不同网段的ip地址。
3)SW3与SW4之间配置trunk,放通2个vlan下去
4)内网PC用路由器代替:R3、R4
具体配置粘贴:
R1:
ip dhcp excluded-address 192.168.100.1 192.168.100.50 //预留
ip dhcp excluded-address 192.168.200.1 192.168.200.50
ip dhcp pool VLAN-100
network 192.168.100.0 255.255.254.0 // IP地址范围192.168.100.1~192.168.101.254
default-router 192.168.100.1 //配置网关地址
dns-server 114.114.114.114
ip dhcp pool VLAN-200
network 192.168.200.0 255.255.254.0
default-router 192.168.200.1
dns-server 114.114.114.114
配置一条静态默认路由:ip route 0.0.0.0 0.0.0.0 172.23.253.2 //指向下一跳
下面就能体现动态路由选择协议的优势了,无论有多少网段,宣告一下,其他节点就能同步学习过来。
R2:
router ospf 10
network 172.23.253.0 0.0.0.3 area 0
network 172.23.253.4 0.0.0.3 area 0
SW3:
router ospf 10
network 172.23.253.4 0.0.0.3 area 0
network 192.168.100.0 0.0.1.255 area 0
network 192.168.200.0 0.0.1.255 area 0
配置dhcp中继:
interface Vlan100
ip address 192.168.100.1 255.255.254.0 //业务网段网关地址
ip helper-address 172.23.253.1 //dhcp服务器ip
interface Vlan200
ip address 192.168.200.1 255.255.254.0
ip helper-address 172.23.253.1
interface Ethernet0/0 //下行口
switchport trunk allowed vlan 100,200
switchport trunk encapsulation dot1q
switchport mode trunk
SW4:
interface Ethernet0/0 //上行口
switchport trunk allowed vlan 100,200
switchport trunk encapsulation dot1q
switchport mode trunk
interface Ethernet0/1
switchport access vlan 100
switchport mode access
interface Ethernet0/2
switchport access vlan 200
switchport mode access
实验结果展示:
2020.5.21