配置接口的主从IP地址示例
组网需求
如图1所示,Switch上只有一个空闲以太网接口10GE1/0/1,但该局域网中的计算机分别属于2个不同的网段172.16.1.0/24和172.16.2.0/24,要求通过Switch可以实现一个接口接入两个不同的网段。
操作步骤
- 配置Switch的10GE1/0/1接口所属VLANIF100接口的IP地址。
<HUAWEI> system-view [~HUAWEI] sysname Switch [*HUAWEI] commit [~Switch] vlan batch 100 [*Switch] interface 10ge 1/0/1 [*Switch-10GE1/0/1] port default vlan 100 [*Switch-10GE1/0/1] quit [*Switch] interface vlanif 100 [*Switch-Vlanif100] ip address 172.16.1.1 24 [*Switch-Vlanif100] ip address 172.16.2.1 24 sub [*Switch-Vlanif100] quit [*Switch] commit [~Switch] quit
- 验证配置结果。
# 从Switch上Ping网段172.16.1.0内的主机,可以Ping通。
<Switch> ping 172.16.1.2 PING 172.16.1.2: 56 data bytes, press CTRL_C to break Reply from 172.16.1.2: bytes=56 Sequence=1 ttl=254 time=1 ms Reply from 172.16.1.2: bytes=56 Sequence=2 ttl=254 time=1 ms Reply from 172.16.1.2: bytes=56 Sequence=3 ttl=254 time=1 ms Reply from 172.16.1.2: bytes=56 Sequence=4 ttl=254 time=1 ms Reply from 172.16.1.2: bytes=56 Sequence=5 ttl=254 time=1 ms --- 172.16.1.2 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 1/1/1 ms
# 从Switch上Ping网段172.16.2.0内的主机,可以Ping通。
<Switch> ping 172.16.2.2 PING 172.16.2.2: 56 data bytes, press CTRL_C to break Reply from 172.16.2.2: bytes=56 Sequence=1 ttl=254 time=1 ms Reply from 172.16.2.2: bytes=56 Sequence=2 ttl=254 time=1 ms Reply from 172.16.2.2: bytes=56 Sequence=3 ttl=254 time=1 ms Reply from 172.16.2.2: bytes=56 Sequence=4 ttl=254 time=1 ms Reply from 172.16.2.2: bytes=56 Sequence=5 ttl=254 time=1 ms --- 172.16.2.2 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 1/1/1 ms
配置文件
Switch的配置文件
# sysname Switch # vlan batch 100 # interface Vlanif100 ip address 172.16.1.1 255.255.255.0 ip address 172.16.2.1 255.255.255.0 sub # interface 10GE1/0/1 port default vlan 100 # return
阅读剩余
版权声明:
作者:SE_YT
链接:https://www.cnesa.cn/6311.html
文章版权归作者所有,未经允许请勿转载。
THE END