在Cisco 3750交换机中configuration中继接口以允许多个Vlans与具有单个NIC的Ubuntu服务器连接(子接口)

根据本指南,我有三台Ubuntu服务器(每台服务器只有一个NIC)用于我的Openstack群集configuration。

我也有一个Cisco 3750 24端口以太网交换机,我用它作为Ubuntu服务器和另一个Windows(有2个NIC)机器作为Internet网关之间的L3设备。

根据该指南,在Ubuntu服务器的单个物理网卡中创build了2个子接口,以分离用于不同OpenStack目的的stream量。

networking拓扑 。

例如:我在networking中有以下vlans

vlan10 – 在物理ubuntu服务器之间进行通信(需要可路由到互联网g / w) – 已经configuration并工作正常(交换机端口被configuration为“访问”端口)

vlan101 – 虚拟机的内部数据networking(只需要连接L2连接)

vlan102 – 虚拟机的公共networking(需要可路由到互联网g / w)

我的问题是:是否可以将交换机端口configuration为中继接口,并允许单个交换机端口中的所有VLAN,以便它们也可以正确通信。

请注意,我只有一个Cisco 3750交换机。 没有别的select。

非常感谢 …


这里是configuration:

================================================== ============================== 01. controller1-01 (Ubuntu服务器)/ etc / network / interfaces(OpenStack控制器节点)

—————————————

汽车

iface lo inet loopback

—————————————

auto eth0

iface eth0 inet static

地址192.168.0.29

networking掩码255.255.255.224

networking192.168.0.0

广播192.168.0.31

网关192.168.0.30

—————————————

auto eth0.101

iface eth0.101 inet static

vlan-raw-device eth0

地址10.0.0.253

networking掩码255.255.255.0

—————————————

auto eth0.102

iface eth0.2 inet static

vlan-raw-device eth0

地址192.168.0.157

networking掩码255.255.255.224

up route add -net 10.10.10.0/24 gw 1​​92.168.0.131

================================================== ============================== 02. ns1-01 (Ubuntu服务器)/ etc / network / interfaces(昆腾networking节点)

—————————————

汽车

iface lo inet loopback

—————————————

auto eth0

iface eth0 inet static

地址192.168.0.1

networking掩码255.255.255.224

networking192.168.0.0

广播192.168.0.31

网关192.168.0.30

—————————————

auto eth0.101

iface eth0.101 inet static

vlan-raw-device eth0

地址10.0.0.1

networking掩码255.255.255.0

—————————————

auto eth0.102

iface eth0.102 inet手册

vlan-raw-device eth0

启动ifconfig $ IFACE 0.0.0.0起来

ip link设置$ IFACE promisc

向下ifconfig $ IFACE

================================================== ============================== 03. ns1-02 (Ubuntu服务器)/ etc / network / interfaces(OpenStack计算节点)

—————————————

汽车

iface lo inet loopback

—————————————

auto eth0

iface eth0 inet static

地址192.168.0.2

networking掩码255.255.255.224

networking192.168.0.0

广播192.168.0.31

网关192.168.0.30

—————————————

auto eth0.101

iface eth0.101 inet static

vlan-raw-device eth0

地址10.0.0.2

networking掩码255.255.255.0

================================================== ============================== 04. LS1-01 (Ubuntu服务器)/ etc / network / interfaces(OpenStack计算节点)

—————————————

接口GigabitEthernet1 / 0/1

描述//连接到ns1-01(一区networking节点)

switchport中继封装dot1q

switchport trunk native vlan 10

switchport trunk允许vlan 10,101,102

switchport模式中继

—————————————

接口GigabitEthernet1 / 0/2

描述//连接到ns1-02(一区计算节点)

switchport中继封装dot1q

switchport trunk native vlan 10

switchport trunk允许vlan 10,101,102

switchport模式中继

—————————————

接口GigabitEthernet1 / 0/11

描述//连接到控制器1-01(一区控制器节点)

switchport中继封装dot1q

switchport trunk native vlan 10

switchport trunk允许vlan 10,101,102

switchport模式中继

—————————————

接口GigabitEthernet1 / 0/12

描述//连接到Internet

没有switchport

IP地址192.168.0.65 255.255.255.252

—————————————

接口Vlan10

描述//在区域1下的物理机的pipe理networking

IP地址192.168.0.30 255.255.255.224

—————————————

接口Vlan101

description //在Region One下的VM实例的内部数据networking

IP地址10.0.0.254 255.255.255.0

—————————————

接口Vlan102

description //在Region One下的VM实例的Public / APInetworking

IP地址192.168.0.158 255.255.255.224

—————————————

ip route 0.0.0.0 0.0.0.0 192.168.0.66#走向Internet G / W

绝对可以。 您正在寻找802.1q标记,这是交换机上多个VLAN的基础。

像这样configuration面向服务器的端口…

interface GigabitEthernet0/1 ! tell the switch to encapsulate frames with dot1q on this trunk port switchport trunk encapsulation dot1q ! make this a trunk port unconditionally switchport mode trunk ! allow VLANs 220, 221, and 223 to be sent on this port switchport trunk allowed vlan 220,221,223 ! send vlan 221 frames untagged ! you could omit this command, but you'll need to move your eth0 config to a subinterface as well switchport trunk native vlan 221 ! this is an end-device, and doesn't need to be treated like a switch for spanning-tree spanning-tree portfast trunk ! remove the (ignored) access vlan setting, as this is now a trunk no switchport access vlan 

在您的Ubuntu服务器上,您需要将子接口configuration为与每个适当的VLAN相关联。 这可以像这样手动完成…

 # create a new subinterface tied to dot1q vlan 221 ip link add link eth0 name eth0.221 type vlan id 221 # change the MTU to allow for the inserted dot1q tag (4 bytes) ifconfig eth0 mtu 1504 # bring the new interface up ifconfig eth0.221 up 

现在您可以将正确的IP地址与新的接口eth0.221以及相应的默认网关和子网掩码相关联。

如果这不起作用,请在您的Ubuntu服务器上包含一个pastebin链接到您的交换机configuration以及“ip -d link show”的输出。

希望这可以帮助!