实验一 计算机和交换机基本网络设置
(1) 添加一台华为S3026交换机,添加2台PC
(2) 连接PC1至交换机2号端口,连接PC2至7号端口
(3) 打开PC1的配置界面,配置其IP地址为10.65.1.1(掩码255.255.255.0);
打开PC2的配置界面,配置其IP地址为10.65.1.2(掩码255.255.255.0)
PCA login: root password: linux
[root@PCA root]# ifconfig eth0 192.163.1.1 netmask 255.255.255.0 [root@PCA root]#
PCB login: root password: linux
[root@PCB root]# ifconfig eth0 192.163.1.2 netmask 255.255.255.0 [root@PCB root]#
(4) 更改交换机的名字,为其设置密码,配置远程登录数据
Enter system view, return to user view with Ctrl+Z. [Quidway]sysname yiyi [yiyi]super password 123 [yiyi] (5) 查看默认vlan,也即vlan1 [yiyi]dis vlan (6) 在PC1上PING测试PC2 [root@PCA root]# ping 192.163.1.2 64 bytes from 192.163.1.1: icmp_seq=1 ttl=128 time=0.207 ms 64 bytes from 192.163.1.1: icmp_seq=1 ttl=128 time=0.100 ms 64 bytes from 192.163.1.1: icmp_seq=1 ttl=128 time=0.96 ms 64 bytes from 192.163.1.1: icmp_seq=1 ttl=128 time=0.96 ms 4packets transmitted, 4 received, 0% loss, time 2000ms [root@PCA root]# (7) 在交换机上创建vlan2,将交换机端口3~7加入vlan2,查看vlan [yiyi]vlan 2 [yiyi-vlan2]port e0/3 to e0/7 [yiyi-vlan2]dis vlan Vlan Name Status Ports -------- -------- ---------- ------------------------ 2 Vlan02 Active F0/3, F0/4, F0/5, F0/6, F0/7 1002 fddi-d Active 1004 fnet-d Active VLAN Type SAID MTU -------- ------- -------------- -------- 1 enet 100001 1500 1002 fddi 101002 1500 1002 fnet 101003 1500 [yiyi] (8) 在PC1上PING测试PC2 [root@PCA root]# ping 192.163.1.2 From 192.163.1.1 icmp_seq=1 Destination Host Unreachable From 192.163.1.1 icmp_seq=1 Destination Host Unreachable From 192.163.1.1 icmp_seq=1 Destination Host Unreachable From 192.163.1.1 icmp_seq=1 Destination Host Unreachable 4packets transmitted, 0 received, 100% loss, time 2000ms (9) 将交换机端口2加入vlan2,查看vlan [yiyi-vlan2]vlan 2 [yiyi-vlan2]port e0/2 [yiyi-vlan2]dis vlan Vlan Name Status Ports -------- -------- ---------- ------------------------ 2 Vlan02 Active F0/3, F0/4, F0/5, F0/6, F0/7, F0/2 1002 fddi-d Active 1004 fnet-d Active VLAN Type SAID MTU -------- ------- -------------- -------- 1 enet 100001 1500 1002 fddi 101002 1500 1002 fnet 101003 1500 (10)在PC1上PING测试PC2 [root@PCA root]# ping 192.163.1.2 64 bytes from 192.163.1.1: icmp_seq=1 ttl=128 time=0.207 ms 64 bytes from 192.163.1.1: icmp_seq=1 ttl=128 time=0.100 ms 64 bytes from 192.163.1.1: icmp_seq=1 ttl=128 time=0.96 ms 64 bytes from 192.163.1.1: icmp_seq=1 ttl=128 time=0.96 ms 4packets transmitted, 4 received, 0% loss, time 2000ms (11)配置vlan2的IP地址为10.65.1.8 255.255.255.0 [yiyi-vlan2]int vlan 2 [yiyi-Vlan-interface2]ip address 192.163.1.6 255.255.255.0 [yiyi-Vlan-interface2]quit [yiyi]ip route-static 0.0.0.0 0.0.0.0 192.163.1.2 [yiyi]]ip default-gateway 192.163.1.2 [yiyi]save Save current configuration to flash memory successfully. (12)在交换机上PING测试PC2 [yiyi]ping 192.163.1.2 From icmp Sequence=0 Destination Host Unreachable From icmp Sequence=1 Destination Host Unreachable From icmp Sequence=2 Destination Host Unreachable From icmp Sequence=3 Destination Host Unreachable From icmp Sequence=4 Destination Host Unreachable --- 192.163.1.2 ping statistics --- 5 packets transmitted 0 packets received 100% packet loss 之所以PING不通,原因可能有:vlan 与vlan 2之间不通,不通过虚拟局域网之间不能直接通信,需要通过路由器。 因篇幅问题不能全部显示,请点此查看更多更全内容