交换机做节点的vlan划分
基础准备
准备一台个人pc,两台物理服务器和一台三层交换机,以及网线若干。
ip地址规划如下:
主机名 | IP |
---|---|
控制节点 | 192.168.100.0 |
计算节点 | 192.168.200.0 |
个人pc | 192.168.1.0 |
网络环境配置
为三层交换机配置vlan。以H3C-S5024-24P交换机配置为例。
新建vlan 100,为vlan 100配置IP地址为192.168.100.1,作为管理网段的网关地址,并将交换机1-8号端口加入到vlan 100中。交换机配置命令如下所示。
system-view
System View: return to User View with Ctrl+Z.
[H3C]vlan 100
[H3C-vlan100]int vlan 100
[H3C-Vlan-interface100]ip address 192.168.100.1 255.255.255.0
[H3C-Vlan-interface100]qu
[H3C]int range GigabitEthernet 1/0/1 to GigabitEthernet 1/0/8
[H3C-if-range]port link-type access
[H3C-if-range]port access vlan 100
[H3C-if-range]qu
[H3C]sa sa fo
Validating file. Please wait...
Saved the current configuration to mainboard device successfully.
新建vlan 200,为vlan 200配置IP地址为192.168.200.1,作为虚拟机业务网段的网关地址,并将交换机9-16号端口配置为trunk模式,放行vlan 200(这里直接放行所有端口)。交换机配置命令如下所示。
system-view
System View: return to User View with Ctrl+Z.
[H3C]vlan 200
[H3C-vlan200]int vlan 200
[H3C-Vlan-interface200]ip address 192.168.200.1 255.255.255.0
[H3C-Vlan-interface200]qu
[H3C]int range GigabitEthernet 1/0/9 to GigabitEthernet 1/0/16
[H3C-if-range]port link-type trunk
[H3C-if-range]port trunk permit vlan all
[H3C]sa sa fo
Validating file. Please wait...
Saved the current configuration to mainboard device successfully.
新建vlan 2,为vlan 2配置IP地址为192.168.1.1,作为训练用PC终端的网关地址,并将交换机17-24号端口加入到vlan 2中。交换机配置命令如下所示。
system-view
System View: return to User View with Ctrl+Z.
[H3C]vlan 2
[H3C-vlan2]int vlan 2
[H3C-Vlan-interface2]ip address 192.168.1.1 255.255.255.0
[H3C-Vlan-interface2]qu
[H3C]int range GigabitEthernet 1/0/17 to GigabitEthernet 1/0/24
[H3C-if-range]port link-type access
[H3C-if-range]port access vlan 2
[H3C-if-range]qu
[H3C]sa sa fo
Validating file. Please wait...
Saved the current configuration to mainboard device successfully.
网线连接
配置完交换机之后,就需要用网线将服务器等设备与交换机连接起来。将两台服务器的网口一连接到交换机的1-8口上;将两台服务器的网口二连接到交换机的9-16口上;学生的PC终端连接到交换机的17-24口。