小型公司访问web服务器案例
今天主要给大家带来一个小型公司的网络搭建,保证每一台计算机都可以访问www.ntd1711.com。
实验名称:小型公司网络的搭建
实验拓扑:
实验目的:
确保每个终端可以访问www.ntd1711.com(192.168.30.88)
地址规划:
设备 | IP地址及子网掩码 | 所属vlan | 网关 |
---|---|---|---|
PC1 | 192.168.10.1/24 | VLAN10 | 192.168.10.254 |
PC2 | 192.168.20.2/24 | VLAN20 | 192.168.20.254 |
PC3 | 192.168.10.3/24 | VLAN10 | 192.168.10.254 |
PC4 | 192.168.40.4/24 | VLAN40 | 192.168.40.254 |
PC5 | 192.168.40.5/24 | VLAN50 | 192.168.50.254 |
DNS服务器 | 192.168.30.1/24 | Vlan30 | 192.168.30.254 |
WEB服务器 | 192.168.30.88/24 | Vlan30 | 192.168.30.254 |
设备 | 端口 | 链路模式 |
---|---|---|
SW1 | Ge0/0/1 | Access |
Sw1 | Ge0/0/2 | Trunk |
Sw1 | Ge0/0/3 | Trunk |
Sw1 | Ge0/0/4 | Access |
Sw1 | Ge0/0/5 | Access |
Sw2 | Ge0/0/1 | Trunk |
Sw2 | Ge0/0/2 | Trunk |
Sw3 | Ge0/0/1 | Access |
Sw3 | Ge0/0/2 | Access |
Sw3 | Ge0/0/3 | Trunk |
Sw3 | Ge0/0/4 | Trunk |
Sw4 | Ge0/0/1 | Access |
Sw4 | Ge0/0/2 | Trunk |
Sw4 | Ge0/0/3 | Trunk |
Sw5 | Ge0/0/1 | Trunk |
Sw5 | Ge0/0/2 | Access |
Sw5 | Ge0/0/3 | Access |
Sw5 | Ge0/0/4 | Access |
实验思路:
1.配置设备IP地址
2.创建vlan并配置链路模式
3.配置虚拟网关及RIP协议
4.配置DNS服务器和WEB服务器
5.验证、测试和保存
实验步骤:
1.配置设备的IP地址,按照之前写的地址规划配置即可。
PC机:
2.创建vlan并配置链路模式
Sw1:
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname sw1\修改名字
[sw1]vlan batch 10 20 30 40\创建vlan10 20 30 40
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]interface GigabitEthernet 0/0/1 \进入端口
[sw1-GigabitEthernet0/0/1]port link-type trunk \设置链路模式trunk
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all\允许所有vlan通过
[sw1-GigabitEthernet0/0/1]q\退出
[sw1]interface GigabitEthernet 0/0/2\进入端口
[sw1-GigabitEthernet0/0/2]port link-type trunk \ 设置链路模式trunk
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan all\允许所有vlan通过
[sw1-GigabitEthernet0/0/2]q\退出
[sw1]interface GigabitEthernet 0/0/3 \进入端口
[sw1-GigabitEthernet0/0/3]port link-type trunk \配置链路模式trunk
[sw1-GigabitEthernet0/0/3]q\退出
[sw1]interface GigabitEthernet 0/0/4 \进入端口
[sw1-GigabitEthernet0/0/4]port link-type access\设置链路模式access
[sw1-GigabitEthernet0/0/4]port default vlan 30\允许vlan30通过
[sw1-GigabitEthernet0/0/4]q\退出
[sw1]interface GigabitEthernet 0/0/5\进入端口
[sw1-GigabitEthernet0/0/5]port link-type access\设置链路模式access
[sw1-GigabitEthernet0/0/5]port default vlan 30\允许vlan30通过
[sw1-GigabitEthernet0/0/5]q\退出
Sw2:
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname sw2\修改名字
[sw2]vlan batch 10 20 30 40\创建vlan
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2]interface GigabitEthernet 0/0/1 \进入端口
[sw2-GigabitEthernet0/0/1]port link-type trunk\设置链路模式trunk
[sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan all\允许所有vlan通过
[sw2-GigabitEthernet0/0/1]q\退出
[sw2]interface GigabitEthernet 0/0/2\进入端口
[sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan all\允许所有vlan通过
[sw2-GigabitEthernet0/0/2]q\退出
Sw3:
[Huawei]sysname sw3\修改名字
[sw3]vlan batch 10 20 30 40\创建vlan
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw3]interface GigabitEthernet 0/0/1 \进入端口
[sw3-GigabitEthernet0/0/1]port link-type access\配置链路模式access
[sw3-GigabitEthernet0/0/1]port default vlan 10\允许vlan10通过
[sw3-GigabitEthernet0/0/1]q\退出
[sw3]interface GigabitEthernet 0/0/2\进入端口
[sw3-GigabitEthernet0/0/2]port link-type access\配置链路模式access
[sw3-GigabitEthernet0/0/2]port default vlan 20\允许VLAn20 通过
[sw3-GigabitEthernet0/0/2]q\v退出
[sw3]interface GigabitEthernet 0/0/3 \进入端口
[sw3-GigabitEthernet0/0/3]port link-type trunk \ 配置链路模式trunk
[sw3-GigabitEthernet0/0/3]port trunk allow-pass vlan all\允许所有vlan通过
[sw3-GigabitEthernet0/0/3]q\退出
[sw3]interface GigabitEthernet 0/0/4 \进入端口
[sw3-GigabitEthernet0/0/4]port link-type trunk\ 配置链路模式trunk
[sw3-GigabitEthernet0/0/4]port trunk allow-pass vlan all\允许所有vlan通过
[sw3-GigabitEthernet0/0/4]q\退出
Sw4:
The device is running!
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw4\修改名字
[sw4]vlan batch 10 20 30 40\创建vlan
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw4]interface GigabitEthernet 0/0/1 \进入端口
[sw4-GigabitEthernet0/0/1]port link-type access\配置链路模式access v
[sw4-GigabitEthernet0/0/1]port default vlan 40\允许vlan40通过
[sw4-GigabitEthernet0/0/1]q\v退出
[sw4]interface GigabitEthernet 0/0/2\进入端口
[sw4-GigabitEthernet0/0/2]port link-type trunk\配置链路模式trunk
[sw4-GigabitEthernet0/0/2]port trunk allow-pass vlan all\允许所有vlan通过
[sw4-GigabitEthernet0/0/2]q\退出
[sw4]interface GigabitEthernet 0/0/3\进入端口
[sw4-GigabitEthernet0/0/3]port link-type trunk\配置链路模式trunk
[sw4-GigabitEthernet0/0/3]port trunk allow-pass vlan all\允许所有vlan通过
[sw4-GigabitEthernet0/0/3]q\退出
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw5\修改名字
[sw5]vlan batch 10 20 30 40 50\创建vlan
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw5]interface GigabitEthernet 0/0/1\ 进入端口
[sw5-GigabitEthernet0/0/1]port link-type trunk \配置链路模式trunk
[sw5-GigabitEthernet0/0/1]port trunk allow-pass vlan all\允许所有vlan通过
[sw5-GigabitEthernet0/0/1]q\退出
[sw5]interface GigabitEthernet 0/0/2\进入端口
[sw5-GigabitEthernet0/0/2]port link-type access\配置链路模式access
[sw5-GigabitEthernet0/0/2]port default vlan 40\允许vlan40通过
[sw5-GigabitEthernet0/0/2]q\v退出
[sw5]interface GigabitEthernet 0/0/3\进入端口
[sw5-GigabitEthernet0/0/3]port link-type access\配置链路模式access
[sw5-GigabitEthernet0/0/3]port default vlan 40\允许vlan40通过
[sw5-GigabitEthernet0/0/3]q\退出
[sw5]interface GigabitEthernet 0/0/4\进入端口
[sw5-GigabitEthernet0/0/4]port link-type access\配置链路模式access
[sw5-GigabitEthernet0/0/4]port default vlan 40\允许vlan40通过
[sw5-GigabitEthernet0/0/4]q\退出
3.配置虚拟网关及RIP协议
Sw1:
[sw1]interface Vlanif 10\进入虚拟端口
[sw1-Vlanif10]undo shutdown \开启端口
Info: Interface Vlanif10 is not shutdown.
[sw1-Vlanif10]ip address 192.168.10.254 24\配置网关
[sw1-Vlanif10]int vl 20\进入虚拟端口
[sw1-Vlanif20]undo shu\开启端口
Info: Interface Vlanif20 is not shutdown.
[sw1-Vlanif20]ip address 192.168.20.254 24\配置网关
[sw1-Vlanif20]int vl 30\进入虚拟端口
[sw1-Vlanif30]undo shu\开启端口
Info: Interface Vlanif30 is not shutdown.
[sw1-Vlanif30]ip add 192.168.30.2 24\配置虚拟IP地址
[sw1-Vlanif30]q\退出
[sw1]rip \ 配置RIP
[sw1-rip-1]version 2 \选择版本2
[sw1-rip-1]network 192.168.10.0\宣告网络范围
[sw1-rip-1]network 192.168.20.0\宣告网络范围
[sw1-rip-1]network 192.168.30.0\宣告网络范围
[sw1-rip-1]q\退出
Sw2:
[sw2]int vl 30\进入虚拟端口
[sw2-Vlanif30]undo shutdown \开启端口
Info: Interface Vlanif30 is not shutdown.
[sw2-Vlanif30]ip address 192.168.30.254 24\配置网关
[sw2-Vlanif30]int vl 40\进入虚拟端口
[sw2-Vlanif40]ip ad 192.168.40.254 24\配置网关
[sw2-Vlanif40]q\退出
[sw2]rip \配置RIP
[sw2-rip-1]version 2\选择版本2
[sw2-rip-1]network 192.168.30.0\宣告网络范围
[sw2-rip-1]network 192.168.40.0\宣告网络范围
[sw2-rip-1]q\退出
4.配置客户端,DNS服务器,WEB服务器
客户端:根据地址规划配置IP地址,并且添加域名服务器为DNS服务器
DNS服务器:根据地址规划配置IP地址,并且配置域名服务器为WEB服务器,添加域名以及web服务器的IP地址。
WEB服务器:根据地址规划配置IP地址,并且添加网页根目录选择HTML文件。
5.验证:
客户端访问:www.ntd1711.com
PC1访问:
PC2访问:
PC3访问:
PC4访问:
PC5访问:
今天的实验就写到这里,内容比较简单,希望大家满意,请大家提出宝贵意见,谢谢!