环境:
两台交换机、四台终端
互联VLAN:VLAN100
终端VLAN:VLAN10、VLAN20
配置接入交换机
创建VLAN
[jieru]vlan 10
[jieru]vlan 20
[jieru]vlan 100
划分端口
[jieru]vlan 10
[jieru-vlan10]port GigabitEthernet 1/0/10 GigabitEthernet 1/0/11
[jieru]vlan 20
[jieru-vlan20]port GigabitEthernet 1/0/20 GigabitEthernet 1/0/21
[jieru]vlan 100
[jieru-vlan100]port GigabitEthernet 1/0/1
配置终端接入网关地址
[jieru]interface Vlan-interface 10
[jieru-Vlan-interface10]ip address 192.168.10.1 24
[jieru]interface Vlan-interface 20
[jieru-Vlan-interface20]ip address 192.168.20.1 24
配置设备互联地址
[jieru]interface Vlan-interface 100
[jieru-Vlan-interface100]ip address 10.10.10.1 255.255.255.252
启动DHCP服务,并指定服务器地址
[jieru]dhcp enable
[jieru]interface Vlan-interface 10
[jieru-Vlan-interface10]dhcp select relay 选择中继模式
[jieru-Vlan-interface10]dhcp relay server-address 10.10.10.2 DHCP服务器地址
[jieru-Vlan-interface10]quit
[jieru]interface Vlan-interface 20
[jieru-Vlan-interface20]dhcp select relay
[jieru-Vlan-interface20]dhcp relay server-address 10.10.10.2
[jieru-Vlan-interface20]
另一种dhcp-server 指定服务器IP地址(有的设备不支持)
dhcp-server 1 ip 10.109.9.21 新建组并添加服务器IP地址
interface vlan-interface2 进入接口
dhcp-server 1 指定VLAN2的dhcp服务器
配置DHCP服务器
创建互联VLAN,划分端口
[dhcp]vlan 100
[dhcp-vlan100]port GigabitEthernet 1/0/1
配置互联VLAN地址
[dhcp]interface Vlan-interface 100
[dhcp-Vlan-interface100]ip address 10.10.10.2 255.255.255.252
配置DHCP地址池
[dhcp]dhcp enable
[dhcp]dhcp server ip-pool vlan10 创建地址池叫vlan10
[dhcp-dhcp-pool-vlan10]network 192.168.10.0 mask 255.255.255.0 地址池的网络号和掩码
[dhcp-dhcp-pool-vlan10]gateway-list 192.168.10.1 地址池的网关
[dhcp-dhcp-pool-vlan10]dns-list 8.8.8.8 地址池的dns地址
[dhcp-dhcp-pool-vlan10]forbidden-ip 192.168.10.6 192.168.10.18 从地址池中排除、不分配
[dhcp-dhcp-pool-vlan10]expired day 0 hour 0 minute 15 second 0 设置地址租约为15分钟
[dhcp]dhcp server ip-pool vlan20
[dhcp-dhcp-pool-vlan20]network 192.168.20.0 mask 255.255.255.0
[dhcp-dhcp-pool-vlan20]gateway-list 192.168.20.1
[dhcp-dhcp-pool-vlan20]dns-list 114.114.114.114
[dhcp-dhcp-pool-vlan20]forbidden-ip 192.168.20.2 192.168.20.1 192.168.20.3
[dhcp-dhcp-pool-vlan20]expired day 0 hour 0 minute 15 second 0
配置路由
[jieru]ip route-static 0.0.0.0 0.0.0.0 10.10.10.2 接到所有流量去该地址
[dhcp]ip route-static 192.168.10.0 24 10.10.10.1 配置回程路由
[dhcp]ip route-static 192.168.20.0 24 10.10.10.1
查看终端获取地址情况
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/35910.html