两台PC跨vlan,实现3层互通配置实例

拓扑图:

PC1:

PC2:

CE-1:

首先进入系统试图,修改名称

<HUAWEI>sys
<HUAWEI>system-view 
Enter system view, return user view with return command.
[~HUAWEI]sysname CE-1
[*HUAWEI]com
[~CE-1]

配置交换机GE1/0/1接口类型为access,GE1/0/2口为trunk,体验不同类型交换机口配置方式

[~CE-1]vlan batch 10 20
Info: Operating, please wait for a moment...........done.
[*CE-1]com
[~CE-1]int ge1/0/1
[~CE-1-GE1/0/1]port link-type access
[~CE-1-GE1/0/1]port default vlan 10
[*CE-1-GE1/0/1]com
[~CE-1-GE1/0/1]q
[~CE-1]int ge1/0/2
[~CE-1-GE1/0/2]port link-type trunk
[*CE-1-GE1/0/2]port trunk allow-pass vlan 20
[*CE-1-GE1/0/2]com
[~CE-1-GE1/0/2]
[~CE-1-GE1/0/2]port trunk pvid vlan 20
[*CE-1-GE1/0/2]com

配置VLAN10和20的网关和掩码

[~CE-1]int vlanif10
[*CE-1-Vlanif10]ip a 192.168.10.254 24
Info: Operating, please wait for a moment......done.
[*CE-1-Vlanif10]com
[~CE-1-Vlanif10]q
[~CE-1]int vlanif20
[*CE-1-Vlanif20]ip a 192.168.20.254 24
[*CE-1-Vlanif20]com
[~CE-1-Vlanif20]q

结果

PC1:

Welcome to use PC Simulators!
PC> ping 192.168.10.254 
PING 192.168.10.254 (192.168.10.254) 56(84) bytes of data.
64 bytes from 192.168.10.254: icmp_seq=1 ttl=254 time=139 ms
64 bytes from 192.168.10.254: icmp_seq=2 ttl=254 time=9.48 ms
64 bytes from 192.168.10.254: icmp_seq=3 ttl=254 time=5.29 ms
64 bytes from 192.168.10.254: icmp_seq=4 ttl=254 time=15.7 ms
64 bytes from 192.168.10.254: icmp_seq=5 ttl=254 time=2.72 ms
^C
--- 192.168.10.254 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4016ms
rtt min/avg/max/mdev = 2.716/34.447/139.008/52.465 ms
PC> ping 192.168.20.1  
PING 192.168.20.1 (192.168.20.1) 56(84) bytes of data.
64 bytes from 192.168.20.1: icmp_seq=1 ttl=63 time=50.6 ms
64 bytes from 192.168.20.1: icmp_seq=2 ttl=63 time=52.2 ms
64 bytes from 192.168.20.1: icmp_seq=3 ttl=63 time=8.71 ms
64 bytes from 192.168.20.1: icmp_seq=4 ttl=63 time=54.2 ms
^C
--- 192.168.20.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3018ms
rtt min/avg/max/mdev = 8.708/41.442/54.218/18.941 ms
PC> 

PC2:

Welcome to use PC Simulators!
PC> ping 192.168.20.254
PING 192.168.20.254 (192.168.20.254) 56(84) bytes of data.
64 bytes from 192.168.20.254: icmp_seq=1 ttl=254 time=8.87 ms
64 bytes from 192.168.20.254: icmp_seq=2 ttl=254 time=3.18 ms
64 bytes from 192.168.20.254: icmp_seq=3 ttl=254 time=6.52 ms
^C
--- 192.168.20.254 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2016ms
rtt min/avg/max/mdev = 3.180/6.189/8.872/2.335 ms
PC> ping 192.168.10.1  
PING 192.168.10.1 (192.168.10.1) 56(84) bytes of data.
64 bytes from 192.168.10.1: icmp_seq=1 ttl=63 time=10.3 ms
64 bytes from 192.168.10.1: icmp_seq=2 ttl=63 time=15.7 ms
64 bytes from 192.168.10.1: icmp_seq=3 ttl=63 time=49.9 ms
^C
--- 192.168.10.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2016ms
rtt min/avg/max/mdev = 10.348/25.321/49.934/17.539 ms
PC> 

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值