Opened 12 months ago
#2573 new
Configuring CIDR for local traffic doesn't allow LAN to WAN traffic due to incorrect iptables SNAT command where network does not begin at .0
| Reported by: | haggismn | Owned by: | |
|---|---|---|---|
| Keywords: | SNAT iptables CIDR | Cc: |
Description
When configuring CIDR on the lan, the iptables command automatically issued for SNATing LAN to WAN traffic to the WAN IP wrongly assumes that the subnet ID is always ending with .0
For example, my network is 172.18.40.64/27, however the iptables command automatically issued concerns the 172.18.40.0/27 network, which isn't in use. (I can see this is done by doing iptables -t nat -L) To remedy this, the following command needs to be used instead of whatever the current command is;
iptables -t nat -A POSTROUTING -o $(nvram get wan_default) -s $(nvram get lan_ipaddr)/$(nvram get lan_netmask) -j SNAT --to $(nvram get wan_ipaddr)
Have seen this occurring all recent builds for Broadcom and Atheros units, such as v18777
Note: See
TracTickets for help on using
tickets.
