# Linux NAT MASQUERADE 設定

[![image.png](https://note.homesitetw.com/uploads/images/gallery/2025-07/scaled-1680-/75Timage.png)](https://note.homesitetw.com/uploads/images/gallery/2025-07/75Timage.png)

**A網網段 192.168.12.0/24**

**B網網段 10.0.137.0/24**

```
B網將來源偽裝使用 eth0(1.1.1.1) 進入 A網
iptables -t nat -A POSTROUTING -o eth0 -s 10.0.137.0/24 -j MASQUERADE
```

```
A網將來源偽裝使用 eth1(2.2.2.2) 進入 B網
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.12.0/24 -j MASQUERADE
```