admin 管理员组

文章数量: 1086019


2024年4月26日发(作者:setstretch)

-

-

H3C交换机配置-如何实现两个网段主机与外部通信

很多朋友屡次提到交换机的配置,提到如何实现两个网段主机与

外部通信,这个是非常常见的交换机配置,这里面我们就用H3C的配

置来了解下这个过程。

如图1所示,在两个网络中的主机上采用交换机配置的主IP地址和从

IP地址作为网关,实现两个网段的主机都可以通过Switch与外部网络

通信。

图1 IP地址配置组网图

一、配置方法步骤

1. Switch的配置

# 配置VLAN接口1的主IP地址和从IP地址。

- . -

-

-

system-view

[Switch] interface vlan-interface 1

[Switch-Vlan-interface1] ip address 172.16.1.1 255.255.255.0

[Switch-Vlan-interface1] ip address 172.16.2.1 255.255.255.0 sub

[Switch-Vlan-interface1] return

2. 主机的配置

# 在172.16.1.0/24网段中的主机上配置网关为172.16.1.1;在172.16.2.0/24网段中的

主机上配置网关为172.16.2.1。

3、验证配置

# 使用ping命令检测Switch与网络172.16.1.0/24主机的连通性。

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=255 time=25 ms

Reply from 172.16.1.2: bytes=56 Sequence=2 ttl=255 time=27 ms

Reply from 172.16.1.2: bytes=56 Sequence=3 ttl=255 time=26 ms

Reply from 172.16.1.2: bytes=56 Sequence=4 ttl=255 time=26 ms

Reply from 172.16.1.2: bytes=56 Sequence=5 ttl=255 time=26 ms

--- 172.16.1.2 ping statistics ---

5 packet(s) transmitted

5 packet(s) received

0.00% packet loss

round-trip min/avg/max = 25/26/27 ms

显示信息表示Switch与网络172.16.1.0/24的主机可以互通。

# 使用ping命令检测Switch与网络172.16.2.0/24主机的连通性。

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=255 time=25 ms

Reply from 172.16.2.2: bytes=56 Sequence=2 ttl=255 time=26 ms

Reply from 172.16.2.2: bytes=56 Sequence=3 ttl=255 time=26 ms

Reply from 172.16.2.2: bytes=56 Sequence=4 ttl=255 time=26 ms

Reply from 172.16.2.2: bytes=56 Sequence=5 ttl=255 time=26 ms

- . -


本文标签: 配置 IP地址 交换机 实现 网络