This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
сервисы_gateway_и_routing [2021/01/18 09:14] val [NetFilter iproute2 (Linux)] |
сервисы_gateway_и_routing [2022/01/29 19:43] val [NetFilter iproute2 (Linux)] |
||
---|---|---|---|
Line 281: | Line 281: | ||
# ip route show table all | grep 'table 10[12]' | # ip route show table all | grep 'table 10[12]' | ||
- | # ip rule add from 192.168.X.0/25 table 101 | + | # ip rule show |
- | # ip rule add from 192.168.X.128/25 table 102 | + | |
- | # ip rule add from 192.168.X.0/24 to 192.168.X.0/24 table main | + | # ip rule add prio 100 from 192.168.X.0/24 to 192.168.X.0/24 table main |
+ | # ip rule add prio 200 from 192.168.X.0/25 table 101 | ||
+ | # ip rule add prio 300 from 192.168.X.128/25 table 102 | ||
# ip rule show | # ip rule show | ||
- | # ip rule del from 192.168.X.0/24 to 192.168.X.0/24 table main | + | # ip rule del prio 300 |
- | # ip rule del from any table 101 | + | # ip rule del prio 200 |
- | # ip rule del from any table 102 | + | # ip rule del prio 100 |
+ | |||
+ | # ip route del default via 172.16.1.254 table 101 | ||
+ | # ip route del default via 172.16.2.254 table 102 | ||
+ | |||
+ | # ip route flush table 101 | ||
+ | # ip route flush table 102 | ||
</code> | </code> | ||
Line 300: | Line 308: | ||
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.X.0/24 -j SNAT --to-source 172.16.1.X | iptables -t nat -A POSTROUTING -o eth1 -s 192.168.X.0/24 -j SNAT --to-source 172.16.1.X | ||
iptables -t nat -A POSTROUTING -o eth3 -s 192.168.X.0/24 -j SNAT --to-source 172.16.2.X | iptables -t nat -A POSTROUTING -o eth3 -s 192.168.X.0/24 -j SNAT --to-source 172.16.2.X | ||
+ | #iptables -t nat -A POSTROUTING -o eth2 -s 192.168.X.0/24 -j SNAT --to-source 172.16.2.X | ||
conntrack -F | conntrack -F | ||
Line 315: | Line 324: | ||
post-up ip rule add prio 100 from 192.168.X.0/24 to 192.168.X.0/24 table main | post-up ip rule add prio 100 from 192.168.X.0/24 to 192.168.X.0/24 table main | ||
post-up ip rule add prio 200 from 192.168.X.0/25 table 101 | post-up ip rule add prio 200 from 192.168.X.0/25 table 101 | ||
- | post-up ip rule add prio 200 from 192.168.X.128/25 table 102 | + | post-up ip rule add prio 300 from 192.168.X.128/25 table 102 |
| | ||
address 192.168.X.1 | address 192.168.X.1 |