将主机放在同一交换机上的自己的 VLAN 中,并且能够 ping 主机

网络工程 思科 转变 局域网 顺式催化剂
2022-03-02 07:29:52

这个标题有点杂乱,所以让我试着清理一下。

我的装备:

  • 两个IP Codecs(从这里开始我将它们称为主机)
  • Cisco 3560-x Catalyst 交换机

问题:

我在无线电 IT 工作,我有一个主要的 AOIP 交换网络192.168.87.0/24(我不会这样做)有两个设备,我们的 AOIP STL 将音频从工作室传输到发射器。那是我有问题的两位主持人。他们的网络是192.168.100.0/24,两台主机是192.168.100.100/24192.168.100.101/24我想从 ping192.168.100.0192.168.87.0管理 VLAN 是具有 IP 地址的 VLAN 1 192.168.87.21

我试过的:

我知道 intervlan 路由可能是这里的答案,但我不确定如何只用一个单独的交换机来实现它。

我尝试了一个简单的:

en
conf t
vlan 50
name Trango
exit
int vlan 50
descr Vlan for the Trango systems
ip add 192.168.100.105 255.255.255.0
no sh

显然我无法 ping 192.168.100.105我错过了流程的哪一部分?

4个回答

要在 VLAN 之间发送流量,您需要在 VLAN 之间路由它(因此,路由器)。如果您的交换机具有适当的许可(IP Base 或以上许可)成为第 3 层交换机(可以路由),那么您需要使用ip routing命令启用它。您还需要为要为其路由的每个 VLAN 创建第 3 层接口 (SVI)。然后将每个接口分配给正确的 VLAN。每台主机都需要为其 VLAN 配置 SVI 的 IP 地址作为其网关。

对于第 2 层交换机(LAN Base 许可证),您将需要一个外部路由器。您可以将 VLAN 中继到路由器,在那里您将为每个 VLAN 创建子接口,并且路由器可以在 VLAN 之间路由。每台主机都需要将其 VLAN 的路由器 VLAN 接口的 IP 地址配置为其网关。

备份您当前的配置并在您自己的研究和您自己的风险之后使用以下命令。我在飞行中输入了所有这些,所以我可能错过了一些东西。请在测试之前备份您的配置。设置这些命令后,您需要将网关地址添加到您的设备。我们在下面创建的 VLAN 接口将成为这些网络的网关。如果您已经为当前网络使用网关,请不要为该 vlan 添加 interface vlan 命令。像我在底部做的那样添加另一条路线。我举个例子。另外,请注意,不建议将 vlan 1 用作安全措施。大多数网站都这样做,但我想记下。

enable
config t
ip routing
interface vlan 1 (use your vlan numbers)
ip address 192.168.87.1 255.255.255.0 (use the IP address you want to be your gateway)
exit
interface vlan 2 (use your vlan numbers)
ip address 192.168.100.1 255.255.255.0 (use the IP address you want to be your gateway)
exit
int g0/1 (use your interface number)
switchport mode access
switchport access vlan 1 (use your vlan)
exit
int g0/2 (use your interface number of your vlan 2 devices)
switchport mode access
switchport access vlan 2 (use your vlan)
exit
(if you have an uplink to another switch)
int g0/24 (use your uplink interface number)
switchport mode trunk (do this on both switches)
exit
ip route 0.0.0.0 192.168.#.# (ip of your next hop toward the internet. If this is your current vlan 1 gateway for 192.168.87.0 network do not give the interface vlan 1 the same IP address as your next hop. Give it an IP address different than your next hop like 192.168.87.2 or no ip address at all if you have a management IP address already)
exit
exit
copy run start (this saves the config so at a reboot you don't loose it)

然后在某处备份您的交换机。

看到这些观点,这两个答案都是有用且有趣的。他们帮助我更多地了解网络......这是我最终所做的:
我为 g0/38 分配了一个 IP 地址 192.168.100.105,并创建了 VLAN 50。我将 g0/38 分配给访问 VLAN 50,我能够 ping连接到该接口的两台主机。
所以现在,当我需要 ping 那些主机时,我只需要编写一个脚本,进入交换机并为我 ping 它。不理想,但考虑到无法启用 IP 路由并且我没有可以连接到该网络的路由器,这是最好的情况。

这些是注释,不会添加到交换机配置中

确保连接同一子网上的主机的交换机端口位于同一 VLAN 上

VLAN 1 是默认配置的,是您的子网 192.168.87.0 的 VLAN

您需要确保该子网上的主机在 VLAN 1 上

show vlan brief

或者

show vlan

检查以确保 192.168.87.0 上的主机是 VLAN 1 的成员

conf t
vlan 2
 description VLAN FOR 192.168.100.0 SUBNET
vlan 1
 description VLAN FOR 192.168.87.0 SUBNET
interface vlan 1
 description GATEWAY IP OF YOUR 192.168.87.0 HOSTS
ip address 192.168.87.1 255.255.255.0
 no shutdown
interface vlan 2
 description GATEWAY IP OF YOUR 192.168.100.0 HOSTS
 ip address 192.168.100.1 255.255.255.0
 no shutdown
ip routing

以下配置适用于您的 192.168.87.0 主机 a/be 是交换机端口号,因此请用真实端口号替换它们!

interface a/b
 switchport access vlan 1
 no shutdown
interface a/c
 switchport access vlan 1
 no shutdown

以下配置适用于您的 192.168.100.0 主机

interface a/d
 switchport access vlan 2
 switchport mode access
 no shutdown
interface a/e
 switchport access vlan 2
 switchport mode access
 no shutdown