V7版本,以交换机作为中继
为什么要有中继?通常情况主机和服务器都在同一网段,主机发送的广播报文,服务器都能收到,但是如果为每一个网段都放置一个服务器,显然不太经济,所以就有了中继技术,客户端和中继交互,再由中继转发给服务器;
物理拓扑
配置思路:
1.交换机和服务器接口配地址(交换机进入vlan虚接口配置地址)
2.交换机路由器启用ospf
3.服务器配置地址池,两个网段两个地址池
4.交换机作为中继,在接口下面配置服务器的地址
注意:交换机服务器一定要开启dhcp
R1服务器配置:
[H3C]interface g0/0
[H3C-GigabitEthernet0/0]ip address 192.168.1.1 255.255.255.0
#下面是地址池配置,一共两个网段所以自然是两个地址池
[H3C]dhcp server ip-pool vlan10
[H3C-dhcp-pool-vlan10]network 192.168.10.0 24
[H3C-dhcp-pool-vlan10]gateway-list 192.168.10.1
[H3C-dhcp-pool-vlan10]expired day 0 hour 0 minute 30
#第二个地址池
[H3C]dhcp server ip-pool vlan20
[H3C-dhcp-pool-vlan20]network 192.168.20.0 24
[H3C-dhcp-pool-vlan20]gateway-list 192.168.20.1
[H3C-dhcp-pool-vlan20]expired day 0 hour 0 minute 30
dhcp中继配置
这里SW1作为dhcp的中继
#这是上行口的配置,交换机作为中继要与服务器能够通信
[H3C]vlan 100
[H3C-vlan100]port g1/0/1
[H3C]interface vlan 100
[H3C-Vlan-interface100]ip address 192.168.2.1 24
#这是连接主机的两个接口,都要加入vlan,并且配置地址(SW1)
[H3C]vlan 10
[H3C-vlan10]port g1/0/2
[H3C]vlan 20
[H3C-vlan20]port g1/0/3
[H3C]interface Vlan-interface 10
[H3C]in vlan 10
[H3C-Vlan-interface10]ip address 192.168.10.1 255.255.255.0
[H3C]in vlan 10
[H3C-Vlan-interface10]ip address 192.168.10.1 255.255.255.0
#服务器和中继之间做ospf,让服务器学习到中继连接主机的两个端口地址
服务器R1:
[H3C]ospf 1
[H3C-ospf-1]area 0
[H3C-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0
交换机SW1:
[H3C]ospf 1
[H3C-ospf-1]area 0
[H3C-ospf-1-area-0.0.0.0]network 192.168.1.2 0.0.0.0
[H3C-ospf-1-area-0.0.0.0]network 192.168.10.1 0.0.0.0
[H3C-ospf-1-area-0.0.0.0]network 192.168.20.1 0.0.0.0
#最后就是中继的配置(SW1)
[H3C]dhcp enable
[H3C]in vlan 10
[H3C-Vlan-interface10] dhcp select relay
[H3C-Vlan-interface10]dhcp relay server-address 192.168.1.1
[H3C]in vlan 20
[H3C-Vlan-interface20] dhcp select rela
[H3C-Vlan-interface20]dhcp relay server-address 192.168.1.1
#主机启用接口,dhcp获取地址