需求:实验室有一条接入网线,该网线直接连接PC,PC的IP设置为 192.168.200.xxx 后可以访问服务器机房的服务器(IP为192.168.100.1),但是想要实验室内的多台PC都能访问 192.168.100.1,请问交换机应该如何配置?
现在的做法(未成功):将接入网线连接到交换机,设置VLAN100 IP为192.168.200.1,将网线接入口加入该VLAN;将所有 PC 接入交换机,设置VLAN10 IP为192.168.10.1,将所有 PC 设置为该网段 IP 并将对应的交换机接口加入 VLAN10;设置路由策略所有访问 192.168.100.1 都路由到 VLAN100
请问这样做为什么不能成功?应该如何设置?
PC>ping 192.168.10.2
Ping 192.168.10.2: 32 data bytes, Press Ctrl_C to break
From 192.168.10.2: bytes=32 seq=1 ttl=127 time=110 ms
From 192.168.10.2: bytes=32 seq=2 ttl=127 time=47 ms
From 192.168.10.2: bytes=32 seq=3 ttl=127 time=46 ms
--- 192.168.10.2 ping statistics ---
3 packet(s) transmitted
3 packet(s) received
0.00% packet loss
round-trip min/avg/max = 46/67/110 ms
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fea0:1eb4
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.100.1
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.100.254
Physical address..................: 54-89-98-A0-1E-B4
DNS server........................:
PC>
Welcome to use PC Simulator!
PC>ping 192.168.100.1
Ping 192.168.100.1: 32 data bytes, Press Ctrl_C to break
From 192.168.100.1: bytes=32 seq=1 ttl=127 time=47 ms
From 192.168.100.1: bytes=32 seq=2 ttl=127 time=31 ms
--- 192.168.100.1 ping statistics ---
2 packet(s) transmitted
2 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/39/47 ms
PC>ifconfig
Invalid command!
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fea7:1ca1
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.10.2
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.10.254
Physical address..................: 54-89-98-A7-1C-A1
DNS server........................:
PC>
PC>ping 192.168.100.1
Ping 192.168.100.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.100.1: bytes=32 seq=2 ttl=127 time=47 ms
From 192.168.100.1: bytes=32 seq=3 ttl=127 time=47 ms
From 192.168.100.1: bytes=32 seq=4 ttl=127 time=47 ms
--- 192.168.100.1 ping statistics ---
4 packet(s) transmitted
3 packet(s) received
25.00% packet loss
round-trip min/avg/max = 0/47/47 ms
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fe84:2ce2
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.10.3
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.10.254
Physical address..................: 54-89-98-84-2C-E2
DNS server........................:
PC>
Please press enter to start cmd line!
<Huawei>syst
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan batch 100 10
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]
Oct 16 2021 14:06:41-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 4, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei]quit
<Huawei>undo terminal debugging
Info: Current terminal debugging is off.
<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>undo terminal logging
Info: Current terminal logging is off.
<Huawei>undo terminal trapping
Info: Current terminal trapping is off.
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type access
[Huawei-GigabitEthernet0/0/1]port default vlan 100
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]port-group 2
[Huawei-port-group-2]group-member GigabitEthernet 0/0/2 GigabitEthernet 0/0/3
[Huawei-port-group-2]port link-type access
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/3]port link-type access
[Huawei-port-group-2]port default vlan 10
[Huawei-GigabitEthernet0/0/2]port default vlan 10
[Huawei-GigabitEthernet0/0/3]port default vlan 10
[Huawei-port-group-2]quit
[Huawei]interface Vlanif 100
[Huawei-Vlanif100]ip address 192.168.100.254 24
[Huawei-Vlanif100]quit
[Huawei]interface Vlanif 10
[Huawei-Vlanif10]ip address 192.168.10.254 24
[Huawei-Vlanif10]quit
[Huawei]display ip routing-table | include /24
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.10.0/24 Direct 0 0 D 192.168.10.254 Vlanif10
192.168.100.0/24 Direct 0 0 D 192.168.100.254 Vlanif100
[Huawei]