我对网络设置不是很有经验。
我的网络目前如下所示:
Internet <=> Router <=> NAS
^=> My computer
我的 NAS 实际上有 4 个网络端口,其中 2 个支持 10GbE,我想在我的计算机上使用它们(假设我有一个 10GbE NIC),因此我尝试进行如下设置:
Internet <=> Router <=> NAS <=> My computer
我仍然希望我的电脑能够连接互联网,同时能够直接访问 NAS,而不必通过不具备 10GbE 功能的路由器。
NAS 运行的是 OpenMediaVault,它基于 Debian 构建。我曾尝试参考这个问题尝试设置转发,但它似乎对我来说不起作用。
NAS 还运行着一个 Docker 守护进程,它添加了自己的桥接接口docker0
以及一些 iptables 内容,这让我理解起来有点复杂,因为我不知道“干净”的 iptables 应该是什么样的。
有人能给出如何设置的说明吗,最好能解释一下每个步骤的作用?NAS 通过 连接到路由器eth1
,我尝试用来连接计算机的接口是eth3
。
编辑:
根据 EEAA 的建议,我尝试桥接连接,但仍然不起作用。以下是我故障排除的一些输出:
ifconfig
:(没有接口就没有问题)
br0 Link encap:Ethernet HWaddr ac:1f:6b:14:74:43
inet addr:192.168.1.50 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:184494453 errors:0 dropped:15 overruns:0 frame:0
TX packets:61722948 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12183777795 (11.3 GiB) TX bytes:3308095544990 (3.0 TiB)
eth1 Link encap:Ethernet HWaddr ac:1f:6b:14:74:43
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:204022329 errors:0 dropped:99 overruns:0 frame:0
TX packets:2496398741 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:18134842309 (16.8 GiB) TX bytes:3766713296562 (3.4 TiB)
Memory:fb100000-fb11ffff
eth3 Link encap:Ethernet HWaddr ac:1f:6b:14:75:87
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:23600 errors:0 dropped:32 overruns:0 frame:0
TX packets:9333 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3734929 (3.5 MiB) TX bytes:837441 (817.8 KiB)
route -n
:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 br0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
ip addr show
:
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
link/ether ac:1f:6b:14:74:43 brd ff:ff:ff:ff:ff:ff
5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
link/ether ac:1f:6b:14:75:87 brd ff:ff:ff:ff:ff:ff
217: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether ac:1f:6b:14:74:43 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.50/24 scope global br0
valid_lft forever preferred_lft forever
brctl showstp br0
:
br0
bridge id 8000.ac1f6b147443
designated root 8000.ac1f6b147443
root port 0 path cost 0
max age 20.00 bridge max age 20.00
hello time 2.00 bridge hello time 2.00
forward delay 15.00 bridge forward delay 15.00
ageing time 300.00
hello timer 1.39 tcn timer 0.00
topology change timer 0.00 gc timer 8.39
flags
eth1 (2)
port id 8002 state forwarding
designated root 8000.ac1f6b147443 path cost 4
designated bridge 8000.ac1f6b147443 message age timer 0.00
designated port 8002 forward delay timer 0.00
designated cost 0 hold timer 0.00
flags
eth3 (1)
port id 8001 state forwarding
designated root 8000.ac1f6b147443 path cost 4
designated bridge 8000.ac1f6b147443 message age timer 0.00
designated port 8001 forward delay timer 0.00
designated cost 0 hold timer 0.00
flags
sysctl net.ipv4.ip_forward
:
net.ipv4.ip_forward = 1
我的计算机的 MAC 地址显示在 中brctl showmacs br0
。我的计算机可以 ping 并访问 NAS (192.168.1.50),但无法 ping 网关 (192.168.1.1)。但是,NAS 无法 ping 我的计算机。NAS 仍连接到网络和互联网。