doc:appunti:net:source_routing
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:net:source_routing [2013/10/22 10:39] – [Source routing con iproute2] niccolo | doc:appunti:net:source_routing [2025/10/07 10:56] (current) – [Firewall dual homed e source routing con Shorewall] niccolo | ||
|---|---|---|---|
| Line 64: | Line 64: | ||
| 32767: | 32767: | ||
| </ | </ | ||
| + | |||
| + | Attenzione alla **priorità delle regole** (rules)! Il numero più basso ha priorità maggiore, se non viene indicato il parametro **'' | ||
| ====== Source IP con ip route ====== | ====== Source IP con ip route ====== | ||
| Line 76: | Line 78: | ||
| ip route add 78.47.114.234/ | ip route add 78.47.114.234/ | ||
| </ | </ | ||
| + | |||
| ====== Routing in base al servizio ====== | ====== Routing in base al servizio ====== | ||
| Line 144: | Line 147: | ||
| ====== Firewall dual homed e source routing con Shorewall ====== | ====== Firewall dual homed e source routing con Shorewall ====== | ||
| - | **Esempio**: | + | **Esempio**: |
| Queste le accortezze da utilizzare: | Queste le accortezze da utilizzare: | ||
| * In **''/ | * In **''/ | ||
| - | * In **''/ | + | * In **''/ |
| + | * In **''/ | ||
| + | * In **''/ | ||
| + | |||
| + | **''/ | ||
| + | |||
| + | < | ||
| + | # Dual-homed external interfaces require global ROUTE_FILTER=No in shorewall.conf. | ||
| + | # The safe policy for connections with untrusted peers is to set accept_source_route to 0. | ||
| + | # Notice: source route packets are nonsensical on a PPP link. | ||
| + | accept_source_route = 0 | ||
| + | net eth0 tcpflags, | ||
| + | net eth2 tcpflags, | ||
| + | # Enable route filter (rp_filter kernel paramter) specifically on the local interface. | ||
| + | loc eth1 dhcp, | ||
| + | </ | ||
| **''/ | **''/ | ||
| Line 178: | Line 196: | ||
| </ | </ | ||
| - | **''/ | + | **''/ |
| < | < | ||
| - | eth0 10.22.20.0/24 | + | SNAT(217.58.174.226) |
| - | eth2 10.22.20.0/ | + | SNAT(94.94.64.138) 192.168.1.0/ |
| </ | </ | ||
| + | **''/ | ||
| + | |||
| + | < | ||
| + | eth0 10.22.20.0/ | ||
| + | eth2 10.22.20.0/ | ||
| + | </ | ||
| **''/ | **''/ | ||
| < | < | ||
| - | # Mark some traffic to be routed via eth2. | + | # Packets source-routed via eth2 must use eth2 source address, |
| - | iptables -A PREROUTING | + | # otherwise source address for default gateway is used. |
| - | iptables -A PREROUTING -t mangle | + | iptables |
| + | |||
| + | # For connections originating from eth1 LAN. | ||
| + | iptables -A PREROUTING -t mangle | ||
| + | iptables -A PREROUTING -t mangle -i eth1 --proto tcp --dport | ||
| + | |||
| + | # For locally geneated connections. | ||
| + | iptables -A OUTPUT -t mangle --proto tcp --dport 22 -j MARK --set-mark 102 | ||
| </ | </ | ||
doc/appunti/net/source_routing.1382431181.txt.gz · Last modified: by niccolo
