大网数据广告活动
服务器运维问答

LAN behind a LAN access to Internet

· 52CE 我爱测

I work at home and have work equipment. They are installed in the work LAN, on a switch, itself connected to a server with a DHCP server (on 10.7.37.0/24) and routing with the personal LAN. The internet comes from a router which …

问题原文

原帖链接 · Benoit Duffez · CC BY-SA 4.0

I work at home and have work equipment.

They are installed in the work LAN, on a switch, itself connected to a server with a DHCP server (on 10.7.37.0/24) and routing with the personal LAN.

The internet comes from a router which is a DHCP server (on 192.168.0.0/24). This LAN is for personal equipment.

Now the equipments on the work LAN can't reach the internet. I've run tcpdump at the equipment, at the work/personal LAN router, at the WAN/personal LAN router, and the remote server on the internet.

I can see the packets leaving the equipment, passing through the first router and through the second router. However I don't see them reaching the online server.

I also don't see the packets coming back from the internet.

Equipments in work LAN can ping the personal equipments just fine.

Where would be the routing issue?

Here's the network map:

   Device
eth0 10.7.37.2
  |
  |
eth1 10.7.37.1 (DHCP server)
   Router 1 - DHCP server for devices on 10.7.37.0/24
wls1 192.168.0.14 (DHCP client)
  |
  |
br0 192.168.0.1
   Router 2 - DHCP server for devices on 192.168.0.0/24
vlan2 xx.xx.xx.xx public internet IP
  |
  |
Internet

Routing table on router 1:

default via 192.168.0.1 dev wls1
default via 10.7.37.10 dev eth1 metric 1
10.7.37.0/24 dev eth1 proto kernel scope link src 10.7.37.10
192.168.0.0/24 dev wls1 proto kernel scope link src 192.168.0.14

On router 2:

default via xx.xx.xx.1 dev vlan2
10.7.37.0/24 via 192.168.0.14 dev br0
xx.xx.xx.0/24 dev vlan2  proto kernel  scope link  src 47.152.241.191
127.0.0.0/8 dev lo  scope link
169.254.0.0/16 dev br0  proto kernel  scope link  src 169.254.255.1 192.168.0.0/24 dev br0  proto kernel  scope link  src 192.168.0.1

On device:

default via 10.7.37.10 dev eth0 
9.9.9.9 via 10.7.37.10 dev eth0 
10.7.37.0/24 dev eth0  proto kernel  scope link  src 10.7.37.20 
10.7.37.10 dev eth0  scope link 
192.168.0.14 via 10.7.37.10 dev eth0 

已采纳解答

原帖链接 · vx3r · CC BY-SA 4.0

Routing seems to be OK and you are saying that tcpdump shows packets passing trough the routers R1 and R2. Only issue i can see here is the NAT, you have to SNAT or MASQUERADE on R2. If its a linux box with something like:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-09-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。