我有一台具有多个 VLAN 接口的 DAAP 服务器。我希望在所有 VLAN 上转发流量。从 eth0 转发到 eth1.010* 我已将交换机配置为具有正确 VLAN 的中继端口,并且我启用了/proc/sys/net/ipv4/ip_forward
但这似乎不起作用。我还需要做什么吗?
这是我的 ifconfig 结果,您可以看到 VLAN 接口实际上并没有获得任何流量:
eth0 Link encap:Ethernet HWaddr 00:14:d1:10:ca:fc
inet addr:192.168.1.20 Bcast:172.21.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:536 errors:0 dropped:0 overruns:0 frame:0
TX packets:259 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:264232 (258.0 KiB) TX bytes:37425 (36.5 KiB)
Interrupt:20 Base address:0xe000
eth1 Link encap:Ethernet HWaddr 00:1c:c4:31:28:22
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:303 errors:0 dropped:0 overruns:0 frame:0
TX packets:202 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:225213 (219.9 KiB) TX bytes:47118 (46.0 KiB)
Interrupt:17
eth1.0101 Link encap:Ethernet HWaddr 00:1c:c4:31:28:22
inet addr:172.17.1.20 Bcast:172.17.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:9076 (8.8 KiB)
eth1.0102 Link encap:Ethernet HWaddr 00:1c:c4:31:28:22
inet addr:172.18.1.20 Bcast:172.18.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:9076 (8.8 KiB)
eth1.0103 Link encap:Ethernet HWaddr 00:1c:c4:31:28:22
inet addr:172.19.1.20 Bcast:172.19.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:9076 (8.8 KiB)
eth1.0104 Link encap:Ethernet HWaddr 00:1c:c4:31:28:22
inet addr:172.20.1.20 Bcast:172.20.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:9076 (8.8 KiB)
eth1.0105 Link encap:Ethernet HWaddr 00:1c:c4:31:28:22
inet addr:172.21.1.20 Bcast:172.21.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:9076 (8.8 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:113 errors:0 dropped:0 overruns:0 frame:0
TX packets:113 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:20777 (20.2 KiB) TX bytes:20777 (20.2 KiB)
这是我的 /etc/network/interfaces 文件:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# Automagically configured network interfaces
auto eth0
auto eth1.0101
auto eth1.0102
auto eth1.0103
auto eth1.0104
auto eth1.0105
iface eth0 inet static
address 192.168.1.20
netmask 255.255.0.0
gateway 192.168.1.3
network 172.21.0.0
broadcast 172.21.255.255
iface eth1.0101 inet static
address 172.17.1.20
netmask 255.255.255.0
iface eth1.0102 inet static
address 172.18.1.20
netmask 255.255.255.0
iface eth1.0103 inet static
address 172.19.1.20
netmask 255.255.255.0
iface eth1.0104 inet static
address 172.20.1.20
netmask 255.255.255.0
iface eth1.0105 inet static
address 172.21.1.20
netmask 255.255.255.0
谢谢您的帮助,我已经为此工作了很长时间。
答案1
我还没有在 Ubuntu 上做过这个,但这是我目前的研究:
你需要坚持
vconfig add eth1 101
vconfig add eth1 102
vconfig add eth1 103
vconfig add eth1 104
vconfig add eth1 105
在启动脚本中。
接口文件看起来如下所示:
auto lo
iface lo inet loopback
auto eth0 eth1 vlan2 vlan3 vlan4 vlan5
iface eth0 inet dhcp
# VLAN 1 - native management VLAN
iface eth1 inet static
address 10.0.0.1
netmask 255.255.255.224
vlan_raw_device eth1
# VLAN 2 - DMZ
iface vlan2 inet static
address 10.0.0.33
netmask 255.255.255.224
vlan_raw_device eth1
# VLAN 3 - Accounting
iface vlan3 inet static
address 10.0.0.65
netmask 255.255.255.224
vlan_raw_device eth1
# VLAN 2 - DMZ
iface vlan2 inet static
address 10.0.0.33
netmask 255.255.255.224
vlan_raw_device eth1
# VLAN 3 - Accounting
iface vlan3 inet static
address 10.0.0.65
netmask 255.255.255.224
vlan_raw_device eth1
# VLAN 4 - Engineering
iface vlan4 inet static
address 10.0.0.97
netmask 255.255.255.224
vlan_raw_device eth1
# VLAN 5 - Sales & Marketing
iface vlan5 inet static
address 10.0.0.129
netmask 255.255.255.224
vlan_raw_device eth1
显然,您将在接口文件中使用自己的 IP。如果成功,请告诉我们。
答案2
如果我没看错的话,你正在寻找桥接。桥接将所有流量从一个接口转发到另一个接口。
您需要安装 bridge-utils 包并设置您的配置如下:
auto br0
iface br0 inet static
address 192.168.1.20
netmask 255.255.0.0
gateway 192.168.1.3
bridge_ports eth0 eth1.0101 eth1.0102 eth1.0103 eth1.0104 eth1.0105
不需要对单个端口进行配置。
这会将端口配置为一个网桥,并使所有内容均可访问。您可以使用brctl
命令查看网桥的状态。
答案3
成功了!我现在遇到了 DAAP 的另一个问题,但我认为它与 Avahi 有关。我会尝试自己解决这个问题。非常感谢。