交换机配置主IP地址和从IP地址作为网关举例 |
您所在的位置:网站首页 › 交换机每个网口的ip › 交换机配置主IP地址和从IP地址作为网关举例 |
本文介绍配置主IP地址和从IP地址实现设备上一个接口连接不同的子网时,设备与网络中的主机进行通信的典型配置案例。 组网需求如图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。 验证配置# 使用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
--- 172.16.2.2 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 25/25/26 ms 显示信息表示Switch与网络172.16.2.0/24内的主机可以互通。 配置文件# interface Vlan-interface1 ip address 172.16.1.1 255.255.255.0 ip address 172.16.2.1 255.255.255.0 sub # |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |