两台PC通过中间两台交换机通信IP与MAC地址变化

先上拓扑图

PC1配置

PC2配置

SW1配置

<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW1
[SW1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]interface Vlanif 10
[SW1-Vlanif10]ip address 192.168.1.254 24
[SW1-Vlanif10]q
[SW1]interface Vlanif 20
[SW1-Vlanif20]ip address 192.168.12.1 30
[SW1-Vlanif20]q
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access 
[SW1-GigabitEthernet0/0/1]port default vlan 10
[SW1-GigabitEthernet0/0/1]q
[SW1]interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2]port link-type trunk 
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 20
[SW1-GigabitEthernet0/0/2]q

SW2配置

<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn SW2
[SW2]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]interface Vlanif 10
[SW2-Vlanif10]ip add 192.168.2.254 24
[SW2-Vlanif10]q
[SW2]interface Vlanif 20
[SW2-Vlanif20]ip add 192.168.12.2 30
[SW2-Vlanif20]q
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]port link-type trunk 
[SW2-GigabitEthernet0/0/2]port trunk allow-pass vlan 20
[SW2-GigabitEthernet0/0/2]q
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type access 
[SW2-GigabitEthernet0/0/1]port default vlan 10
[SW2-GigabitEthernet0/0/1]q

配置静态路由

SW1配置
[SW1]ip route-static 192.168.2.0 24 192.168.12.2

SW2配置
[SW2]ip route-static 192.168.1.0 24 192.168.12.1

PC1 ping PC2

在SW1 G0/0/1口进行抓包查看 PC1到SW1

源mac        Source: PC1 (54:89:98:b1:14:62)
目的mac     Destination: SW1 (4c:1f:cc:0f:6d:ef)

源IP            Source: 192.168.1.1
目的IP        Destination: 192.168.2.1

 在SW2 G0/0/2口进行抓包查看 SW1到SW2

源mac           Source: SW1 (4c:1f:cc:0f:6d:ef)
目的mac        Destination: SW2(4c:1f:cc:92:71:c6)

源IP        Source: 192.168.1.1
目的IP    Destination: 192.168.2.1

 在PC2 e0/0/1口进行抓包查看SW2到PC2

源mac        Source: SW2 (4c:1f:cc:92:71:c6)
目的mac     Destination:PC2 (54:89:98:d5:4c:46)
源IP            Source: 192.168.1.1
目的IP         Destination: 192.168.2.1

 PC2 ping PC1

PC2-SW2

SW2-SW1

SW1-PC1

MAC地址表

 

结论:无NAT情况下通信过程中,数据包中源、目的IP不会发生改变,会发生变化的是源、目的mac地址。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值