本实验使用华为eNSP模拟器,采用了VLAN技术、链路聚合、DHCP、静态路由、NAT、SSH远程管理等技术,搭建了一个简单的公司内网环境。
实验环境:
实验目的:
1. 实现全网互通
2. 实现PC上网
3. 实现服务器被公网用户访问
4. 实现SSH远程管理
实验步骤:
1. 配置两台二层交换机
sw1
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 10
[sw1]int e0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port default vlan 20
sw2
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]port link-type access
[sw2-Ethernet0/0/1]port default vlan 30
[sw2]int e0/0/2
[sw2-Ethernet0/0/2]port link-type access
[sw2-Ethernet0/0/2]port default vlan 40
2. 配置三层交换机
3sw1
[3sw1]int g0/0/2
[3sw1-GigabitEthernet0/0/2]port link-type access
[3sw1-GigabitEthernet0/0/2]port default vlan 50
[3sw1]dhcp enable
[3sw1]int Vlanif 10
[3sw1-Vlanif10]ip add 192.168.1.254 24
[3sw1-Vlanif10]dhcp select interface
[3sw1]int Vlanif 20
[3sw1-Vlanif20]ip add 192.168.2.254 24
[3sw1-Vlanif20]dhcp select interface
[3sw1]int Vlanif 30
[3sw1-Vlanif30]ip add 192.168.3.254 24
[3sw1-Vlanif30]dhcp select interface
[3sw1]int Vlanif 40
[3sw1-Vlanif40]ip add 192.168.4.254 24
[3sw1-Vlanif40]dhcp select interface
[3sw1]int Vlanif 50
[3sw1-Vlanif10]ip add 192.168.5.254 24
[3sw1]int Vlanif 1
[3sw1-Vlanif1]ip add 192.168.6.1 24
[3sw1]ip route-static 0.0.0.0 0 192.168.6.2 #默认路由
3. 配置路由器
[NAT]ip route-static 0.0.0.0 0 100.1.1.2
[NAT]ip route-static 192.168.1.0 24 192.168.6.1
[NAT]ip route-static 192.168.2.0 24 192.168.6.1
[NAT]ip route-static 192.168.3.0 24 192.168.6.1
[NAT]ip route-static 192.168.4.0 24 192.168.6.1
[NAT]ip route-static 192.168.5.0 24 192.168.6.1
[NAT]acl 2000
[NAT-acl-basic-2000]rule permit source any
[NAT-acl-basic-2000]quit
[NAT]int g0/0/1
[NAT-GigabitEthernet0/0/1]nat outbound 2000 #PC共享上网
[NAT-GigabitEthernet0/0/1]nat server protocol tcp
global current-interface www inside 192.168.5.1 www #发布服务器
4. 配置ISP
5. 验证DHCP、共享上网
(1)打开PC,选择DHCP,并应用,验证DHCP是否生效
(2)进入命令行,查看IP地址,并访问公网服务器,验证
6. 验证服务器是否发布成功
(1)在服务器上配置IP地址
(2)编写一个测试网页,并启动服务器
(3)在公网客户机上访问服务器,验证是否可以上网
7. 配置SSH,远程管理内部交换机、路由器
(1)在sw1上启用SSH
[sw1]aaa
[sw1-aaa]local-user ysf password simple 123456 #设置用户和密码
[sw1-aaa]local-user ysf service-type ssh #设置用户可以登录的方式
[sw1-aaa]local-user ysf privilege level 5 #设置用户的级别
[sw1]stelnet server enable #开启ssh服务
[sw1]ssh user zhangsan authentication-type password #配置ssh用户的认证方式
[sw1]ssh user zhangsan service-type stelnet #在路由器中不用配置这条命令
[sw1]ip route-static 0.0.0.0 0 192.168.1.254
[sw1]int vl 10
[sw1-Vlanif10]ip add 192.168.1.100 24 #配置管理地址
(2)在NAT路由器上管理sw1
如果需要在公网远程管理sw1,需要设置一下NAT
(1)设置NAT
同理,只有改一下公网的端口,可以管理所有的设备
(2)在公网上远程管理sw1